Skip to content

Commit

Permalink
fix: recognize the classpath entry as testable when it contains test …
Browse files Browse the repository at this point in the history
…in its attribute (#762)
  • Loading branch information
jdneo authored Aug 2, 2019
1 parent aed01a2 commit 1a88f87
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,17 +122,19 @@ public static boolean isTest(IClasspathEntry entry) {
return false;
}

if (entry.isTest()) {
return true;
}

for (final IClasspathAttribute attribute : entry.getExtraAttributes()) {
if (MAVEN_SCOPE_ATTRIBUTE.equals(attribute.getName()) ||
GRADLE_SCOPE_ATTRIBUTE.equals(attribute.getName())) {
return TEST_SCOPE.equals(attribute.getValue());
}
if (TEST_SCOPE.equals(attribute.getName())) {
return "true".equalsIgnoreCase(attribute.getValue());
// the attribute value might be "test" or "integrationTest"
return attribute.getValue() != null && attribute.getValue().toLowerCase().contains(TEST_SCOPE);
}
}

return entry.isTest();
return false;
}

public static boolean isProjectBelongToPath(IProject project, IPath path) {
Expand Down

0 comments on commit 1a88f87

Please sign in to comment.