@@ -11,63 +11,61 @@ final class ContextUtilityTests {
1111
1212 @ ParameterizedTest
1313 @ MethodSource ("contextArgs" )
14- final void testContexts (final String expected , final String input , final boolean leading , final boolean trailing ){
15- Assertions .assertEquals (expected , ContextUtility .getContext (input , leading , trailing ));
14+ final void testContexts (final String expected , final String input , final boolean leading , final boolean trailing ) {
15+ Assertions .assertEquals (expected , ContextUtility .getContext (input , leading , trailing ));
1616 }
1717
18- static Stream <Arguments > contextArgs (){
19- return Stream .of (
20- Arguments .of ("" , "/" , false , false ),
21- Arguments .of ("/" , "" , true , false ),
22- Arguments .of ("/" , "" , false , true ),
23- Arguments .of ("/" , "" , true , true ),
24- Arguments .of ("a" , "a" , false , false ),
25- Arguments .of ("/a" , "a" , true , false ),
26- Arguments .of ("a/" , "a" , false , true ),
27- Arguments .of ("/a/" , "a" , true , true ),
28- Arguments .of ("testNone" , "/testNone/" , false , false ),
29- Arguments .of ("/testLeading" , "testLeading" , true , false ),
30- Arguments .of ("testTrailing/" , "testTrailing" , false , true ),
31- Arguments .of ("/testBoth/" , "testBoth" , true , true ),
32- Arguments .of ("testNoneBackSlash" , "\\ testNoneBackSlash\\ " , false , false ),
33- Arguments .of ("/testBackSlash/" , "\\ testBackSlash\\ " , true , true ),
34- Arguments .of ("/testConsecutiveBackSlash/" , "\\ \\ testConsecutiveBackSlash\\ \\ " , true , true ),
35- Arguments .of ("/testConsecutiveForwardSlash/" , "//testConsecutiveForwardSlash//" , true , true ),
36- Arguments .of ("/testWhitespace/" , " /testWhitespace/ " , true , true ),
37- Arguments .of ("/ testWhitespace /" , "/ testWhitespace /" , true , true ),
38- Arguments .of (" testWhitespace " , "/ testWhitespace /" , false , false ),
39- Arguments .of ("testWhitespace" , " testWhitespace " , false , false ),
40- Arguments .of ("/testWhitespace/" , " /testWhitespace/ " , true , true )
41- );
18+ static Stream <Arguments > contextArgs () {
19+ return Stream .of (
20+ Arguments .of ("" , "/" , false , false ),
21+ Arguments .of ("/" , "" , true , false ),
22+ Arguments .of ("/" , "" , false , true ),
23+ Arguments .of ("/" , "" , true , true ),
24+ Arguments .of ("a" , "a" , false , false ),
25+ Arguments .of ("/a" , "a" , true , false ),
26+ Arguments .of ("a/" , "a" , false , true ),
27+ Arguments .of ("/a/" , "a" , true , true ),
28+ Arguments .of ("testNone" , "/testNone/" , false , false ),
29+ Arguments .of ("/testLeading" , "testLeading" , true , false ),
30+ Arguments .of ("testTrailing/" , "testTrailing" , false , true ),
31+ Arguments .of ("/testBoth/" , "testBoth" , true , true ),
32+ Arguments .of ("testNoneBackSlash" , "\\ testNoneBackSlash\\ " , false , false ),
33+ Arguments .of ("/testBackSlash/" , "\\ testBackSlash\\ " , true , true ),
34+ Arguments .of ("/testConsecutiveBackSlash/" , "\\ \\ testConsecutiveBackSlash\\ \\ " , true , true ),
35+ Arguments .of ("/testConsecutiveForwardSlash/" , "//testConsecutiveForwardSlash//" , true , true ),
36+ Arguments .of ("/testWhitespace/" , " /testWhitespace/ " , true , true ),
37+ Arguments .of ("/ testWhitespace /" , "/ testWhitespace /" , true , true ),
38+ Arguments .of (" testWhitespace " , "/ testWhitespace /" , false , false ),
39+ Arguments .of ("testWhitespace" , " testWhitespace " , false , false ),
40+ Arguments .of ("/testWhitespace/" , " /testWhitespace/ " , true , true ));
4241 }
4342
4443 @ ParameterizedTest
4544 @ MethodSource ("joinArgs" )
46- final void testJoin (final String expected , final boolean leading , final boolean trailing , final String input , final String join ){
47- Assertions .assertEquals (expected , ContextUtility .joinContexts (leading , trailing , input , join ));
45+ final void testJoin (final String expected , final boolean leading , final boolean trailing , final String input , final String join ) {
46+ Assertions .assertEquals (expected , ContextUtility .joinContexts (leading , trailing , input , join ));
4847 }
4948
50- static Stream <Arguments > joinArgs (){
51- return Stream .of (
52- Arguments .of ("testBlank" , false , false , "testBlank" , "" ),
53- Arguments .of ("/testBlank/" , true , true , "testBlank" , "" ),
54- Arguments .of ("testBlank" , false , false , "" , "testBlank" ),
55- Arguments .of ("/testBlank/" , true , true , "" , "testBlank" ),
56- Arguments .of ("" , false , false , "" , "" ),
57- Arguments .of ("/" , true , true , "" , "" ),
58- Arguments .of ("trailing/slash" , false , false , "trailing/" , "slash/" ),
59- Arguments .of ("/trailing/slash/" , true , true , "trailing/" , "slash/" ),
60- Arguments .of ("leading/slash" , false , false , "leading/" , "slash/" ),
61- Arguments .of ("/leading/slash/" , true , true , "leading/" , "slash/" ),
62- Arguments .of ("double/slash" , false , false , "/double/" , "/slash/" ),
63- Arguments .of ("/double/slash/" , true , true , "/double/" , "/slash/" ),
64- Arguments .of ("no/slash" , false , false , "no" , "slash" ),
65- Arguments .of ("/no/slash/" , true , true , "no" , "slash" ),
66- Arguments .of ("consecutive/slash" , false , false , "//consecutive//" , "//slash//" ),
67- Arguments .of ("/consecutive/slash/" , true , true , "//consecutive//" , "//slash//" ),
68- Arguments .of ("mixed/slash" , false , false , "\\ mixed\\ " , "//slash//" ),
69- Arguments .of ("/mixed/slash/" , true , true , "\\ mixed\\ " , "//slash//" )
70- );
49+ static Stream <Arguments > joinArgs () {
50+ return Stream .of (
51+ Arguments .of ("testBlank" , false , false , "testBlank" , "" ),
52+ Arguments .of ("/testBlank/" , true , true , "testBlank" , "" ),
53+ Arguments .of ("testBlank" , false , false , "" , "testBlank" ),
54+ Arguments .of ("/testBlank/" , true , true , "" , "testBlank" ),
55+ Arguments .of ("" , false , false , "" , "" ),
56+ Arguments .of ("/" , true , true , "" , "" ),
57+ Arguments .of ("trailing/slash" , false , false , "trailing/" , "slash/" ),
58+ Arguments .of ("/trailing/slash/" , true , true , "trailing/" , "slash/" ),
59+ Arguments .of ("leading/slash" , false , false , "leading/" , "slash/" ),
60+ Arguments .of ("/leading/slash/" , true , true , "leading/" , "slash/" ),
61+ Arguments .of ("double/slash" , false , false , "/double/" , "/slash/" ),
62+ Arguments .of ("/double/slash/" , true , true , "/double/" , "/slash/" ),
63+ Arguments .of ("no/slash" , false , false , "no" , "slash" ),
64+ Arguments .of ("/no/slash/" , true , true , "no" , "slash" ),
65+ Arguments .of ("consecutive/slash" , false , false , "//consecutive//" , "//slash//" ),
66+ Arguments .of ("/consecutive/slash/" , true , true , "//consecutive//" , "//slash//" ),
67+ Arguments .of ("mixed/slash" , false , false , "\\ mixed\\ " , "//slash//" ),
68+ Arguments .of ("/mixed/slash/" , true , true , "\\ mixed\\ " , "//slash//" ));
7169 }
7270
7371}
0 commit comments