Copilot commented on code in PR #3432:
URL: https://github.com/apache/maven-surefire/pull/3432#discussion_r3781416151
##########
surefire-providers/surefire-junit-platform/src/main/java/org/apache/maven/surefire/junitplatform/RunListenerAdapter.java:
##########
@@ -208,6 +208,32 @@ private Stream<TestIdentifier>
collectAllTestIdentifiersInHierarchy(TestIdentifi
.orElseGet(Stream::empty);
}
+ /**
+ * Extract the invocation index from a JUnit Jupiter {@code
[class-template-invocation:#N]} unique-id
+ * segment. JUnit 6 {@code @ParameterizedClass} uses this segment; the
method-level legacy name
+ * no longer carries the {@code [N]} suffix that {@code
@ParameterizedTest} still has.
+ *
+ * @param uniqueId the platform unique id string
+ * @return the numeric index, or {@code null} when the id has no
class-template invocation
+ */
+ private static String extractClassTemplateInvocationIndex(String uniqueId)
{
+ if (uniqueId == null) {
+ return null;
+ }
+ String marker = "[class-template-invocation:";
+ int start = uniqueId.lastIndexOf(marker);
Review Comment:
This keeps only the innermost class-template invocation. JUnit 6 supports
nested `@ParameterizedClass` declarations, whose method IDs contain multiple
such segments; with the affected legacy names, outer #1/inner #1 and outer
#2/inner #1 would both be reported as `method()[1]`, so rerun aggregation can
still collapse distinct tests. Collect every class-template invocation index
and add a nested regression case.
This issue also appears on line 503 of the same file.
--
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]