[jboss-cvs] javassist/src/test/test/javassist/convert ...
Jason Thomas Greene
jgreene at jboss.com
Mon Jun 2 23:47:18 EDT 2008
User: jgreene
Date: 08/06/02 23:47:18
Modified: src/test/test/javassist/convert ArrayAccessReplaceTest.java
Log:
Fix small naming bug (classinfo expects a jvm name)
Add test to catch it
Revision Changes Path
1.2 +27 -1 javassist/src/test/test/javassist/convert/ArrayAccessReplaceTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: ArrayAccessReplaceTest.java
===================================================================
RCS file: /cvsroot/jboss/javassist/src/test/test/javassist/convert/ArrayAccessReplaceTest.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- ArrayAccessReplaceTest.java 24 May 2008 05:13:20 -0000 1.1
+++ ArrayAccessReplaceTest.java 3 Jun 2008 03:47:18 -0000 1.2
@@ -20,6 +20,7 @@
CodeConverter converter = new CodeConverter();
converter.replaceArrayAccess(echoClass, new CodeConverter.DefaultArrayAccessReplacementMethodNames());
simpleClass.instrument(converter);
+ //simpleClass.writeFile("/tmp");
simple = (SimpleInterface) simpleClass.toClass(new URLClassLoader(new URL[0], getClass().getClassLoader()), Class.class.getProtectionDomain()).newInstance();
}
@@ -30,7 +31,6 @@
CodeConverter converter = new CodeConverter();
converter.replaceArrayAccess(clazz, new CodeConverter.DefaultArrayAccessReplacementMethodNames());
clazz.instrument(converter);
- clazz.writeFile("/tmp");
ComplexInterface instance = (ComplexInterface) clazz.toClass(new URLClassLoader(new URL[0], getClass().getClassLoader()), Class.class.getProtectionDomain()).newInstance();
assertEquals(Integer.valueOf(5), instance.complexRead(4));
}
@@ -137,6 +137,16 @@
}
}
+ public void testMulti() throws Exception {
+ for (int i = 2; i < 100; i++) {
+ simple.setMultiFoo(0, 1, i, new Foo(i));
+ }
+
+ for (int i = 2; i < 100; i++) {
+ assertEquals(new Foo(i), simple.getMultiFoo(0, 1, i));
+ }
+ }
+
public static class Echo {
public static Map byteMap = new HashMap();
public static Map charMap = new HashMap();
@@ -261,6 +271,9 @@
public void setFoo(int pos, Foo value);
public Foo getFoo(int pos);
+
+ public void setMultiFoo(int one, int two, int three, Foo foo);
+ public Foo getMultiFoo(int one, int two, int three);
}
public static class Simple implements SimpleInterface {
@@ -274,6 +287,12 @@
private double[] doubles;
private Object[] objects;
private Foo[] foos;
+ private Foo[][][] multi;
+
+ public Simple() {
+ multi[0] = new Foo[0][0];
+ multi[0][1] = new Foo[0];
+ }
public boolean getBoolean(int pos) {
return booleans[pos];
@@ -315,6 +334,10 @@
return shorts[pos];
}
+ public Foo getMultiFoo(int one, int two, int three) {
+ return multi[one][two][three];
+ }
+
public void setBoolean(int pos, boolean value) {
booleans[pos] = value;
}
@@ -355,6 +378,9 @@
shorts[pos] = value;
}
+ public void setMultiFoo(int one, int two, int three, Foo foo) {
+ multi[one][two][three] = foo;
+ }
}
public static interface ComplexInterface {
More information about the jboss-cvs-commits
mailing list