Skip to content

Commit

Permalink
fix: check the property targerModult not null (#435)
Browse files Browse the repository at this point in the history
  • Loading branch information
danglotb committed May 16, 2018
1 parent 7dbcf35 commit 9022da6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions dspot/src/main/java/fr/inria/stamp/diff/SelectorOnDiff.java
Expand Up @@ -177,13 +177,15 @@ private Set<CtMethod> getTestMethodsOfModifiedTestClasses(Set<String> modifiedJa
return modifiedJavaFiles.stream()
.filter(presentInBothVersion)
.map(modifiedJavaFile -> {
final String directoryPath = (this.configuration.getProperty("targetModule") +
(this.configuration.getProperty("targetModule").isEmpty() ? "" : "/") +
this.configuration.getRelativeSourceCodeDir());
final String directoryPath =
(this.configuration.getProperty("targetModule") != null ?
this.configuration.getProperty("targetModule") + "/" : ""
) + this.configuration.getRelativeSourceCodeDir();
final String qualifiedNameWithExtension = modifiedJavaFile.substring(directoryPath.length() + 2).replaceAll("/", ".");
return qualifiedNameWithExtension.substring(0, qualifiedNameWithExtension.length() - ".java".length());
})
.map(fullQualifiedName -> this.factory.Class().get(fullQualifiedName))
.filter(Objects::nonNull)
.filter(potentialTestClass -> potentialTestClass.getMethods().stream().anyMatch(AmplificationChecker::isTest))
.flatMap(testClass -> testClass.getMethods().stream().filter(AmplificationChecker::isTest))
.collect(Collectors.toSet());
Expand Down

0 comments on commit 9022da6

Please sign in to comment.