diff --git a/junit-jupiter-migration-support/src/main/java/org/junit/jupiter/migrationsupport/rules/ParameterizedExtension.java b/junit-jupiter-migration-support/src/main/java/org/junit/jupiter/migrationsupport/rules/ParameterizedExtension.java index 1bb267820e6c..c7d7356b40c5 100644 --- a/junit-jupiter-migration-support/src/main/java/org/junit/jupiter/migrationsupport/rules/ParameterizedExtension.java +++ b/junit-jupiter-migration-support/src/main/java/org/junit/jupiter/migrationsupport/rules/ParameterizedExtension.java @@ -21,8 +21,6 @@ import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Collection; -import java.util.Collections; -import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Optional; @@ -61,10 +59,10 @@ public boolean supports(ContainerExtensionContext context) { } @Override - public Iterator provide(ContainerExtensionContext context) { + public Stream provide(ContainerExtensionContext context) { // grabbing the parent ensures the paremeters are stored in the same store. return context.getParent().flatMap(ParameterizedExtension::parameters).map( - ParameterizedExtension::testTemplateContextsFromParameters).orElse(Collections.emptyIterator()); + ParameterizedExtension::testTemplateContextsFromParameters).orElse(Stream.empty()); } /** @@ -204,8 +202,8 @@ private static Optional ensureSingleParametersMethod(Class testClass) m -> m.isAnnotationPresent(Parameterized.Parameters.class)).stream().findFirst(); } - private static Iterator testTemplateContextsFromParameters(Collection o) { - return o.stream().map(ParameterizedExtension::contextFactory).iterator(); + private static Stream testTemplateContextsFromParameters(Collection o) { + return o.stream().map(ParameterizedExtension::contextFactory); } private static TestTemplateInvocationContext contextFactory(Object[] parameters) {