Skip to content

Commit

Permalink
Issue #4842: make test for creating listener with location clean temp…
Browse files Browse the repository at this point in the history
… file
  • Loading branch information
liscju authored and romani committed Aug 26, 2017
1 parent a3ba3ba commit fd8312d
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/test/java/com/puppycrawl/tools/checkstyle/MainTest.java
Expand Up @@ -60,6 +60,7 @@
import org.junit.contrib.java.lang.system.SystemOutRule;
import org.junit.rules.TemporaryFolder;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;

Expand Down Expand Up @@ -573,12 +574,14 @@ public void testCreateListenerWithLocationIllegalStateException() throws Excepti
ex.getCause() instanceof IllegalStateException);
}
finally {
verifyStatic(times(1));
final ArgumentCaptor<OutputStream> out =
ArgumentCaptor.forClass(OutputStream.class);
CommonUtils.close(out.capture());
out.getValue().close();
// method creates output folder
FileUtils.deleteQuietly(new File(outDir));
}

verifyStatic(times(1));
CommonUtils.close(any(OutputStream.class));
}

@Test
Expand Down

0 comments on commit fd8312d

Please sign in to comment.