Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions guava-tests/test/com/google/common/reflect/ClassPathTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,9 @@ public void testLocationsFrom_idempotentScan() throws IOException {
ClassPath.locationsFrom(getClass().getClassLoader());
assertThat(locations).isNotEmpty();
for (ClassPath.LocationInfo location : locations) {
if (isInBuildOutputDirectory(location.file())) {
continue;
}
ImmutableSet<ResourceInfo> resources = location.scanResources();
assertThat(location.scanResources()).containsExactlyElementsIn(resources);
}
Expand Down Expand Up @@ -622,6 +625,13 @@ private static ImmutableSet<String> scanResourceNames(ClassLoader loader) throws
return builder.build();
}

// Build output directories (e.g., target/, build/) may have files written during test execution.
private static boolean isInBuildOutputDirectory(File file) {
String path = file.getPath();
return path.contains(File.separator + "target" + File.separator)
|| path.contains(File.separator + "build" + File.separator);
}

private static boolean isWindows() {
return OS_NAME.value().startsWith("Windows");
}
Expand Down