99import java .nio .file .Path ;
1010import java .util .List ;
1111import java .util .stream .Collectors ;
12+ import java .util .stream .Stream ;
1213
1314import static org .junit .jupiter .api .Assertions .assertEquals ;
1415
@@ -30,16 +31,29 @@ public void testSpitAndResolveGlobs(@TempDir Path dir) throws IOException {
3031 Files .createFile (dir .resolve ("b2.txt" ));
3132 Files .createFile (dir .resolve ("c1.txt" ));
3233
33- String basePath = dir + File . separator ;
34+ String baseGlob = dir + "/" ; // glob resolver only accepts "/" as splitter
3435
3536 assertEquals (List .of (), PathsHandler .splitAndResolveGlobs ("" ));
36- assertEquals (List .of (), PathsHandler .splitAndResolveGlobs (basePath + "a" ));
37- assertEquals (List .of (), PathsHandler .splitAndResolveGlobs (basePath + "a" + File .pathSeparator + "b/c/d" ));
37+ assertEquals (List .of (), PathsHandler .splitAndResolveGlobs (baseGlob + "a" ));
38+ assertEquals (List .of (), PathsHandler .splitAndResolveGlobs (baseGlob + "a" + File .pathSeparator + "b/c/d" ));
3839
39- assertEquals (List .of (basePath + "a1.txt" , basePath + "a2.txt" ),
40- PathsHandler .splitAndResolveGlobs (basePath + "a*" ).stream ().map (p -> p .toAbsolutePath ().toString ()).sorted ().collect (Collectors .toList ()));
4140 assertEquals (
42- List .of (basePath + "a1.txt" , basePath + "a2.txt" , basePath + "b1.txt" , basePath + "b2.txt" ),
43- PathsHandler .splitAndResolveGlobs (basePath + "a*" + File .pathSeparator + basePath + "b*" ).stream ().map (p -> p .toAbsolutePath ().toString ()).sorted ().collect (Collectors .toList ()));
41+ List .of (joinPath (dir , "a1.txt" ), joinPath (dir , "a2.txt" )),
42+ PathsHandler .splitAndResolveGlobs (baseGlob + "a*" ).stream ()
43+ .map (p -> p .toAbsolutePath ().toString ())
44+ .sorted ()
45+ .collect (Collectors .toList ())
46+ );
47+ assertEquals (
48+ List .of (joinPath (dir , "a1.txt" ), joinPath (dir , "a2.txt" ), joinPath (dir , "b1.txt" ), joinPath (dir , "b2.txt" )),
49+ PathsHandler .splitAndResolveGlobs (baseGlob + "a*" + File .pathSeparator + baseGlob + "b*" ).stream ()
50+ .map (p -> p .toAbsolutePath ().toString ())
51+ .sorted ()
52+ .collect (Collectors .toList ())
53+ );
54+ }
55+
56+ private static String joinPath (Object ... elements ) {
57+ return Stream .of (elements ).map (String ::valueOf ).collect (Collectors .joining (File .separator ));
4458 }
4559}
0 commit comments