sdedic commented on code in PR #4924:
URL: https://github.com/apache/netbeans/pull/4924#discussion_r1027749616
##########
java/maven/src/org/netbeans/modules/maven/execute/DefaultReplaceTokenProvider.java:
##########
@@ -215,8 +214,13 @@ private static FileObject[]
extractFileObjectsfromLookup(Lookup lookup) {
HashSet<String> test = new HashSet<String>();
addSelectedFiles(false, fos, test);
addSelectedFiles(true, fos, test);
- String files2test = test.toString().replace(" ", "");
- packClassname.append(files2test.substring(1,
files2test.length() - 1));
+
+ packClassname.append(test
+ .stream()
+ .map(String::trim)
+ .collect(Collectors.joining(","))
Review Comment:
Please check whether syntax with comma-separated package names (not paths)
works in ancient Surefire version - according to docs, there were some
significant changes in Surefire 2.19. We recommend Surefire 2.22 for Junit5,
and surefire 2.8 (which may fail with this syntax) for single test run. See
`org.netbeans.modules.maven.ActionProviderImp::checkSurefire` for details.
##########
java/maven/test/unit/src/org/netbeans/modules/maven/execute/DefaultReplaceTokenProviderTest.java:
##########
@@ -64,23 +65,71 @@ public void testTestSingle() throws Exception {
// XXX test src/main/java selections
// XXX test selections across groups, or outside groups
// XXX test single methods
-
+
//#213671
assertEquals(null, ActionProviderImpl.replacements(p,
ActionProvider.COMMAND_RUN,
Lookup.EMPTY).get(DefaultReplaceTokenProvider.PACK_CLASSNAME));
assertEquals(null, ActionProviderImpl.replacements(p,
ActionProvider.COMMAND_RUN,
Lookup.EMPTY).get(DefaultReplaceTokenProvider.CLASSNAME));
assertEquals(null, ActionProviderImpl.replacements(p,
ActionProvider.COMMAND_RUN,
Lookup.EMPTY).get(DefaultReplaceTokenProvider.CLASSNAME_EXT));
-
+
}
-
+
public void testNgSingle() throws Exception {
TestFileUtils.writeFile(d, "pom.xml",
"<project><modelVersion>4.0.0</modelVersion>"
+
"<groupId>g</groupId><artifactId>a</artifactId><version>0</version></project>");
TestFileUtils.writeFile(d, "src/test/java/p1/FirstNGTest.java",
"package p1; class FirstNGTest {}");
TestFileUtils.writeFile(d, "src/main/java/p1/First.java", "package p1;
class First {}");
-
+
Project p = ProjectManager.getDefault().findProject(d);
assertEquals("p1.FirstNGTest", ActionProviderImpl.replacements(p,
ActionProvider.COMMAND_TEST_SINGLE,
Lookups.singleton(d.getFileObject("src/main/java/p1/First.java"))).get(DefaultReplaceTokenProvider.PACK_CLASSNAME));
}
+ public void testIntegration2Files() throws Exception {
Review Comment:
could you also add test that produces multiple patterns in
`packageClassName` ?
--
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