aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesse Wilson <jessewilson@google.com>2012-01-10 16:07:04 -0500
committerJesse Wilson <jessewilson@google.com>2012-01-10 16:07:04 -0500
commitb4fdb175545f178c642194bc43a3fad31af3f0e9 (patch)
tree3064a6730efc63a791b9f13d80a96698f26304ca
parent31c34ef392ca364c845f71b4cc8f84de2739426b (diff)
downloaddexmaker-b4fdb175545f178c642194bc43a3fad31af3f0e9.tar.gz
Fix build on a JVM.
-rw-r--r--src/test/java/com/google/dexmaker/stock/ProxyBuilderTest.java12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/test/java/com/google/dexmaker/stock/ProxyBuilderTest.java b/src/test/java/com/google/dexmaker/stock/ProxyBuilderTest.java
index 70b7249..d613053 100644
--- a/src/test/java/com/google/dexmaker/stock/ProxyBuilderTest.java
+++ b/src/test/java/com/google/dexmaker/stock/ProxyBuilderTest.java
@@ -17,7 +17,6 @@
package com.google.dexmaker.stock;
import com.google.dexmaker.DexMakerTest;
-import dalvik.system.PathClassLoader;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.InvocationHandler;
@@ -551,13 +550,13 @@ public class ProxyBuilderTest extends TestCase {
}
public void testClassNotCachedWithDifferentParentClassLoaders() throws Exception {
- ClassLoader classLoaderA = new PathClassLoader("", getClass().getClassLoader());
+ ClassLoader classLoaderA = newPathClassLoader();
SimpleClass a = proxyFor(SimpleClass.class)
.parentClassLoader(classLoaderA)
.build();
assertEquals(classLoaderA, a.getClass().getClassLoader().getParent());
- ClassLoader classLoaderB = new PathClassLoader("", getClass().getClassLoader());
+ ClassLoader classLoaderB = newPathClassLoader();
SimpleClass b = proxyFor(SimpleClass.class)
.parentClassLoader(classLoaderB)
.build();
@@ -566,6 +565,13 @@ public class ProxyBuilderTest extends TestCase {
assertTrue(a.getClass() != b.getClass());
}
+ private ClassLoader newPathClassLoader() throws Exception {
+ return (ClassLoader) Class.forName("dalvik.system.PathClassLoader")
+ .getConstructor(String.class, ClassLoader.class)
+ .newInstance("", getClass().getClassLoader());
+
+ }
+
public void testSubclassOfRandom() throws Exception {
proxyFor(Random.class)
.handler(new InvokeSuperHandler())