Github user pnowojski commented on a diff in the pull request:
https://github.com/apache/flink/pull/5193#discussion_r159229650
--- 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 --
@tzulitai, @GJL is correct, `Environment` is not
`Closeable`/`AutoCloseable`. Also I was afraid that someone might be reusing
some external environment, but I think that's not the case.
Using `environmentIsInternal` flag would require some casting, that's why I
have chosen `Optional`.
+1 for `internalEnvironment.ifPresent(MockEnvironment::close);`
---