|
|
|
@ -138,6 +138,30 @@ public class RepackagerTests {
|
|
|
|
|
new Repackager(this.testJarFile.getFile()).repackage(NO_LIBRARIES);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void noMainClassAndLayoutIsNone() throws Exception {
|
|
|
|
|
this.testJarFile.addClass("a/b/C.class", ClassWithMainMethod.class);
|
|
|
|
|
File file = this.testJarFile.getFile();
|
|
|
|
|
Repackager repackager = new Repackager(file);
|
|
|
|
|
repackager.setLayout(new Layouts.None());
|
|
|
|
|
repackager.repackage(file, NO_LIBRARIES);
|
|
|
|
|
Manifest actualManifest = getManifest(file);
|
|
|
|
|
assertThat(actualManifest.getMainAttributes().getValue("Main-Class"),
|
|
|
|
|
equalTo("a.b.C"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void noMainClassAndLayoutIsNoneWithNoMain() throws Exception {
|
|
|
|
|
this.testJarFile.addClass("a/b/C.class", ClassWithoutMainMethod.class);
|
|
|
|
|
File file = this.testJarFile.getFile();
|
|
|
|
|
Repackager repackager = new Repackager(file);
|
|
|
|
|
repackager.setLayout(new Layouts.None());
|
|
|
|
|
repackager.repackage(file, NO_LIBRARIES);
|
|
|
|
|
Manifest actualManifest = getManifest(file);
|
|
|
|
|
assertThat(actualManifest.getMainAttributes().getValue("Main-Class"),
|
|
|
|
|
equalTo(null));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void sameSourceAndDestinationWithBackup() throws Exception {
|
|
|
|
|
this.testJarFile.addClass("a/b/C.class", ClassWithMainMethod.class);
|
|
|
|
|