3434import java .util .jar .JarEntry ;
3535import java .util .jar .JarInputStream ;
3636import java .util .jar .JarOutputStream ;
37+ import java .util .stream .Stream ;
3738import org .apache .commons .io .IOUtils ;
3839import org .apache .logging .log4j .core .config .plugins .processor .PluginCache ;
3940import org .apache .logging .log4j .core .config .plugins .processor .PluginEntry ;
4243import org .junit .jupiter .api .AfterAll ;
4344import org .junit .jupiter .api .BeforeAll ;
4445import org .junit .jupiter .api .Test ;
46+ import org .junit .jupiter .params .ParameterizedTest ;
47+ import org .junit .jupiter .params .provider .Arguments ;
48+ import org .junit .jupiter .params .provider .MethodSource ;
4549
4650final class Log4j2PluginCacheFileTransformerTest {
4751
@@ -110,16 +114,9 @@ private void assertTransformedCacheFile(
110114 }
111115 }
112116
113- @ Test
114- public void testRelocation () throws IOException {
115- // test with matching relocator
116- testRelocation ("org.apache.logging" , "new.location.org.apache.logging" , "new.location.org.apache.logging" );
117-
118- // test without matching relocator
119- testRelocation ("com.apache.logging" , "new.location.com.apache.logging" , "org.apache.logging" );
120- }
121-
122- private void testRelocation (final String src , final String pattern , final String target ) throws IOException {
117+ @ ParameterizedTest
118+ @ MethodSource ("relocationParameters" )
119+ public void testRelocation (final String src , final String pattern , final String target ) throws IOException {
123120 final Log4j2PluginCacheFileTransformer transformer = new Log4j2PluginCacheFileTransformer ();
124121 final Relocator log4jRelocator = new SimpleRelocator (src , pattern , null , null );
125122 final PluginCache aggregator = new PluginCache ();
@@ -135,6 +132,15 @@ private void testRelocation(final String src, final String pattern, final String
135132 }
136133 }
137134
135+ private static Stream <Arguments > relocationParameters () {
136+ return Stream .of (
137+ // test with matching relocator
138+ Arguments .of (
139+ "org.apache.logging" , "new.location.org.apache.logging" , "new.location.org.apache.logging" ),
140+ // test without matching relocator
141+ Arguments .of ("com.apache.logging" , "new.location.com.apache.logging" , "org.apache.logging" ));
142+ }
143+
138144 @ AfterAll
139145 public static void tearDown () {
140146 pluginUrl = null ;
0 commit comments