michael-o commented on code in PR #772:
URL: https://github.com/apache/maven-surefire/pull/772#discussion_r1733462682


##########
surefire-providers/surefire-junit-platform/src/main/java/org/apache/maven/surefire/junitplatform/JUnitPlatformProvider.java:
##########
@@ -173,15 +173,17 @@ private void invokeAllTests(TestsToRun testsToRun, 
RunListenerAdapter adapter) {
 
     private void execute(TestsToRun testsToRun, RunListenerAdapter adapter) {
         if (testsToRun.allowEagerReading()) {
-            List<DiscoverySelector> selectors = new ArrayList<>();
-            testsToRun.iterator().forEachRemaining(c -> 
selectors.add(selectClass(c.getName())));
+            testsToRun.iterator().forEachRemaining(c -> {
+                List<DiscoverySelector> selectors = new ArrayList<>();
+                selectors.add(selectClass(c.getName()));
 
-            LauncherDiscoveryRequestBuilder builder = request()
-                    .filters(filters)
-                    .configurationParameters(configurationParameters)
-                    .selectors(selectors);
+                LauncherDiscoveryRequestBuilder builder = request()
+                        .filters(filters)
+                        .configurationParameters(configurationParameters)
+                        .selectors(selectors);
 
-            launcher.execute(builder.build(), adapter);
+                launcher.execute(builder.build(), adapter);
+            });

Review Comment:
   Please call me stupid, but where is the difference to the `else` block now? 
This just outfactored the selectors to a list and is created fresh with each 
item in the iterator. Identical to the `else` block, no?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to