test/java/util/stream/bootlib/java/util/stream/StreamTestScenario.java

Print this page
rev 7630 : 8019395: Consolidate StreamSupport.{stream,parallelStream} into a single method
Reviewed-by: henryjen
rev 7633 : 8017513: Support for closeable streams
Reviewed-by:
Contributed-by: brian.goetz@oracle.com

@@ -37,18 +37,19 @@
  * the same output (modulo allowable differences in ordering).
  */
 @SuppressWarnings({"rawtypes", "unchecked"})
 public enum StreamTestScenario implements OpTestCase.BaseStreamTestScenario {
 
-    STREAM_FOR_EACH(false) {
+    STREAM_FOR_EACH_WITH_CLOSE(false) {
         <T, U, S_IN extends BaseStream<T, S_IN>>
         void _run(TestData<T, S_IN> data, Consumer<U> b, Function<S_IN, Stream<U>> m) {
             Stream<U> s = m.apply(data.stream());
             if (s.isParallel()) {
                 s = s.sequential();
             }
             s.forEach(b);
+            s.close();
         }
     },
 
     // Collec to list
     STREAM_COLLECT(false) {