Skip to content

Commit

Permalink
Issue checkstyle#11446: Updated CheckerTest tests to stop verify usage
Browse files Browse the repository at this point in the history
  • Loading branch information
MANISH-K-07 authored and romani committed Jan 31, 2024
1 parent ebd42fd commit 84104c4
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -894,18 +894,17 @@ public void testCacheAndFilterWhichDoesNotImplementExternalResourceHolderInterfa
final File cacheFile = File.createTempFile("junit", null, temporaryFolder);
checkerConfig.addProperty("cacheFile", cacheFile.getPath());

final String[] expected = CommonUtil.EMPTY_STRING_ARRAY;
final String pathToEmptyFile =
File.createTempFile("file", ".java", temporaryFolder).getPath();

verify(checkerConfig, pathToEmptyFile, expected);
execute(checkerConfig, pathToEmptyFile);
final Properties cacheAfterFirstRun = new Properties();
try (BufferedReader reader = Files.newBufferedReader(cacheFile.toPath())) {
cacheAfterFirstRun.load(reader);
}

// One more time to use cache.
verify(checkerConfig, pathToEmptyFile, expected);
execute(checkerConfig, pathToEmptyFile);
final Properties cacheAfterSecondRun = new Properties();
try (BufferedReader reader = Files.newBufferedReader(cacheFile.toPath())) {
cacheAfterSecondRun.load(reader);
Expand Down Expand Up @@ -1049,9 +1048,8 @@ public void testCacheOnViolationSuppression() throws Exception {

final String fileViolationPath =
File.createTempFile("ViolationFile", ".java", temporaryFolder).getPath();
final String[] expected = CommonUtil.EMPTY_STRING_ARRAY;

verify(checkerConfig, fileViolationPath, expected);
execute(checkerConfig, fileViolationPath);

try (InputStream input = Files.newInputStream(cacheFile.toPath())) {
final Properties details = new Properties();
Expand Down

0 comments on commit 84104c4

Please sign in to comment.