diff options
author | adinn <adinn@30ef5769-5b8d-40dd-aea6-55b5d6557bb3> | 2010-04-21 15:04:11 +0000 |
---|---|---|
committer | adinn <adinn@30ef5769-5b8d-40dd-aea6-55b5d6557bb3> | 2010-04-21 15:04:11 +0000 |
commit | a9950b363c5b40e8a291e91f2e5c656c5b82677c (patch) | |
tree | eef6fa4201c0e6eaccebda9f06cd3dd623e98635 | |
parent | e7392c68c6ae1f087047a6b51fe3a2ad6532c41a (diff) | |
download | javassist-a9950b363c5b40e8a291e91f2e5c656c5b82677c.tar.gz javassist-a9950b363c5b40e8a291e91f2e5c656c5b82677c.zip |
patched tests to use 1.4 compatible synatx and also to allow for the fact that maven install will run them in the same JVM -- fixes for JASSIST-114
git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@536 30ef5769-5b8d-40dd-aea6-55b5d6557bb3
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(); |