Skip to content

Commit

Permalink
Merge pull request #12207 from glefloch/fix/11406
Browse files Browse the repository at this point in the history
clean jandex index after test
  • Loading branch information
jaikiran authored Sep 24, 2020
2 parents 4b514ac + 39cad70 commit 4aaab0c
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,19 @@ public void canDetectOutputChangeWhenBuilding() throws Exception {
assertThat(runnerJar).exists();
}

@Test
public void canDetectUpToDateTests() throws Exception {
createProject(SourceType.JAVA);

BuildResult firstBuild = runGradleWrapper(projectRoot, "test");

assertThat(firstBuild.getTasks().get(":test")).isEqualTo(BuildResult.SUCCESS_OUTCOME);

BuildResult secondBuild = runGradleWrapper(projectRoot, "test");

assertThat(secondBuild.getTasks().get(":test")).isEqualTo(BuildResult.UPTODATE_OUTCOME);
}

@Test
public void canDetectSystemPropertyChangeWhenBuilding() throws Exception {
createProject(SourceType.JAVA);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,15 @@ public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOEx
}
});
}

public static void removeIndex(Class<?> requiredTestClass) {
Path indexPath = indexPath(requiredTestClass);
if (Files.exists(indexPath)) {
try {
Files.delete(indexPath);
} catch (IOException e) {
throw new IllegalStateException("Unable to delete file index", e);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,10 @@ public void close() throws IOException {
}
tm.close();
}
try {
TestClassIndexer.removeIndex(requiredTestClass);
} catch (Exception ignored) {
}
}
}
};
Expand Down

0 comments on commit 4aaab0c

Please sign in to comment.