This commit is contained in:
Phillip Webb
2015-09-05 10:38:30 -07:00
parent 67402405db
commit 6e29ee4557
125 changed files with 638 additions and 506 deletions

View File

@@ -34,16 +34,16 @@ public class ByteArrayStartsWith extends TypeSafeMatcher<byte[]> {
@Override
public void describeTo(Description description) {
description.appendText("a byte array starting with ").appendValue(bytes);
description.appendText("a byte array starting with ").appendValue(this.bytes);
}
@Override
protected boolean matchesSafely(byte[] item) {
if (item.length < bytes.length) {
if (item.length < this.bytes.length) {
return false;
}
for (int i = 0; i < bytes.length; i++) {
if (item[i] != bytes[i]) {
for (int i = 0; i < this.bytes.length; i++) {
if (item[i] != this.bytes[i]) {
return false;
}
}

View File

@@ -90,6 +90,17 @@ public class ExecutableArchiveLauncherTests {
assertArrayEquals(urls, ((URLClassLoader) classLoader).getURLs());
}
private void doWithTccl(ClassLoader classLoader, Callable<?> action) throws Exception {
ClassLoader old = Thread.currentThread().getContextClassLoader();
try {
Thread.currentThread().setContextClassLoader(classLoader);
action.call();
}
finally {
Thread.currentThread().setContextClassLoader(old);
}
}
private static final class UnitTestExecutableArchiveLauncher extends
ExecutableArchiveLauncher {
@@ -103,15 +114,4 @@ public class ExecutableArchiveLauncherTests {
}
}
private void doWithTccl(ClassLoader classLoader, Callable<?> action) throws Exception {
ClassLoader old = Thread.currentThread().getContextClassLoader();
try {
Thread.currentThread().setContextClassLoader(classLoader);
action.call();
}
finally {
Thread.currentThread().setContextClassLoader(old);
}
}
}

View File

@@ -57,8 +57,8 @@ public class JarFileArchiveTests {
private void setup(boolean unpackNested) throws Exception {
this.rootJarFile = this.temporaryFolder.newFile();
this.rootJarFileUrl = rootJarFile.toURI().toString();
System.out.println(rootJarFileUrl);
this.rootJarFileUrl = this.rootJarFile.toURI().toString();
System.out.println(this.rootJarFileUrl);
TestJarCreator.createTestJar(this.rootJarFile, unpackNested);
this.archive = new JarFileArchive(this.rootJarFile);
}