You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openjpa.apache.org by pc...@apache.org on 2006/07/01 00:37:29 UTC
svn commit: r418401 [32/32] - in /incubator/openjpa/trunk: openjpa-lib/
openjpa-lib/src/main/java/org/apache/openjpa/lib/ant/
openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/
openjpa-lib/src/main/java/org/apache/openjpa/lib/jdbc/ openjpa-lib/src/...
Modified: incubator/openjpa/trunk/serp/src/test/java/serp/bytecode/lowlevel/TestConstantPool.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/serp/src/test/java/serp/bytecode/lowlevel/TestConstantPool.java?rev=418401&r1=418400&r2=418401&view=diff
==============================================================================
--- incubator/openjpa/trunk/serp/src/test/java/serp/bytecode/lowlevel/TestConstantPool.java (original)
+++ incubator/openjpa/trunk/serp/src/test/java/serp/bytecode/lowlevel/TestConstantPool.java Fri Jun 30 15:37:18 2006
@@ -1,13 +1,10 @@
/*
* Copyright 2006 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
@@ -16,14 +13,12 @@
package serp.bytecode.lowlevel;
import junit.framework.*;
-
import junit.textui.*;
-
/**
- * <p>Tests the {@link ConstantPool} type.</p>
- *
- * @author Abe White
+ * Tests the {@link ConstantPool} type.
+ *
+ * @author Abe White
*/
public class TestConstantPool extends TestCase {
private ConstantPool _pool = new ConstantPool();
@@ -36,7 +31,7 @@
}
/**
- * Tests adding entries.
+ * Tests adding entries.
*/
public void testAdd() {
assertEquals(0, _pool.size());
@@ -60,13 +55,11 @@
// cannot add to another pool
ConstantPool pool = new ConstantPool();
-
try {
pool.addEntry(_intEntry);
fail("Entry already in another pool");
} catch (IllegalStateException ise) {
}
-
assertEquals(0, pool.size());
_pool.removeEntry(_intEntry);
@@ -78,7 +71,7 @@
}
/**
- * Tests removing entries.
+ * Tests removing entries.
*/
public void testRemove() {
_pool.addEntry(_intEntry);
@@ -104,18 +97,16 @@
assertTrue(_pool.removeEntry(_utf8Entry));
assertEquals(0, _pool.size());
-
try {
_pool.getEntry(1);
fail("Invalid index");
} catch (IndexOutOfBoundsException ioobe) {
}
-
assertEquals(0, _pool.findUTF8Entry("4", false));
}
/**
- * Tests mutating entries.
+ * Tests mutating entries.
*/
public void testMutate() {
_intEntry.setValue(2);
@@ -137,7 +128,7 @@
}
/**
- * Tests finding the index of entries.
+ * Tests finding the index of entries.
*/
public void testIndexOf() {
_pool.addEntry(_intEntry);
@@ -155,7 +146,7 @@
}
/**
- * Tests getting all entries.
+ * Tests getting all entries.
*/
public void testGetEntries() {
_pool.addEntry(_intEntry);
@@ -173,7 +164,7 @@
}
/**
- * Tests getting entries by index.
+ * Tests getting entries by index.
*/
public void testGetEntry() {
_pool.addEntry(_intEntry);
@@ -204,7 +195,7 @@
}
/**
- * Test clearing the pool.
+ * Test clearing the pool.
*/
public void testClear() {
// make sure clearing empty pool OK
@@ -222,7 +213,7 @@
}
/**
- * Test finding entry indexes.
+ * Test finding entry indexes.
*/
public void testFind() {
int double1 = _pool.addEntry(new DoubleEntry(1D));
@@ -304,50 +295,52 @@
assertEquals(name2, _pool.findNameAndTypeEntry("2", "1", false));
assertEquals(name1, _pool.findNameAndTypeEntry("1", "2", true));
assertEquals(name2, _pool.findNameAndTypeEntry("2", "1", true));
- assertEquals(_pool.size() + 1,
- _pool.findNameAndTypeEntry("0", "1", true));
- assertEquals(_pool.size() + 2,
- _pool.findNameAndTypeEntry("2", "3", true));
- assertEquals(_pool.size() + 3,
- _pool.findNameAndTypeEntry("ccc", "ddd", true));
+ assertEquals(_pool.size() + 1, _pool.findNameAndTypeEntry
+ ("0", "1", true));
+ assertEquals(_pool.size() + 2, _pool.findNameAndTypeEntry
+ ("2", "3", true));
+ assertEquals(_pool.size() + 3, _pool.findNameAndTypeEntry
+ ("ccc", "ddd", true));
assertEquals(0, _pool.findFieldEntry("0", "1", "2", false));
assertEquals(field1, _pool.findFieldEntry("1", "1", "2", false));
assertEquals(field2, _pool.findFieldEntry("2", "2", "1", false));
assertEquals(field1, _pool.findFieldEntry("1", "1", "2", true));
assertEquals(field2, _pool.findFieldEntry("2", "2", "1", true));
- assertEquals(_pool.size() + 1, _pool.findFieldEntry("1", "2", "1", true));
- assertEquals(_pool.size() + 3, _pool.findFieldEntry("1", "3", "4", true));
- assertEquals(_pool.size() + 6,
- _pool.findFieldEntry("eee", "fff", "ggg", true));
+ assertEquals(_pool.size() + 1, _pool.findFieldEntry
+ ("1", "2", "1", true));
+ assertEquals(_pool.size() + 3, _pool.findFieldEntry
+ ("1", "3", "4", true));
+ assertEquals(_pool.size() + 6, _pool.findFieldEntry
+ ("eee", "fff", "ggg", true));
assertEquals(0, _pool.findMethodEntry("0", "1", "2", false));
assertEquals(method1, _pool.findMethodEntry("1", "1", "2", false));
assertEquals(method2, _pool.findMethodEntry("2", "2", "1", false));
assertEquals(method1, _pool.findMethodEntry("1", "1", "2", true));
assertEquals(method2, _pool.findMethodEntry("2", "2", "1", true));
- assertEquals(_pool.size() + 1,
- _pool.findMethodEntry("1", "2", "1", true));
- assertEquals(_pool.size() + 3,
- _pool.findMethodEntry("1", "3", "5", true));
- assertEquals(_pool.size() + 6,
- _pool.findMethodEntry("hhh", "iii", "jjj", true));
+ assertEquals(_pool.size() + 1, _pool.findMethodEntry
+ ("1", "2", "1", true));
+ assertEquals(_pool.size() + 3, _pool.findMethodEntry
+ ("1", "3", "5", true));
+ assertEquals(_pool.size() + 6, _pool.findMethodEntry
+ ("hhh", "iii", "jjj", true));
assertEquals(0, _pool.findInterfaceMethodEntry("0", "1", "2", false));
- assertEquals(imethod1,
- _pool.findInterfaceMethodEntry("1", "1", "2", false));
- assertEquals(imethod2,
- _pool.findInterfaceMethodEntry("2", "2", "1", false));
- assertEquals(imethod1,
- _pool.findInterfaceMethodEntry("1", "1", "2", true));
- assertEquals(imethod2,
- _pool.findInterfaceMethodEntry("2", "2", "1", true));
- assertEquals(_pool.size() + 1,
- _pool.findInterfaceMethodEntry("1", "2", "1", true));
- assertEquals(_pool.size() + 3,
- _pool.findInterfaceMethodEntry("1", "3", "6", true));
- assertEquals(_pool.size() + 6,
- _pool.findInterfaceMethodEntry("kkk", "lll", "mmm", true));
+ assertEquals(imethod1, _pool.findInterfaceMethodEntry
+ ("1", "1", "2", false));
+ assertEquals(imethod2, _pool.findInterfaceMethodEntry
+ ("2", "2", "1", false));
+ assertEquals(imethod1, _pool.findInterfaceMethodEntry
+ ("1", "1", "2", true));
+ assertEquals(imethod2, _pool.findInterfaceMethodEntry
+ ("2", "2", "1", true));
+ assertEquals(_pool.size() + 1, _pool.findInterfaceMethodEntry
+ ("1", "2", "1", true));
+ assertEquals(_pool.size() + 3, _pool.findInterfaceMethodEntry
+ ("1", "3", "6", true));
+ assertEquals(_pool.size() + 6, _pool.findInterfaceMethodEntry
+ ("kkk", "lll", "mmm", true));
}
public static Test suite() {
Modified: incubator/openjpa/trunk/serp/src/test/java/serp/util/TestStrings.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/serp/src/test/java/serp/util/TestStrings.java?rev=418401&r1=418400&r2=418401&view=diff
==============================================================================
--- incubator/openjpa/trunk/serp/src/test/java/serp/util/TestStrings.java (original)
+++ incubator/openjpa/trunk/serp/src/test/java/serp/util/TestStrings.java Fri Jun 30 15:37:18 2006
@@ -1,13 +1,10 @@
/*
* Copyright 2006 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
@@ -16,14 +13,12 @@
package serp.util;
import junit.framework.*;
-
import junit.textui.*;
-
/**
- * <p>Tests the {@link Strings} type.</p>
- *
- * @author Abe White
+ * Tests the {@link Strings} type.
+ *
+ * @author Abe White
*/
public class TestStrings extends TestCase {
public TestStrings(String test) {
@@ -31,14 +26,15 @@
}
/**
- * Test {@link Strings#split}.
+ * Test {@link Strings#split}.
*/
public void testSplit() {
String str = "boo:and:foo";
assertEquals(new String[] { "boo", "and:foo" },
Strings.split(str, ":", 2));
- assertEquals(new String[] { "boo:and:foo" }, Strings.split(str, ":", 1));
+ assertEquals(new String[] { "boo:and:foo" },
+ Strings.split(str, ":", 1));
assertEquals(new String[] { "boo", "and", "foo" },
Strings.split(str, ":", 0));
assertEquals(new String[] { "boo", "and", "foo" },
@@ -56,7 +52,7 @@
}
/**
- * Test {@link Strings#classForName}.
+ * Test {@link Strings#classForName}.
*/
public void testClassForName() {
// test primitives
@@ -71,7 +67,8 @@
assertEquals(void.class, Strings.toClass("void", null));
// test objects
- assertEquals(String.class, Strings.toClass(String.class.getName(), null));
+ assertEquals(String.class, Strings.toClass
+ (String.class.getName(), null));
// test arrays
assertEquals(boolean[].class, Strings.toClass("[Z", null));
@@ -82,11 +79,11 @@
assertEquals(int[].class, Strings.toClass("[I", null));
assertEquals(long[].class, Strings.toClass("[J", null));
assertEquals(short[].class, Strings.toClass("[S", null));
- assertEquals(String[].class,
- Strings.toClass(String[].class.getName(), null));
+ assertEquals(String[].class, Strings.toClass
+ (String[].class.getName(), null));
assertEquals(boolean[][].class, Strings.toClass("[[Z", null));
- assertEquals(String[][].class,
- Strings.toClass(String[][].class.getName(), null));
+ assertEquals(String[][].class, Strings.toClass
+ (String[][].class.getName(), null));
assertEquals(boolean[].class, Strings.toClass("boolean[]", null));
assertEquals(byte[].class, Strings.toClass("byte[]", null));
@@ -96,14 +93,14 @@
assertEquals(int[].class, Strings.toClass("int[]", null));
assertEquals(long[].class, Strings.toClass("long[]", null));
assertEquals(short[].class, Strings.toClass("short[]", null));
- assertEquals(String[].class, Strings.toClass("java.lang.String[]", null));
+ assertEquals(String[].class, Strings.toClass("java.lang.String[]",
+ null));
try {
Strings.toClass("[V", null);
fail("Allowed invalid class name");
} catch (RuntimeException re) {
}
-
try {
Strings.toClass("java.lang.Foo", null);
fail("Allowed invalid class name");
@@ -113,7 +110,6 @@
private void assertEquals(String[] arr1, String[] arr2) {
assertEquals(arr1.length, arr2.length);
-
for (int i = 0; i < arr1.length; i++)
assertEquals(arr1[i], arr2[i]);
}