summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/test/test/javassist/proxy/ProxyCacheGCTest.java4
-rw-r--r--src/test/test/javassist/proxy/ProxyFactoryCompatibilityTest.java1
-rw-r--r--src/test/test/javassist/proxy/ProxySerializationTest.java18
3 files changed, 14 insertions, 9 deletions
diff --git a/src/test/test/javassist/proxy/ProxyCacheGCTest.java b/src/test/test/javassist/proxy/ProxyCacheGCTest.java
index 062872b7..379fefc2 100644
--- a/src/test/test/javassist/proxy/ProxyCacheGCTest.java
+++ b/src/test/test/javassist/proxy/ProxyCacheGCTest.java
@@ -38,6 +38,7 @@ public class ProxyCacheGCTest extends TestCase
public void testCacheGC()
{
ClassLoader oldCL = Thread.currentThread().getContextClassLoader();
+ try {
ProxyFactory.useCache = false;
for (int i = 0; i < REPETITION_COUNT; i++) {
ClassLoader newCL = new TestLoader();
@@ -48,6 +49,9 @@ public class ProxyCacheGCTest extends TestCase
Thread.currentThread().setContextClassLoader(oldCL);
}
}
+ } finally {
+ ProxyFactory.useCache = true;
+ }
}
/**
diff --git a/src/test/test/javassist/proxy/ProxyFactoryCompatibilityTest.java b/src/test/test/javassist/proxy/ProxyFactoryCompatibilityTest.java
index 069d0c9c..5b72d82e 100644
--- a/src/test/test/javassist/proxy/ProxyFactoryCompatibilityTest.java
+++ b/src/test/test/javassist/proxy/ProxyFactoryCompatibilityTest.java
@@ -41,6 +41,7 @@ public class ProxyFactoryCompatibilityTest extends TestCase
public void testFactoryCompatibility() throws Exception
{
+ System.out.println("ProxyFactory.useCache = " + ProxyFactory.useCache);
// create a factory which, by default, uses caching
ProxyFactory factory = new ProxyFactory();
factory.setSuperclass(TestClass.class);
diff --git a/src/test/test/javassist/proxy/ProxySerializationTest.java b/src/test/test/javassist/proxy/ProxySerializationTest.java
index e79bcb48..28125de0 100644
--- a/src/test/test/javassist/proxy/ProxySerializationTest.java
+++ b/src/test/test/javassist/proxy/ProxySerializationTest.java
@@ -30,8 +30,8 @@ public class ProxySerializationTest extends TestCase
try {
String name = "proxytest_1";
- Constructor constructor = proxyClass.getConstructor(String.class);
- TestClass proxy = (TestClass)constructor.newInstance(name);
+ Constructor constructor = proxyClass.getConstructor(new Class[] {String.class});
+ TestClass proxy = (TestClass)constructor.newInstance(new Object[] {name});
((ProxyObject)proxy).setHandler(handler);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ObjectOutputStream out = new ObjectOutputStream(bos);
@@ -41,10 +41,10 @@ public class ProxySerializationTest extends TestCase
ByteArrayInputStream bis = new ByteArrayInputStream(bytes);
ObjectInputStream in = new ObjectInputStream(bis);
TestClass newProxy = (TestClass)in.readObject();
- // inherited fields should have been deserialized
- assert(newProxy.getName() == null);
+ // inherited fields should not have been deserialized
+ assertTrue("new name should be null", newProxy.getName() == null);
// since we are reading into the same JVM the new proxy should have the same class as the old proxy
- assert(newProxy.getClass() == proxy.getClass());
+ assertTrue("classes should be equal", newProxy.getClass() == proxy.getClass());
} catch (Exception e) {
e.printStackTrace();
fail();
@@ -57,8 +57,8 @@ public class ProxySerializationTest extends TestCase
try {
String name = "proxytest_2";
- Constructor constructor = proxyClass.getConstructor(String.class);
- TestClass proxy = (TestClass)constructor.newInstance(name);
+ Constructor constructor = proxyClass.getConstructor(new Class[] {String.class});
+ TestClass proxy = (TestClass)constructor.newInstance(new Object[] {name});
((ProxyObject)proxy).setHandler(handler);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ProxyObjectOutputStream out = new ProxyObjectOutputStream(bos);
@@ -69,9 +69,9 @@ public class ProxySerializationTest extends TestCase
ProxyObjectInputStream in = new ProxyObjectInputStream(bis);
TestClass newProxy = (TestClass)in.readObject();
// inherited fields should have been deserialized
- assert(proxy.getName() == newProxy.getName());
+ assertTrue("names should be equal", proxy.getName().equals(newProxy.getName()));
// since we are reading into the same JVM the new proxy should have the same class as the old proxy
- assert(newProxy.getClass() == proxy.getClass());
+ assertTrue("classes should still be equal", newProxy.getClass() == proxy.getClass());
} catch (Exception e) {
e.printStackTrace();
fail();