marcphilipp commented on code in PR #828:
URL: https://github.com/apache/maven-surefire/pull/828#discussion_r2028694671


##########
surefire-providers/surefire-junit-platform/src/main/java/org/apache/maven/surefire/junitplatform/RunListenerAdapter.java:
##########
@@ -216,11 +217,25 @@ private SimpleReportEntry createReportEntry(
             String reason,
             Integer elapsedTime) {
         String[] classMethodName = toClassMethodName(testIdentifier);
-        String className = classMethodName[0];
+
+        Optional<UniqueId.Segment> classSegment = 
testIdentifier.getUniqueIdObject().getSegments().stream()
+                .filter(segment -> "class".equals(segment.getType()))
+                .findFirst();

Review Comment:
   You shouldn't parse the `UniqueId` because it's considered to be an 
implementation detail. Instead, you should use 
`testPlan.getParent(testIdentifier)` to find the right level. If this should 
only support class-based engines, finding the last one with a `TestSource` of 
type `ClassSource` should work. If this should also work for file-based engines 
like Cucumber, you might want to use a differeny heuristic instead. Maybe 
always use the level immediate below the root (engine descriptor)? If it has a 
`ClassSource`, use that; otherwise, use the display name (similar to what 
`toClassMethodName` does)?



-- 
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: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to