Github user GJL commented on a diff in the pull request: https://github.com/apache/flink/pull/5193#discussion_r159154132 --- Diff: flink-streaming-java/src/test/java/org/apache/flink/streaming/util/AbstractStreamOperatorTestHarness.java --- @@ -492,6 +503,10 @@ public void close() throws Exception { processingTimeService.shutdownService(); } setupCalled = false; + + if (internalEnvironment.isPresent()) { --- End diff -- I think to enable this `Environment` must implement `AutoCloseable` as well. Maybe an empty default `close()` method? If you decide to stick with `Optional`, maybe change this line to: `internalEnvironment.ifPresent(MockEnvironment::close);`
---