Github user aljoscha commented on a diff in the pull request: https://github.com/apache/flink/pull/4561#discussion_r134737971 --- Diff: flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/sink/TwoPhaseCommitSinkFunctionTest.java --- @@ -185,11 +253,44 @@ protected void recoverAndAbort(FileTransaction transaction) { private static class FileTransaction { private final File tmpFile; - private final transient Writer writer; + private final transient BufferedWriter writer; public FileTransaction(File tmpFile) throws IOException { this.tmpFile = tmpFile; this.writer = new BufferedWriter(new FileWriter(tmpFile)); } + + @Override + public String toString() { + return String.format("FileTransaction[%s]", tmpFile.getName()); + } + } + + private static class TestContext implements AutoCloseable { + public final File tmpDirectory = Files.createTempDirectory(TwoPhaseCommitSinkFunctionTest.class.getSimpleName() + "_tmp").toFile(); + public final File targetDirectory = Files.createTempDirectory(TwoPhaseCommitSinkFunctionTest.class.getSimpleName() + "_target").toFile(); + + public FileBasedSinkFunction sinkFunction; + public OneInputStreamOperatorTestHarness<String, Object> harness; + + private TestContext() throws Exception { + tmpDirectory.deleteOnExit(); --- End diff -- I think you could also use the `TemporaryFolder` rule for this: ``` @Rule public TemporaryFolder tempFolder = new TemporaryFolder(); ``` but this also seems fine.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---