Copilot commented on code in PR #3659:
URL: https://github.com/apache/maven-surefire/pull/3659#discussion_r4769191933


##########
maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java:
##########
@@ -1292,7 +1292,9 @@ private DefaultScanResult scanDirectories() throws 
MojoFailureException {
     }
 
     List<Artifact> getProjectTestArtifacts() {
-        return project.getTestArtifacts();
+        return project.getArtifacts().stream()
+                .filter(artifact -> 
artifact.getArtifactHandler().isAddedToClasspath())
+                .collect(Collectors.toList());

Review Comment:
   The existing scanner tests bypass this new selection logic: 
AbstractSurefireMojoTest and MojoMocklessTest both override 
getProjectTestArtifacts(). Please add a focused test that invokes the 
production implementation with an ordered artifact set, verifies that handlers 
with isAddedToClasspath() == false are excluded, and checks that eligible 
artifacts retain their identity and order. Include an empty-set case so the 
behavior-preserving replacement is covered directly.



-- 
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