matthiasblaesing commented on PR #8545:
URL: https://github.com/apache/netbeans/pull/8545#issuecomment-2927702348
I had a look at this and I think this is the wrong location to fix this. Try
these two runs:
1. run the full unittests and try to invoke "Run again" from the failing
test `t01Max`
2. open `RangeTest.java` and run that single test:

now try "Run again" in the test results window for that run.
The first run shows the problem you are observing, while the second does
not. The difference between the two can be found in the JUnit Integration for
maven:
https://github.com/apache/netbeans/blob/1947efd398f35c19c524c93749b42bf63813fd94/java/maven.junit.ui/src/org/netbeans/modules/maven/junit/ui/MavenJUnitTestMethodNode.java#L72-L82
The critical section is line 73. For the first run returns
`io.github.jristretto.ranges.RangeTest.t01Max` for `testcase.getName()` while
the second run yields `t01Max`. The difference comes from here:
https://github.com/apache/netbeans/blob/1947efd398f35c19c524c93749b42bf63813fd94/java/junit/src/org/netbeans/modules/junit/api/JUnitTestcase.java#L55-L68
For the full run you get a `suiteName` and thus you get the method name
prefixed with the class. Case 1 goes through line 67, while case 2 goes through
line 64.
Looking at the NB history (Link goes to a git clone of the original
mercurial history):
https://github.com/emilianbold/netbeans-releases/commit/3364af50e2d9714524b6873125dc5ab1f4c36b38
this strange behavior was introduces to handle nested tests and that does
not even work correctly.
I get `io.github.jristretto.ranges.SampleTest$NestedClass2.testMyMethod1`
for the `getName()` call and
`io.github.jristretto.ranges.SampleTest$NestedClass2` for the `getClassName()`
call. So you could just check in `MavenJUnitTestMethodNode.java` if class name
is a prefix of name and if so strip it away. For the nested case more is
required (check for `$` and split them, but that is a different case and is
already broken, so does not need to be fixed here).
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists