|
|
@ -432,7 +432,7 @@ public class RepackagerTests {
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
public void unpackLibrariesTakePrecedenceOverExistingSourceEntries() throws Exception {
|
|
|
|
public void unpackLibrariesTakePrecedenceOverExistingSourceEntries() throws Exception {
|
|
|
|
final TestJarFile nested = new TestJarFile(this.temporaryFolder);
|
|
|
|
TestJarFile nested = new TestJarFile(this.temporaryFolder);
|
|
|
|
nested.addClass("a/b/C.class", ClassWithoutMainMethod.class);
|
|
|
|
nested.addClass("a/b/C.class", ClassWithoutMainMethod.class);
|
|
|
|
final File nestedFile = nested.getFile();
|
|
|
|
final File nestedFile = nested.getFile();
|
|
|
|
this.testJarFile.addFile("lib/" + nestedFile.getName(), nested.getFile());
|
|
|
|
this.testJarFile.addFile("lib/" + nestedFile.getName(), nested.getFile());
|
|
|
@ -447,7 +447,6 @@ public class RepackagerTests {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
JarFile jarFile = new JarFile(file);
|
|
|
|
JarFile jarFile = new JarFile(file);
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
assertThat(jarFile.getEntry("lib/" + nestedFile.getName()).getComment(),
|
|
|
|
assertThat(jarFile.getEntry("lib/" + nestedFile.getName()).getComment(),
|
|
|
@ -461,16 +460,14 @@ public class RepackagerTests {
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
public void existingSourceEntriesTakePrecedenceOverStandardLibraries()
|
|
|
|
public void existingSourceEntriesTakePrecedenceOverStandardLibraries()
|
|
|
|
throws Exception {
|
|
|
|
throws Exception {
|
|
|
|
final TestJarFile nested = new TestJarFile(this.temporaryFolder);
|
|
|
|
TestJarFile nested = new TestJarFile(this.temporaryFolder);
|
|
|
|
nested.addClass("a/b/C.class", ClassWithoutMainMethod.class);
|
|
|
|
nested.addClass("a/b/C.class", ClassWithoutMainMethod.class);
|
|
|
|
final File nestedFile = nested.getFile();
|
|
|
|
final File nestedFile = nested.getFile();
|
|
|
|
this.testJarFile.addFile("lib/" + nestedFile.getName(), nested.getFile());
|
|
|
|
this.testJarFile.addFile("lib/" + nestedFile.getName(), nested.getFile());
|
|
|
|
this.testJarFile.addClass("A.class", ClassWithMainMethod.class);
|
|
|
|
this.testJarFile.addClass("A.class", ClassWithMainMethod.class);
|
|
|
|
File file = this.testJarFile.getFile();
|
|
|
|
File file = this.testJarFile.getFile();
|
|
|
|
Repackager repackager = new Repackager(file);
|
|
|
|
Repackager repackager = new Repackager(file);
|
|
|
|
|
|
|
|
|
|
|
|
long sourceLength = nestedFile.length();
|
|
|
|
long sourceLength = nestedFile.length();
|
|
|
|
|
|
|
|
|
|
|
|
repackager.repackage(new Libraries() {
|
|
|
|
repackager.repackage(new Libraries() {
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
@ -482,7 +479,6 @@ public class RepackagerTests {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
JarFile jarFile = new JarFile(file);
|
|
|
|
JarFile jarFile = new JarFile(file);
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
assertThat(jarFile.getEntry("lib/" + nestedFile.getName()).getSize(),
|
|
|
|
assertThat(jarFile.getEntry("lib/" + nestedFile.getName()).getSize(),
|
|
|
|