@ -139,6 +139,15 @@ class RepackagerTests extends AbstractPackagerTests<Repackager> {
assertThat ( hasLauncherClasses ( this . destination ) ) . isTrue ( ) ;
assertThat ( hasLauncherClasses ( this . destination ) ) . isTrue ( ) ;
}
}
@Test
void layoutFactoryGetsOriginalFile ( ) throws Exception {
this . testJarFile . addClass ( "a/b/C.class" , ClassWithMainMethod . class ) ;
Repackager repackager = createRepackager ( this . testJarFile . getFile ( ) , false ) ;
repackager . setLayoutFactory ( new TestLayoutFactory ( ) ) ;
repackager . repackage ( this . destination , NO_LIBRARIES ) ;
assertThat ( hasLauncherClasses ( this . destination ) ) . isTrue ( ) ;
}
@Test
@Test
void addLauncherScript ( ) throws Exception {
void addLauncherScript ( ) throws Exception {
this . testJarFile . addClass ( "a/b/C.class" , ClassWithMainMethod . class ) ;
this . testJarFile . addClass ( "a/b/C.class" , ClassWithMainMethod . class ) ;
@ -266,4 +275,14 @@ class RepackagerTests extends AbstractPackagerTests<Repackager> {
}
}
static class TestLayoutFactory implements LayoutFactory {
@Override
public Layout getLayout ( File source ) {
assertThat ( source . length ( ) ) . isGreaterThan ( 0 ) ;
return new DefaultLayoutFactory ( ) . getLayout ( source ) ;
}
}
}
}