harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r386058 [17/49] - in /incubator/harmony/enhanced/classlib/trunk: make/ modules/archive/make/common/ modules/archive/src/test/java/tests/ modules/archive/src/test/java/tests/api/ modules/archive/src/test/java/tests/api/java/ modules/archive/...
Date Wed, 15 Mar 2006 11:47:39 GMT
Added: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/ByteTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/ByteTest.java?rev=386058&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/ByteTest.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/ByteTest.java Wed Mar 15 03:46:17 2006
@@ -0,0 +1,419 @@
+/* Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * 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
+ * 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
+ * limitations under the License.
+ */
+
+package tests.api.java.lang;
+
+public class ByteTest extends junit.framework.TestCase {
+
+	/**
+	 * @tests java.lang.Byte#Byte(byte)
+	 */
+	public void test_ConstructorB() {
+		// Test for method java.lang.Byte(byte)
+
+		Byte b = new Byte((byte) 127);
+		assertTrue("Byte creation failed", b.byteValue() == (byte) 127);
+	}
+
+	/**
+	 * @tests java.lang.Byte#Byte(java.lang.String)
+	 */
+	public void test_ConstructorLjava_lang_String() {
+		// Test for method java.lang.Byte(java.lang.String)
+
+		Byte b = new Byte("127");
+		Byte nb = new Byte("-128");
+		assertTrue("Incorrect Byte Object created", b.byteValue() == (byte) 127
+				&& (nb.byteValue() == (byte) -128));
+
+	}
+
+	/**
+	 * @tests java.lang.Byte#byteValue()
+	 */
+	public void test_byteValue() {
+		// Test for method byte java.lang.Byte.byteValue()
+		assertTrue("Returned incorrect byte value", new Byte((byte) 127)
+				.byteValue() == (byte) (127));
+	}
+
+	/**
+	 * @tests java.lang.Byte#compareTo(java.lang.Byte)
+	 */
+	public void test_compareToLjava_lang_Byte() {
+		// Test for method int java.lang.Byte.compareTo(java.lang.Byte)
+		assertTrue("Comparison failed", new Byte((byte) 1).compareTo(new Byte(
+				(byte) 2)) < 0);
+		assertTrue("Comparison failed", new Byte((byte) 1).compareTo(new Byte(
+				(byte) -2)) > 0);
+		assertTrue("Comparison failed", new Byte((byte) 1).compareTo(new Byte(
+				(byte) 1)) == 0);
+	}
+
+	/**
+	 * @tests java.lang.Byte#compareTo(java.lang.Object)
+	 */
+	public void test_compareToLjava_lang_Object() {
+		// Test for method int java.lang.Byte.compareTo(java.lang.Object)
+		assertTrue("Comparison failed", new Byte((byte) 1)
+				.compareTo((Object) new Byte((byte) 2)) < 0);
+		assertTrue("Comparison failed", new Byte((byte) 1)
+				.compareTo((Object) new Byte((byte) -2)) > 0);
+		assertTrue("Comparison failed", new Byte((byte) 1)
+				.compareTo((Object) new Byte((byte) 1)) == 0);
+		try {
+			new Byte((byte) 1).compareTo(new Object());
+		} catch (ClassCastException e) {
+			// correct
+			return;
+		}
+		fail("Failed to throw ClassCastException");
+	}
+
+	/**
+	 * @tests java.lang.Byte#decode(java.lang.String)
+	 */
+	public void test_decodeLjava_lang_String() {
+		// Test for method java.lang.Byte
+		// java.lang.Byte.decode(java.lang.String)
+		assertTrue("String decoded incorrectly, wanted: 1 got: "
+				+ Byte.decode("1").toString(), Byte.decode("1").equals(
+				new Byte((byte) 1)));
+		assertTrue("String decoded incorrectly, wanted: -1 got: "
+				+ Byte.decode("-1").toString(), Byte.decode("-1").equals(
+				new Byte((byte) -1)));
+		assertTrue("String decoded incorrectly, wanted: 127 got: "
+				+ Byte.decode("127").toString(), Byte.decode("127").equals(
+				new Byte((byte) 127)));
+		assertTrue("String decoded incorrectly, wanted: -128 got: "
+				+ Byte.decode("-128").toString(), Byte.decode("-128").equals(
+				new Byte((byte) -128)));
+		assertTrue("String decoded incorrectly, wanted: 127 got: "
+				+ Byte.decode("0x7f").toString(), Byte.decode("0x7f").equals(
+				new Byte((byte) 127)));
+		assertTrue("String decoded incorrectly, wanted: -128 got: "
+				+ Byte.decode("-0x80").toString(), Byte.decode("-0x80").equals(
+				new Byte((byte) -128)));
+
+		boolean exception = false;
+		try {
+			Byte.decode("128");
+		} catch (NumberFormatException e) {
+			// Correct
+			exception = true;
+		}
+		assertTrue("Failed to throw exception for MAX_VALUE + 1", exception);
+
+		exception = false;
+		try {
+			Byte.decode("-129");
+		} catch (NumberFormatException e) {
+			// Correct
+			exception = true;
+		}
+		assertTrue("Failed to throw exception for MIN_VALUE - 1", exception);
+
+		exception = false;
+		try {
+			Byte.decode("0x80");
+		} catch (NumberFormatException e) {
+			// Correct
+			exception = true;
+		}
+		assertTrue("Failed to throw exception for hex MAX_VALUE + 1", exception);
+
+		exception = false;
+		try {
+			Byte.decode("-0x81");
+		} catch (NumberFormatException e) {
+			// Correct
+			exception = true;
+		}
+		assertTrue("Failed to throw exception for hex MIN_VALUE - 1", exception);
+	}
+
+	/**
+	 * @tests java.lang.Byte#doubleValue()
+	 */
+	public void test_doubleValue() {
+		// Test for method double java.lang.Byte.doubleValue()
+		assertTrue("Returned incorrect double value", new Byte((byte) 127)
+				.doubleValue() == (double) (127));
+	}
+
+	/**
+	 * @tests java.lang.Byte#equals(java.lang.Object)
+	 */
+	public void test_equalsLjava_lang_Object() {
+		// Test for method boolean java.lang.Byte.equals(java.lang.Object)
+		Byte b1 = new Byte((byte) 90);
+		Byte b2 = new Byte((byte) 90);
+		Byte b3 = new Byte((byte) -90);
+		assertTrue("Equality test failed", b1.equals(b2));
+		assertTrue("Equality test failed", !b1.equals(b3));
+	}
+
+	/**
+	 * @tests java.lang.Byte#floatValue()
+	 */
+	public void test_floatValue() {
+		// Test for method float java.lang.Byte.floatValue()
+		assertTrue("Returned incorrect float value", new Byte((byte) 127)
+				.byteValue() == (float) (127));
+	}
+
+	/**
+	 * @tests java.lang.Byte#hashCode()
+	 */
+	public void test_hashCode() {
+		// Test for method int java.lang.Byte.hashCode()
+		assertTrue("Incorrect hash returned",
+				new Byte((byte) 127).hashCode() == 127);
+	}
+
+	/**
+	 * @tests java.lang.Byte#intValue()
+	 */
+	public void test_intValue() {
+		// Test for method int java.lang.Byte.intValue()
+		assertTrue("Returned incorrect int value", new Byte((byte) 127)
+				.intValue() == 127);
+	}
+
+	/**
+	 * @tests java.lang.Byte#longValue()
+	 */
+	public void test_longValue() {
+		// Test for method long java.lang.Byte.longValue()
+		assertTrue("Returned incorrect long value", new Byte((byte) 127)
+				.longValue() == 127L);
+	}
+
+	/**
+	 * @tests java.lang.Byte#parseByte(java.lang.String)
+	 */
+	public void test_parseByteLjava_lang_String() {
+		// Test for method byte java.lang.Byte.parseByte(java.lang.String)
+
+		byte b = Byte.parseByte("127");
+		byte bn = Byte.parseByte("-128");
+		assertTrue("Invalid parse of byte", b == (byte) 127
+				&& (bn == (byte) -128));
+		assertTrue("Returned incorrect value for 0", Byte.parseByte("0") == 0);
+		assertTrue("Returned incorrect value for most negative value", Byte
+				.parseByte("-128") == (byte) 0x80);
+		assertTrue("Returned incorrect value for most positive value", Byte
+				.parseByte("127") == 0x7f);
+
+		boolean exception = false;
+		try {
+			Byte.parseByte("-1000");
+		} catch (NumberFormatException e) {
+			// Correct
+			exception = true;
+		}
+		assertTrue("Failed to throw exception", exception);
+
+		exception = false;
+		try {
+			Byte.parseByte("128");
+		} catch (NumberFormatException e) {
+			// Correct
+			exception = true;
+		}
+		assertTrue("Failed to throw exception for MAX_VALUE + 1", exception);
+
+		exception = false;
+		try {
+			Byte.parseByte("-129");
+		} catch (NumberFormatException e) {
+			// Correct
+			exception = true;
+		}
+		assertTrue("Failed to throw exception for MIN_VALUE - 1", exception);
+	}
+
+	/**
+	 * @tests java.lang.Byte#parseByte(java.lang.String, int)
+	 */
+	public void test_parseByteLjava_lang_StringI() {
+		// Test for method byte java.lang.Byte.parseByte(java.lang.String, int)
+		byte b = Byte.parseByte("127", 10);
+		byte bn = Byte.parseByte("-128", 10);
+		assertTrue("Invalid parse of dec byte", b == (byte) 127
+				&& (bn == (byte) -128));
+		assertTrue("Failed to parse hex value", Byte.parseByte("A", 16) == 10);
+		assertTrue("Returned incorrect value for 0 hex", Byte
+				.parseByte("0", 16) == 0);
+		assertTrue("Returned incorrect value for most negative value hex", Byte
+				.parseByte("-80", 16) == (byte) 0x80);
+		assertTrue("Returned incorrect value for most positive value hex", Byte
+				.parseByte("7f", 16) == 0x7f);
+		assertTrue("Returned incorrect value for 0 decimal", Byte.parseByte(
+				"0", 10) == 0);
+		assertTrue("Returned incorrect value for most negative value decimal",
+				Byte.parseByte("-128", 10) == (byte) 0x80);
+		assertTrue("Returned incorrect value for most positive value decimal",
+				Byte.parseByte("127", 10) == 0x7f);
+
+		boolean exception = false;
+		try {
+			Byte.parseByte("-1000", 10);
+		} catch (NumberFormatException e) {
+			// Correct
+			exception = true;
+		}
+		assertTrue("Failed to throw exception", exception);
+
+		exception = false;
+		try {
+			Byte.parseByte("128", 10);
+		} catch (NumberFormatException e) {
+			// Correct
+			exception = true;
+		}
+		assertTrue("Failed to throw exception for MAX_VALUE + 1", exception);
+
+		exception = false;
+		try {
+			Byte.parseByte("-129", 10);
+		} catch (NumberFormatException e) {
+			// Correct
+			exception = true;
+		}
+		assertTrue("Failed to throw exception for MIN_VALUE - 1", exception);
+
+		exception = false;
+		try {
+			Byte.parseByte("80", 16);
+		} catch (NumberFormatException e) {
+			// Correct
+			exception = true;
+		}
+		assertTrue("Failed to throw exception for hex MAX_VALUE + 1", exception);
+
+		exception = false;
+		try {
+			Byte.parseByte("-81", 16);
+		} catch (NumberFormatException e) {
+			// Correct
+			exception = true;
+		}
+		assertTrue("Failed to throw exception for hex MIN_VALUE + 1", exception);
+	}
+
+	/**
+	 * @tests java.lang.Byte#shortValue()
+	 */
+	public void test_shortValue() {
+		// Test for method short java.lang.Byte.shortValue()
+		assertTrue("Returned incorrect short value", new Byte((byte) 127)
+				.shortValue() == (short) (127));
+	}
+
+	/**
+	 * @tests java.lang.Byte#toString()
+	 */
+	public void test_toString() {
+		// Test for method java.lang.String java.lang.Byte.toString()
+		assertTrue("Returned incorrect String", new Byte((byte) 127).toString()
+				.equals("127"));
+		assertTrue("Returned incorrect String", new Byte((byte) -127)
+				.toString().equals("-127"));
+		assertTrue("Returned incorrect String", new Byte((byte) -128)
+				.toString().equals("-128"));
+	}
+
+	/**
+	 * @tests java.lang.Byte#toString(byte)
+	 */
+	public void test_toStringB() {
+		// Test for method java.lang.String java.lang.Byte.toString(byte)
+		assertTrue("Returned incorrect String", Byte.toString((byte) 127)
+				.equals("127"));
+		assertTrue("Returned incorrect String", Byte.toString((byte) -127)
+				.equals("-127"));
+		assertTrue("Returned incorrect String", Byte.toString((byte) -128)
+				.equals("-128"));
+	}
+
+	/**
+	 * @tests java.lang.Byte#valueOf(java.lang.String)
+	 */
+	public void test_valueOfLjava_lang_String() {
+		// Test for method java.lang.Byte
+		// java.lang.Byte.valueOf(java.lang.String)
+		assertTrue("Returned incorrect byte",
+				Byte.valueOf("0").byteValue() == 0);
+		assertTrue("Returned incorrect byte",
+				Byte.valueOf("127").byteValue() == 127);
+		assertTrue("Returned incorrect byte",
+				Byte.valueOf("-127").byteValue() == -127);
+		assertTrue("Returned incorrect byte",
+				Byte.valueOf("-128").byteValue() == -128);
+
+		try {
+			Byte.valueOf("128");
+		} catch (NumberFormatException e) {
+			// Correct
+			return;
+		}
+		fail("Failed to throw exception when passes value > byte");
+	}
+
+	/**
+	 * @tests java.lang.Byte#valueOf(java.lang.String, int)
+	 */
+	public void test_valueOfLjava_lang_StringI() {
+		// Test for method java.lang.Byte
+		// java.lang.Byte.valueOf(java.lang.String, int)
+		assertTrue("Returned incorrect byte",
+				Byte.valueOf("A", 16).byteValue() == 10);
+		assertTrue("Returned incorrect byte", Byte.valueOf("127", 10)
+				.byteValue() == 127);
+		assertTrue("Returned incorrect byte", Byte.valueOf("-127", 10)
+				.byteValue() == -127);
+		assertTrue("Returned incorrect byte", Byte.valueOf("-128", 10)
+				.byteValue() == -128);
+		assertTrue("Returned incorrect byte", Byte.valueOf("7f", 16)
+				.byteValue() == 127);
+		assertTrue("Returned incorrect byte", Byte.valueOf("-7f", 16)
+				.byteValue() == -127);
+		assertTrue("Returned incorrect byte", Byte.valueOf("-80", 16)
+				.byteValue() == -128);
+
+		try {
+			Byte.valueOf("128", 10);
+		} catch (NumberFormatException e) {
+			// Correct
+			return;
+		}
+		fail("Failed to throw exception when passes value > byte");
+	}
+
+	/**
+	 * Sets up the fixture, for example, open a network connection. This method
+	 * is called before a test is executed.
+	 */
+	protected void setUp() {
+	}
+
+	/**
+	 * Tears down the fixture, for example, close a network connection. This
+	 * method is called after a test is executed.
+	 */
+	protected void tearDown() {
+	}
+}

Added: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/CharacterTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/CharacterTest.java?rev=386058&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/CharacterTest.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/CharacterTest.java Wed Mar 15 03:46:17 2006
@@ -0,0 +1,477 @@
+/* Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * 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
+ * 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
+ * limitations under the License.
+ */
+
+package tests.api.java.lang;
+
+public class CharacterTest extends junit.framework.TestCase {
+
+	/**
+	 * @tests java.lang.Character#Character(char)
+	 */
+	public void test_ConstructorC() {
+		// Test for method java.lang.Character(char)
+		assertTrue("Constructor failed", new Character('T').charValue() == 'T');
+	}
+
+	/**
+	 * @tests java.lang.Character#charValue()
+	 */
+	public void test_charValue() {
+		// Test for method char java.lang.Character.charValue()
+		assertTrue("Incorrect char value returned", new Character('T')
+				.charValue() == 'T');
+	}
+
+	/**
+	 * @tests java.lang.Character#compareTo(java.lang.Character)
+	 */
+	public void test_compareToLjava_lang_Character() {
+		// Test for method int
+		// java.lang.Character.compareTo(java.lang.Character)
+		Character c = new Character('c');
+		Character x = new Character('c');
+		Character y = new Character('b');
+		Character z = new Character('d');
+
+		assertTrue("Returned false for same Character", c.compareTo(c) == 0);
+		assertTrue("Returned false for identical Character",
+				c.compareTo(x) == 0);
+		assertTrue("Returned other than less than for lesser char", c
+				.compareTo(y) > 0);
+		assertTrue("Returned other than greater than for greater char", c
+				.compareTo(z) < 0);
+	}
+
+	/**
+	 * @tests java.lang.Character#compareTo(java.lang.Object)
+	 */
+	public void test_compareToLjava_lang_Object() {
+		// Test for method int java.lang.Character.compareTo(java.lang.Object)
+		Character c = new Character('c');
+		assertTrue("Returned false for same Character",
+				c.compareTo((Object) c) == 0);
+		try {
+			c.compareTo(new Object());
+		} catch (ClassCastException e) {
+			// Correct
+			return;
+		}
+		fail(
+				"Failed to throw exception when comparing to non-Character");
+	}
+
+	/**
+	 * @tests java.lang.Character#digit(char, int)
+	 */
+	public void test_digitCI() {
+		// Test for method int java.lang.Character.digit(char, int)
+		assertTrue("Returned incorrect digit", Character.digit('1', 10) == 1);
+		assertTrue("Returned incorrect digit", Character.digit('F', 16) == 15);
+	}
+
+	/**
+	 * @tests java.lang.Character#equals(java.lang.Object)
+	 */
+	public void test_equalsLjava_lang_Object() {
+		// Test for method boolean java.lang.Character.equals(java.lang.Object)
+		assertTrue("Equality test failed", new Character('A')
+				.equals(new Character('A')));
+		assertTrue("Equality test failed", !(new Character('A')
+				.equals(new Character('a'))));
+	}
+
+	/**
+	 * @tests java.lang.Character#forDigit(int, int)
+	 */
+	public void test_forDigitII() {
+		// Test for method char java.lang.Character.forDigit(int, int)
+
+		char hexChars[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
+				'a', 'b', 'c', 'd', 'e', 'f' };
+		for (int i = 0; i < hexChars.length; i++) {
+			assertTrue("Returned incorrect char for " + Integer.toString(i),
+					Character.forDigit(i, hexChars.length) == hexChars[i]);
+		}
+
+		char decimalChars[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8',
+				'9' };
+		for (int i = 0; i < decimalChars.length; i++) {
+			assertTrue(
+					"Returned incorrect char for " + Integer.toString(i),
+					Character.forDigit(i, decimalChars.length) == decimalChars[i]);
+		}
+
+	}
+
+	/**
+	 * @tests java.lang.Character#getNumericValue(char)
+	 */
+	public void test_getNumericValueC() {
+		// Test for method int java.lang.Character.getNumericValue(char)
+		assertTrue("Returned incorrect numeric value 1", Character
+				.getNumericValue('1') == 1);
+		assertTrue("Returned incorrect numeric value 2", Character
+				.getNumericValue('F') == 15);
+		assertTrue("Returned incorrect numeric value 3", Character
+				.getNumericValue('\u221e') == -1);
+		assertTrue("Returned incorrect numeric value 4", Character
+				.getNumericValue('\u00be') == -2);
+		assertTrue("Returned incorrect numeric value 5", Character
+				.getNumericValue('\u2182') == 10000);
+		assertTrue("Returned incorrect numeric value 6", Character
+				.getNumericValue('\uff12') == 2);
+	}
+
+	/**
+	 * @tests java.lang.Character#getType(char)
+	 */
+	public void test_getTypeC() {
+		// Test for method int java.lang.Character.getType(char)
+		assertTrue("Returned incorrect type for: \n",
+				Character.getType('\n') == Character.CONTROL);
+		assertTrue("Returned incorrect type for: 1",
+				Character.getType('1') == Character.DECIMAL_DIGIT_NUMBER);
+		assertTrue("Returned incorrect type for: ' '",
+				Character.getType(' ') == Character.SPACE_SEPARATOR);
+		assertTrue("Returned incorrect type for: a",
+				Character.getType('a') == Character.LOWERCASE_LETTER);
+		assertTrue("Returned incorrect type for: A",
+				Character.getType('A') == Character.UPPERCASE_LETTER);
+		assertTrue("Returned incorrect type for: <",
+				Character.getType('<') == Character.MATH_SYMBOL);
+		assertTrue("Returned incorrect type for: ;",
+				Character.getType(';') == Character.OTHER_PUNCTUATION);
+		assertTrue("Returned incorrect type for: _",
+				Character.getType('_') == Character.CONNECTOR_PUNCTUATION);
+		assertTrue("Returned incorrect type for: $",
+				Character.getType('$') == Character.CURRENCY_SYMBOL);
+		assertTrue("Returned incorrect type for: \u2029", Character
+				.getType('\u2029') == Character.PARAGRAPH_SEPARATOR);
+
+		assertTrue("Wrong constant for FORMAT", Character.FORMAT == 16);
+		assertTrue("Wrong constant for PRIVATE_USE",
+				Character.PRIVATE_USE == 18);
+	}
+
+	/**
+	 * @tests java.lang.Character#hashCode()
+	 */
+	public void test_hashCode() {
+		// Test for method int java.lang.Character.hashCode()
+		assertTrue("Incorrect hash returned",
+				new Character('Y').hashCode() == 89);
+	}
+
+	/**
+	 * @tests java.lang.Character#isDefined(char)
+	 */
+	public void test_isDefinedC() {
+		// Test for method boolean java.lang.Character.isDefined(char)
+		assertTrue("Defined character returned false", Character.isDefined('v'));
+		assertTrue("Undefined character returned true", Character
+				.isDefined('\u6039'));
+	}
+
+	/**
+	 * @tests java.lang.Character#isDigit(char)
+	 */
+	public void test_isDigitC() {
+		// Test for method boolean java.lang.Character.isDigit(char)
+		assertTrue("Digit returned false", Character.isDigit('1'));
+		assertTrue("Non-Digit returned false", !Character.isDigit('A'));
+	}
+
+	/**
+	 * @tests java.lang.Character#isIdentifierIgnorable(char)
+	 */
+	public void test_isIdentifierIgnorableC() {
+		// Test for method boolean
+		// java.lang.Character.isIdentifierIgnorable(char)
+		assertTrue("Ignorable whitespace returned false", Character
+				.isIdentifierIgnorable('\u0007'));
+		assertTrue("Ignorable non - whitespace  control returned false",
+				Character.isIdentifierIgnorable('\u000f'));
+		assertTrue("Ignorable join control returned false", Character
+				.isIdentifierIgnorable('\u200e'));
+
+		// the spec is wrong, and our implementation is correct
+		assertTrue("Ignorable bidi control returned false", Character
+				.isIdentifierIgnorable('\u202b'));
+
+		assertTrue("Ignorable format control returned false", Character
+				.isIdentifierIgnorable('\u206c'));
+		assertTrue("Ignorable zero-width no-break returned false", Character
+				.isIdentifierIgnorable('\ufeff'));
+
+		assertTrue("Non-Ignorable returned true", !Character
+				.isIdentifierIgnorable('\u0065'));
+	}
+
+	/**
+	 * @tests java.lang.Character#isISOControl(char)
+	 */
+	public void test_isISOControlC() {
+		// Test for method boolean java.lang.Character.isISOControl(char)
+		for (int i = 0; i < 32; i++)
+			assertTrue("ISOConstrol char returned false", Character
+					.isISOControl((char) i));
+
+		for (int i = 127; i < 160; i++)
+			assertTrue("ISOConstrol char returned false", Character
+					.isISOControl((char) i));
+	}
+
+	/**
+	 * @tests java.lang.Character#isJavaIdentifierPart(char)
+	 */
+	public void test_isJavaIdentifierPartC() {
+		// Test for method boolean
+		// java.lang.Character.isJavaIdentifierPart(char)
+		assertTrue("letter returned false", Character.isJavaIdentifierPart('l'));
+		assertTrue("currency returned false", Character
+				.isJavaIdentifierPart('$'));
+		assertTrue("digit returned false", Character.isJavaIdentifierPart('9'));
+		assertTrue("connecting char returned false", Character
+				.isJavaIdentifierPart('_'));
+		assertTrue("ignorable control returned true", !Character
+				.isJavaIdentifierPart('\u200b'));
+		assertTrue("semi returned true", !Character.isJavaIdentifierPart(';'));
+	}
+
+	/**
+	 * @tests java.lang.Character#isJavaIdentifierStart(char)
+	 */
+	public void test_isJavaIdentifierStartC() {
+		// Test for method boolean
+		// java.lang.Character.isJavaIdentifierStart(char)
+		assertTrue("letter returned false", Character
+				.isJavaIdentifierStart('l'));
+		assertTrue("currency returned false", Character
+				.isJavaIdentifierStart('$'));
+		assertTrue("connecting char returned false", Character
+				.isJavaIdentifierStart('_'));
+		assertTrue("digit returned true", !Character.isJavaIdentifierStart('9'));
+		assertTrue("ignorable control returned true", !Character
+				.isJavaIdentifierStart('\u200b'));
+		assertTrue("semi returned true", !Character.isJavaIdentifierStart(';'));
+	}
+
+	/**
+	 * @tests java.lang.Character#isJavaLetter(char)
+	 */
+	public void test_isJavaLetterC() {
+		// Test for method boolean java.lang.Character.isJavaLetter(char)
+		assertTrue("letter returned false", Character.isJavaLetter('l'));
+		assertTrue("currency returned false", Character.isJavaLetter('$'));
+		assertTrue("connecting char returned false", Character
+				.isJavaLetter('_'));
+
+		assertTrue("digit returned true", !Character.isJavaLetter('9'));
+		assertTrue("ignirable control returned true", !Character
+				.isJavaLetter('\u200b'));
+		assertTrue("semi returned true", !Character.isJavaLetter(';'));
+	}
+
+	/**
+	 * @tests java.lang.Character#isJavaLetterOrDigit(char)
+	 */
+	public void test_isJavaLetterOrDigitC() {
+		// Test for method boolean java.lang.Character.isJavaLetterOrDigit(char)
+		assertTrue("letter returned false", Character.isJavaLetterOrDigit('l'));
+		assertTrue("currency returned false", Character
+				.isJavaLetterOrDigit('$'));
+		assertTrue("digit returned false", Character.isJavaLetterOrDigit('9'));
+		assertTrue("connecting char returned false", Character
+				.isJavaLetterOrDigit('_'));
+		assertTrue("semi returned true", !Character.isJavaLetterOrDigit(';'));
+	}
+
+	/**
+	 * @tests java.lang.Character#isLetter(char)
+	 */
+	public void test_isLetterC() {
+		// Test for method boolean java.lang.Character.isLetter(char)
+		assertTrue("Letter returned false", Character.isLetter('L'));
+		assertTrue("Non-Letter returned true", !Character.isLetter('9'));
+	}
+
+	/**
+	 * @tests java.lang.Character#isLetterOrDigit(char)
+	 */
+	public void test_isLetterOrDigitC() {
+		// Test for method boolean java.lang.Character.isLetterOrDigit(char)
+		assertTrue("Digit returned false", Character.isLetterOrDigit('9'));
+		assertTrue("Letter returned false", Character.isLetterOrDigit('K'));
+		assertTrue("Control returned true", !Character.isLetterOrDigit('\n'));
+		assertTrue("Puncutation returned true", !Character.isLetterOrDigit('?'));
+	}
+
+	/**
+	 * @tests java.lang.Character#isLowerCase(char)
+	 */
+	public void test_isLowerCaseC() {
+		// Test for method boolean java.lang.Character.isLowerCase(char)
+		assertTrue("lower returned false", Character.isLowerCase('a'));
+		assertTrue("upper returned true", !Character.isLowerCase('T'));
+	}
+
+	/**
+	 * @tests java.lang.Character#isSpace(char)
+	 */
+	public void test_isSpaceC() {
+		// Test for method boolean java.lang.Character.isSpace(char)
+		assertTrue("space returned false", Character.isSpace('\n'));
+		assertTrue("non-space returned true", !Character.isSpace('T'));
+	}
+
+	/**
+	 * @tests java.lang.Character#isSpaceChar(char)
+	 */
+	public void test_isSpaceCharC() {
+		// Test for method boolean java.lang.Character.isSpaceChar(char)
+		assertTrue("space returned false", Character.isSpaceChar('\u0020'));
+		assertTrue("non-space returned true", !Character.isSpaceChar('\n'));
+	}
+
+	/**
+	 * @tests java.lang.Character#isTitleCase(char)
+	 */
+	public void test_isTitleCaseC() {
+		// Test for method boolean java.lang.Character.isTitleCase(char)
+
+		char[] tChars = { (char) 0x01c5, (char) 0x01c8, (char) 0x01cb,
+				(char) 0x01f2, (char) 0x1f88, (char) 0x1f89, (char) 0x1f8a,
+				(char) 0x1f8b, (char) 0x1f8c, (char) 0x1f8d, (char) 0x1f8e,
+				(char) 0x1f8f, (char) 0x1f98, (char) 0x1f99, (char) 0x1f9a,
+				(char) 0x1f9b, (char) 0x1f9c, (char) 0x1f9d, (char) 0x1f9e,
+				(char) 0x1f9f, (char) 0x1fa8, (char) 0x1fa9, (char) 0x1faa,
+				(char) 0x1fab, (char) 0x1fac, (char) 0x1fad, (char) 0x1fae,
+				(char) 0x1faf, (char) 0x1fbc, (char) 0x1fcc, (char) 0x1ffc };
+		byte tnum = 0;
+		for (char c = 0; c < 65535; c++) {
+			if (Character.isTitleCase(c)) {
+				tnum++;
+				int i;
+				for (i = 0; i < tChars.length; i++)
+					if (tChars[i] == c)
+						i = tChars.length + 1;
+				if (i < tChars.length) {
+					fail("Non Title Case char returned true");
+				}
+			}
+		}
+		assertTrue("Failed to find all Title Case chars", tnum == tChars.length);
+	}
+
+	/**
+	 * @tests java.lang.Character#isUnicodeIdentifierPart(char)
+	 */
+	public void test_isUnicodeIdentifierPartC() {
+		// Test for method boolean
+		// java.lang.Character.isUnicodeIdentifierPart(char)
+		assertTrue("'a' returned false", Character.isUnicodeIdentifierPart('a'));
+		assertTrue("'2' returned false", Character.isUnicodeIdentifierPart('2'));
+		assertTrue("'+' returned true", !Character.isUnicodeIdentifierPart('+'));
+	}
+
+	/**
+	 * @tests java.lang.Character#isUnicodeIdentifierStart(char)
+	 */
+	public void test_isUnicodeIdentifierStartC() {
+		// Test for method boolean
+		// java.lang.Character.isUnicodeIdentifierStart(char)
+		assertTrue("'a' returned false", Character
+				.isUnicodeIdentifierStart('a'));
+		assertTrue("'2' returned true", !Character
+				.isUnicodeIdentifierStart('2'));
+		assertTrue("'+' returned true", !Character
+				.isUnicodeIdentifierStart('+'));
+	}
+
+	/**
+	 * @tests java.lang.Character#isUpperCase(char)
+	 */
+	public void test_isUpperCaseC() {
+		// Test for method boolean java.lang.Character.isUpperCase(char)
+		assertTrue("Incorrect case value", !Character.isUpperCase('t'));
+		assertTrue("Incorrect case value", Character.isUpperCase('T'));
+	}
+
+	/**
+	 * @tests java.lang.Character#isWhitespace(char)
+	 */
+	public void test_isWhitespaceC() {
+		// Test for method boolean java.lang.Character.isWhitespace(char)
+		assertTrue("space returned false", Character.isWhitespace('\n'));
+		assertTrue("non-space returned true", !Character.isWhitespace('T'));
+	}
+
+	/**
+	 * @tests java.lang.Character#toLowerCase(char)
+	 */
+	public void test_toLowerCaseC() {
+		// Test for method char java.lang.Character.toLowerCase(char)
+		assertTrue("Failed to change case", Character.toLowerCase('T') == 't');
+	}
+
+	/**
+	 * @tests java.lang.Character#toString()
+	 */
+	public void test_toString() {
+		// Test for method java.lang.String java.lang.Character.toString()
+		assertTrue("Incorrect String returned", new Character('T').toString()
+				.equals("T"));
+	}
+
+	/**
+	 * @tests java.lang.Character#toTitleCase(char)
+	 */
+	public void test_toTitleCaseC() {
+		// Test for method char java.lang.Character.toTitleCase(char)
+		assertTrue("Incorrect title case for a",
+				Character.toTitleCase('a') == 'A');
+		assertTrue("Incorrect title case for A",
+				Character.toTitleCase('A') == 'A');
+		assertTrue("Incorrect title case for 1",
+				Character.toTitleCase('1') == '1');
+	}
+
+	/**
+	 * @tests java.lang.Character#toUpperCase(char)
+	 */
+	public void test_toUpperCaseC() {
+		// Test for method char java.lang.Character.toUpperCase(char)
+		assertTrue("Incorrect upper case for a",
+				Character.toUpperCase('a') == 'A');
+		assertTrue("Incorrect upper case for A",
+				Character.toUpperCase('A') == 'A');
+		assertTrue("Incorrect upper case for 1",
+				Character.toUpperCase('1') == '1');
+	}
+
+	/**
+	 * Sets up the fixture, for example, open a network connection. This method
+	 * is called before a test is executed.
+	 */
+	protected void setUp() {
+	}
+
+	/**
+	 * Tears down the fixture, for example, close a network connection. This
+	 * method is called after a test is executed.
+	 */
+	protected void tearDown() {
+	}
+}

Added: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/ClassCastExceptionTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/ClassCastExceptionTest.java?rev=386058&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/ClassCastExceptionTest.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/ClassCastExceptionTest.java Wed Mar 15 03:46:17 2006
@@ -0,0 +1,71 @@
+/* Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * 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
+ * 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
+ * limitations under the License.
+ */
+
+package tests.api.java.lang;
+
+public class ClassCastExceptionTest extends junit.framework.TestCase {
+
+	/**
+	 * @tests java.lang.ClassCastException#ClassCastException()
+	 */
+	public void test_Constructor() {
+		// Test for method java.lang.ClassCastException()
+		try {
+			try {
+				String z = (String) new Object();
+				if (z == null)
+					; // use z to avoid a warning msg
+			} catch (ClassCastException e) {
+				return;
+			}
+			fail("Failed to generate expected exception");
+		} catch (Exception e) {
+			fail("Exception during test : " + e.getMessage());
+		}
+	}
+
+	/**
+	 * @tests java.lang.ClassCastException#ClassCastException(java.lang.String)
+	 */
+	public void test_ConstructorLjava_lang_String() {
+		// Test for method java.lang.ClassCastException(java.lang.String)
+		try {
+			try {
+				String z = (String) new Object();
+				if (z == null)
+					; // use z to avoid a warning msg
+			} catch (ClassCastException e) {
+				return;
+			}
+			fail("Failed to generate expected exception");
+		} catch (Exception e) {
+			fail("Exception during test : " + e.getMessage());
+		}
+	}
+
+	/**
+	 * Sets up the fixture, for example, open a network connection. This method
+	 * is called before a test is executed.
+	 */
+	protected void setUp() {
+	}
+
+	/**
+	 * Tears down the fixture, for example, close a network connection. This
+	 * method is called after a test is executed.
+	 */
+	protected void tearDown() {
+	}
+}

Added: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/ClassLoaderTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/ClassLoaderTest.java?rev=386058&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/ClassLoaderTest.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/ClassLoaderTest.java Wed Mar 15 03:46:17 2006
@@ -0,0 +1,98 @@
+/* Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * 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
+ * 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
+ * limitations under the License.
+ */
+
+package tests.api.java.lang;
+
+public class ClassLoaderTest extends junit.framework.TestCase {
+
+	/**
+	 * @tests java.lang.ClassLoader#getResource(java.lang.String)
+	 */
+	public void test_getResourceLjava_lang_String() {
+		// Test for method java.net.URL
+		// java.lang.ClassLoader.getResource(java.lang.String)
+		java.net.URL u = ClassLoader.getSystemClassLoader().getResource(
+				"hyts_Foo.c");
+		assertTrue("Unable to find resource", u != null);
+		java.io.InputStream is = null;
+		try {
+			is = u.openStream();
+			assertTrue("Resource returned is invalid", is != null);
+			is.close();
+		} catch (java.io.IOException e) {
+			fail("IOException getting stream for resource : " + e.getMessage());
+		}
+	}
+
+	/**
+	 * @tests java.lang.ClassLoader#getResourceAsStream(java.lang.String)
+	 */
+	public void test_getResourceAsStreamLjava_lang_String() {
+		// Test for method java.io.InputStream
+		// java.lang.ClassLoader.getResourceAsStream(java.lang.String)
+		// Need better test...
+
+		java.io.InputStream is = null;
+		assertTrue("Failed to find resource: hyts_Foo.c",
+				(is = ClassLoader.getSystemClassLoader().getResourceAsStream(
+						"hyts_Foo.c")) != null);
+		try {
+			is.close();
+		} catch (java.io.IOException e) {
+			fail("Exception during getResourceAsStream: " + e.toString());
+		}
+	}
+
+	/**
+	 * @tests java.lang.ClassLoader#getSystemClassLoader()
+	 */
+	public void test_getSystemClassLoader() {
+		// Test for method java.lang.ClassLoader
+		// java.lang.ClassLoader.getSystemClassLoader()
+		ClassLoader cl = ClassLoader.getSystemClassLoader();
+		java.io.InputStream is = cl.getResourceAsStream("hyts_Foo.c");
+		assertTrue("Failed to find resource from system classpath", is != null);
+		try {
+			is.close();
+		} catch (java.io.IOException e) {
+		}
+
+	}
+
+	/**
+	 * @tests java.lang.ClassLoader#getSystemResource(java.lang.String)
+	 */
+	public void test_getSystemResourceLjava_lang_String() {
+		// Test for method java.net.URL
+		// java.lang.ClassLoader.getSystemResource(java.lang.String)
+		// Need better test...
+		assertTrue("Failed to find resource: hyts_Foo.c", ClassLoader
+				.getSystemResource("hyts_Foo.c") != null);
+	}
+
+	/**
+	 * Sets up the fixture, for example, open a network connection. This method
+	 * is called before a test is executed.
+	 */
+	protected void setUp() {
+	}
+
+	/**
+	 * Tears down the fixture, for example, close a network connection. This
+	 * method is called after a test is executed.
+	 */
+	protected void tearDown() {
+	}
+}

Added: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/ClassNotFoundExceptionTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/ClassNotFoundExceptionTest.java?rev=386058&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/ClassNotFoundExceptionTest.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/ClassNotFoundExceptionTest.java Wed Mar 15 03:46:17 2006
@@ -0,0 +1,67 @@
+/* Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * 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
+ * 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
+ * limitations under the License.
+ */
+
+package tests.api.java.lang;
+
+public class ClassNotFoundExceptionTest extends junit.framework.TestCase {
+
+	/**
+	 * @tests java.lang.ClassNotFoundException#ClassNotFoundException()
+	 */
+	public void test_Constructor() {
+		// Test for method java.lang.ClassNotFoundException()
+		try {
+			try {
+				Class.forName("zz.xx.ll.Wiggum");
+			} catch (ClassNotFoundException e) {
+				return;
+			}
+			fail("Failed to generate expected exception");
+		} catch (Exception e) {
+			fail("Exception during test : " + e.getMessage());
+		}
+	}
+
+	/**
+	 * @tests java.lang.ClassNotFoundException#ClassNotFoundException(java.lang.String)
+	 */
+	public void test_ConstructorLjava_lang_String() {
+		// Test for method java.lang.ClassNotFoundException(java.lang.String)
+		try {
+			try {
+				Class.forName("zz.xx.ll.Wiggum");
+			} catch (ClassNotFoundException e) {
+				return;
+			}
+			fail("Failed to generate expected exception");
+		} catch (Exception e) {
+			fail("Exception during test : " + e.getMessage());
+		}
+	}
+
+	/**
+	 * Sets up the fixture, for example, open a network connection. This method
+	 * is called before a test is executed.
+	 */
+	protected void setUp() {
+	}
+
+	/**
+	 * Tears down the fixture, for example, close a network connection. This
+	 * method is called after a test is executed.
+	 */
+	protected void tearDown() {
+	}
+}

Added: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/ClassTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/ClassTest.java?rev=386058&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/ClassTest.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/ClassTest.java Wed Mar 15 03:46:17 2006
@@ -0,0 +1,1067 @@
+/* Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * 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
+ * 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
+ * limitations under the License.
+ */
+
+package tests.api.java.lang;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Arrays;
+import java.util.List;
+
+import tests.support.resource.Support_Resources;
+
+public class ClassTest extends junit.framework.TestCase {
+
+	static class StaticMember$Class {
+		class Member2$A {
+		}
+	}
+
+	class Member$Class {
+		class Member3$B {
+		}
+	}
+
+	public static class TestClass {
+		private int privField = 1;
+
+		public int pubField = 2;
+
+		private Object cValue = null;
+
+		public Object ack = new Object();
+
+		private int privMethod() {
+			return 1;
+		}
+
+		public int pubMethod() {
+			return 2;
+		}
+
+		public Object cValue() {
+			return cValue;
+		}
+
+		public TestClass() {
+		}
+
+		private TestClass(Object o) {
+		}
+	}
+
+	public static class SubTestClass extends TestClass {
+	}
+
+	/**
+	 * @tests java.lang.Class#forName(java.lang.String)
+	 */
+	public void test_forNameLjava_lang_String() {
+		// Test for method java.lang.Class
+		// java.lang.Class.forName(java.lang.String)
+		try {
+			assertTrue("Class for name failed for java.lang.Object", Class
+					.forName("java.lang.Object") == java.lang.Object.class);
+		} catch (Exception e) {
+			fail("Unexpected exception " + e
+					+ " in Class.forName(java.lang.Object)");
+		}
+		try {
+			assertTrue(
+					"Class for name failed for [[Ljava.lang.Object;",
+					Class.forName("[[Ljava.lang.Object;") == java.lang.Object[][].class);
+		} catch (Exception e) {
+			fail("Unexpected exception " + e
+					+ " in Class.forName([[Ljava.lang.Object;)");
+		}
+		try {
+			assertTrue("Class for name failed for [I",
+					Class.forName("[I") == int[].class);
+		} catch (Exception e) {
+			fail("Unexpected exception " + e + " in Class.forName([I)");
+		}
+
+		try {
+			assertTrue("Class for name worked (but should not have) for int",
+					Class.forName("int") == null
+							|| Class.forName("int") != null);
+		} catch (Exception e) {
+			// Exception ok here.
+		}
+
+		boolean exception = false;
+		try {
+			Class.forName("int");
+		} catch (ClassNotFoundException e) {
+			exception = true;
+		}
+		assertTrue("Found class int", exception);
+
+		exception = false;
+		try {
+			Class.forName("byte");
+		} catch (ClassNotFoundException e) {
+			exception = true;
+		}
+		assertTrue("Found class byte", exception);
+
+		exception = false;
+		try {
+			Class.forName("char");
+		} catch (ClassNotFoundException e) {
+			exception = true;
+		}
+		assertTrue("Found class char", exception);
+
+		exception = false;
+		try {
+			Class.forName("void");
+		} catch (ClassNotFoundException e) {
+			exception = true;
+		}
+		assertTrue("Found class void", exception);
+
+		exception = false;
+		try {
+			Class.forName("short");
+		} catch (ClassNotFoundException e) {
+			exception = true;
+		}
+		assertTrue("Found class short", exception);
+
+		exception = false;
+		try {
+			Class.forName("long");
+		} catch (ClassNotFoundException e) {
+			exception = true;
+		}
+		assertTrue("Found class long", exception);
+
+		exception = false;
+		try {
+			Class.forName("boolean");
+		} catch (ClassNotFoundException e) {
+			exception = true;
+		}
+		assertTrue("Found class boolean", exception);
+
+		exception = false;
+		try {
+			Class.forName("float");
+		} catch (ClassNotFoundException e) {
+			exception = true;
+		}
+		assertTrue("Found class float", exception);
+
+		exception = false;
+		try {
+			Class.forName("double");
+		} catch (ClassNotFoundException e) {
+			exception = true;
+		}
+		assertTrue("Found class double", exception);
+	}
+
+	/**
+	 * @tests java.lang.Class#getClasses()
+	 */
+	public void test_getClasses() {
+		// Test for method java.lang.Class [] java.lang.Class.getClasses()
+		assertTrue("Incorrect class array returned", ClassTest.class
+				.getClasses().length == 2);
+	}
+
+	/**
+	 * @tests java.lang.Class#getClasses()
+	 */
+	public void test_getClasses_subtest0() {
+		final java.security.Permission privCheckPermission = new java.security.BasicPermission(
+				"Privilege check") {
+		};
+		class MyCombiner implements java.security.DomainCombiner {
+			boolean combine;
+
+			public java.security.ProtectionDomain[] combine(
+					java.security.ProtectionDomain[] executionDomains,
+					java.security.ProtectionDomain[] parentDomains) {
+				combine = true;
+				return new java.security.ProtectionDomain[0];
+			}
+
+			public boolean isPriviledged() {
+				combine = false;
+				try {
+					java.security.AccessController
+							.checkPermission(privCheckPermission);
+				} catch (SecurityException e) {
+				}
+				return !combine;
+			}
+		}
+		;
+		final MyCombiner combiner = new MyCombiner();
+		class SecurityManagerCheck extends SecurityManager {
+			String reason;
+
+			Class checkClass;
+
+			int checkType;
+
+			int checkPermission = 0;
+
+			int checkMemberAccess = 0;
+
+			int checkPackageAccess = 0;
+
+			public void setExpected(String reason, Class cls, int type) {
+				this.reason = reason;
+				checkClass = cls;
+				checkType = type;
+				checkPermission = 0;
+				checkMemberAccess = 0;
+				checkPackageAccess = 0;
+			}
+
+			public void checkPermission(java.security.Permission perm) {
+				if (combiner.isPriviledged())
+					return;
+				checkPermission++;
+			}
+
+			public void checkMemberAccess(Class cls, int type) {
+				if (combiner.isPriviledged())
+					return;
+				checkMemberAccess++;
+				assertTrue(reason + " unexpected class: " + cls,
+						cls == checkClass);
+				assertTrue(reason + "unexpected type: " + type,
+						type == checkType);
+			}
+
+			public void checkPackageAccess(String packageName) {
+				if (combiner.isPriviledged())
+					return;
+				checkPackageAccess++;
+				String name = checkClass.getName();
+				int index = name.lastIndexOf('.');
+				String checkPackage = name.substring(0, index);
+				assertTrue(reason + " unexpected package: " + packageName,
+						packageName.equals(checkPackage));
+			}
+
+			public void assertProperCalls() {
+				assertTrue(reason + " unexpected checkPermission count: "
+						+ checkPermission, checkPermission == 0);
+				assertTrue(reason + " unexpected checkMemberAccess count: "
+						+ checkMemberAccess, checkMemberAccess == 1);
+				assertTrue(reason + " unexpected checkPackageAccess count: "
+						+ checkPackageAccess, checkPackageAccess == 1);
+			}
+		}
+
+		java.security.AccessControlContext acc = new java.security.AccessControlContext(
+				new java.security.ProtectionDomain[0]);
+		java.security.AccessControlContext acc2 = new java.security.AccessControlContext(
+				acc, combiner);
+
+		java.security.PrivilegedAction action = new java.security.PrivilegedAction() {
+			public Object run() {
+				File resources = Support_Resources.createTempFolder();
+				try {
+					Support_Resources.copyFile(resources, null,
+							"hyts_security.jar");
+					File file = new File(resources.toString()
+							+ "/hyts_security.jar");
+					java.net.URL url = new java.net.URL("file:"
+							+ file.getPath());
+					ClassLoader loader = new java.net.URLClassLoader(
+							new java.net.URL[] { url }, null);
+					Class cls = Class.forName("packB.SecurityTestSub", false,
+							loader);
+					SecurityManagerCheck sm = new SecurityManagerCheck();
+					System.setSecurityManager(sm);
+					try {
+						sm.setExpected("getClasses", cls,
+								java.lang.reflect.Member.PUBLIC);
+						cls.getClasses();
+						sm.assertProperCalls();
+
+						sm.setExpected("getDeclaredClasses", cls,
+								java.lang.reflect.Member.DECLARED);
+						cls.getDeclaredClasses();
+						sm.assertProperCalls();
+
+						sm.setExpected("getConstructor", cls,
+								java.lang.reflect.Member.PUBLIC);
+						cls.getConstructor(new Class[0]);
+						sm.assertProperCalls();
+
+						sm.setExpected("getConstructors", cls,
+								java.lang.reflect.Member.PUBLIC);
+						cls.getConstructors();
+						sm.assertProperCalls();
+
+						sm.setExpected("getDeclaredConstructor", cls,
+								java.lang.reflect.Member.DECLARED);
+						cls.getDeclaredConstructor(new Class[0]);
+						sm.assertProperCalls();
+
+						sm.setExpected("getDeclaredConstructors", cls,
+								java.lang.reflect.Member.DECLARED);
+						cls.getDeclaredConstructors();
+						sm.assertProperCalls();
+
+						sm.setExpected("getField", cls,
+								java.lang.reflect.Member.PUBLIC);
+						cls.getField("publicField");
+						sm.assertProperCalls();
+
+						sm.setExpected("getFields", cls,
+								java.lang.reflect.Member.PUBLIC);
+						cls.getFields();
+						sm.assertProperCalls();
+
+						sm.setExpected("getDeclaredField", cls,
+								java.lang.reflect.Member.DECLARED);
+						cls.getDeclaredField("publicField");
+						sm.assertProperCalls();
+
+						sm.setExpected("getDeclaredFields", cls,
+								java.lang.reflect.Member.DECLARED);
+						cls.getDeclaredFields();
+						sm.assertProperCalls();
+
+						sm.setExpected("getDeclaredMethod", cls,
+								java.lang.reflect.Member.DECLARED);
+						cls.getDeclaredMethod("publicMethod", new Class[0]);
+						sm.assertProperCalls();
+
+						sm.setExpected("getDeclaredMethods", cls,
+								java.lang.reflect.Member.DECLARED);
+						cls.getDeclaredMethods();
+						sm.assertProperCalls();
+
+						sm.setExpected("getMethod", cls,
+								java.lang.reflect.Member.PUBLIC);
+						cls.getMethod("publicMethod", new Class[0]);
+						sm.assertProperCalls();
+
+						sm.setExpected("getMethods", cls,
+								java.lang.reflect.Member.PUBLIC);
+						cls.getMethods();
+						sm.assertProperCalls();
+
+						sm.setExpected("newInstance", cls,
+								java.lang.reflect.Member.PUBLIC);
+						cls.newInstance();
+						sm.assertProperCalls();
+					} finally {
+						System.setSecurityManager(null);
+					}
+				} catch (Exception e) {
+					if (e instanceof RuntimeException)
+						throw (RuntimeException) e;
+					fail("unexpected exception: " + e);
+				}
+				return null;
+			}
+		};
+		java.security.AccessController.doPrivileged(action, acc2);
+	}
+
+	/**
+	 * @tests java.lang.Class#getComponentType()
+	 */
+	public void test_getComponentType() {
+		// Test for method java.lang.Class java.lang.Class.getComponentType()
+		assertTrue("int array does not have int component type", int[].class
+				.getComponentType() == int.class);
+		assertTrue("Object array does not have Object component type",
+				Object[].class.getComponentType() == Object.class);
+		assertTrue("Object has non-null component type", Object.class
+				.getComponentType() == null);
+	}
+
+	/**
+	 * @tests java.lang.Class#getConstructor(java.lang.Class[])
+	 */
+	public void test_getConstructor$Ljava_lang_Class() {
+		// Test for method java.lang.reflect.Constructor
+		// java.lang.Class.getConstructor(java.lang.Class [])
+		try {
+			TestClass.class.getConstructor(new Class[0]);
+			try {
+				TestClass.class.getConstructor(new Class[] { Object.class });
+			} catch (NoSuchMethodException e) {
+				// Correct - constructor with obj is private
+				return;
+			}
+			fail("Found private constructor");
+		} catch (NoSuchMethodException e) {
+			fail("Exception during getConstructor test : " + e.getMessage());
+		}
+	}
+
+	/**
+	 * @tests java.lang.Class#getConstructors()
+	 */
+	public void test_getConstructors() {
+		// Test for method java.lang.reflect.Constructor []
+		// java.lang.Class.getConstructors()
+		try {
+			java.lang.reflect.Constructor[] c = TestClass.class
+					.getConstructors();
+			assertTrue("Incorrect number of constructors returned",
+					c.length == 1);
+		} catch (Exception e) {
+			fail("Exception during getDeclaredConstructor test:"
+					+ e.toString());
+		}
+	}
+
+	/**
+	 * @tests java.lang.Class#getDeclaredClasses()
+	 */
+	public void test_getDeclaredClasses() {
+		// Test for method java.lang.Class []
+		// java.lang.Class.getDeclaredClasses()
+		assertTrue("Incorrect class array returned", ClassTest.class
+				.getClasses().length == 2);
+	}
+
+	/**
+	 * @tests java.lang.Class#getDeclaredConstructor(java.lang.Class[])
+	 */
+	public void test_getDeclaredConstructor$Ljava_lang_Class() {
+		// Test for method java.lang.reflect.Constructor
+		// java.lang.Class.getDeclaredConstructor(java.lang.Class [])
+		try {
+			java.lang.reflect.Constructor c = TestClass.class
+					.getDeclaredConstructor(new Class[0]);
+			assertTrue("Incorrect constructor returned", ((TestClass) (c
+					.newInstance(new Object[0]))).cValue() == null);
+			c = TestClass.class
+					.getDeclaredConstructor(new Class[] { Object.class });
+		} catch (NoSuchMethodException e) {
+			fail("Exception during getDeclaredConstructor test: "
+					+ e.toString());
+		} catch (Exception e) {
+			fail("Exception during getDeclaredConstructor test:"
+					+ e.toString());
+		}
+	}
+
+	/**
+	 * @tests java.lang.Class#getDeclaredConstructors()
+	 */
+	public void test_getDeclaredConstructors() {
+		// Test for method java.lang.reflect.Constructor []
+		// java.lang.Class.getDeclaredConstructors()
+		try {
+			java.lang.reflect.Constructor[] c = TestClass.class
+					.getDeclaredConstructors();
+			assertTrue("Incorrect number of constructors returned",
+					c.length == 2);
+		} catch (Exception e) {
+			fail("Exception during getDeclaredConstructor test:"
+					+ e.toString());
+		}
+	}
+
+	/**
+	 * @tests java.lang.Class#getDeclaredField(java.lang.String)
+	 */
+	public void test_getDeclaredFieldLjava_lang_String() {
+		// Test for method java.lang.reflect.Field
+		// java.lang.Class.getDeclaredField(java.lang.String)
+		try {
+			java.lang.reflect.Field f = TestClass.class
+					.getDeclaredField("pubField");
+			assertTrue("Returned incorrect field",
+					f.getInt(new TestClass()) == 2);
+		} catch (Exception e) {
+			fail("Exception getting fields : " + e.getMessage());
+		}
+	}
+
+	/**
+	 * @tests java.lang.Class#getDeclaredFields()
+	 */
+	public void test_getDeclaredFields() {
+		// Test for method java.lang.reflect.Field []
+		// java.lang.Class.getDeclaredFields()
+		try {
+			java.lang.reflect.Field[] f = TestClass.class.getDeclaredFields();
+			assertTrue("Returned incorrect number of fields", f.length == 4);
+			f = SubTestClass.class.getDeclaredFields();
+			// Declared fields do not include inherited
+			assertTrue("Returned incorrect number of fields", f.length == 0);
+		} catch (Exception e) {
+			fail("Exception getting fields : " + e.getMessage());
+		}
+	}
+
+	/**
+	 * @tests java.lang.Class#getDeclaredMethod(java.lang.String,
+	 *        java.lang.Class[])
+	 */
+	public void test_getDeclaredMethodLjava_lang_String$Ljava_lang_Class() {
+		// Test for method java.lang.reflect.Method
+		// java.lang.Class.getDeclaredMethod(java.lang.String, java.lang.Class
+		// [])
+		try {
+			java.lang.reflect.Method m = TestClass.class.getDeclaredMethod(
+					"pubMethod", new Class[0]);
+			assertTrue("Returned incorrect method", ((Integer) (m.invoke(
+					new TestClass(), new Class[0]))).intValue() == 2);
+			m = TestClass.class.getDeclaredMethod("privMethod", new Class[0]);
+			try {
+				// Invoking private non-sub, non-package
+				m.invoke(new TestClass(), new Class[0]);
+			} catch (IllegalAccessException e) {
+				// Correct
+				return;
+			}
+		} catch (Exception e) {
+			fail("Exception getting methods : " + e.getMessage());
+		}
+	}
+
+	/**
+	 * @tests java.lang.Class#getDeclaredMethods()
+	 */
+	public void test_getDeclaredMethods() {
+		// Test for method java.lang.reflect.Method []
+		// java.lang.Class.getDeclaredMethods()
+		try {
+			java.lang.reflect.Method[] m = TestClass.class.getDeclaredMethods();
+			assertTrue("Returned incorrect number of methods", m.length == 3);
+			m = SubTestClass.class.getDeclaredMethods();
+			assertTrue("Returned incorrect number of methods", m.length == 0);
+		} catch (Exception e) {
+			fail("Exception getting methods : " + e.getMessage());
+		}
+	}
+
+	/**
+	 * @tests java.lang.Class#getDeclaringClass()
+	 */
+	public void test_getDeclaringClass() {
+		// Test for method java.lang.Class java.lang.Class.getDeclaringClass()
+		assertTrue(TestClass.class.getDeclaringClass().equals(ClassTest.class));
+	}
+
+	/**
+	 * @tests java.lang.Class#getField(java.lang.String)
+	 */
+	public void test_getFieldLjava_lang_String() {
+		// Test for method java.lang.reflect.Field
+		// java.lang.Class.getField(java.lang.String)
+		try {
+			java.lang.reflect.Field f = TestClass.class.getField("pubField");
+			assertTrue("Returned incorrect field",
+					f.getInt(new TestClass()) == 2);
+			try {
+				f = TestClass.class.getField("privField");
+			} catch (NoSuchFieldException e) {
+				// Correct
+				return;
+			}
+			fail("Private field access failed to throw exception");
+		} catch (Exception e) {
+			fail("Exception getting fields : " + e.getMessage());
+		}
+	}
+
+	/**
+	 * @tests java.lang.Class#getFields()
+	 */
+	public void test_getFields() {
+		// Test for method java.lang.reflect.Field []
+		// java.lang.Class.getFields()
+		try {
+			java.lang.reflect.Field[] f = TestClass.class.getFields();
+			assertTrue("Incorrect number of fields returned: " + f.length,
+					f.length == 2);
+			f = SubTestClass.class.getFields();
+			assertTrue("Incorrect number of fields returned: " + f.length,
+					f.length == 2);// Check inheritance of pub fields
+		} catch (Exception e) {
+			fail("Exception getting fields : " + e.getMessage());
+		}
+	}
+
+	/**
+	 * @tests java.lang.Class#getInterfaces()
+	 */
+	public void test_getInterfaces() {
+		// Test for method java.lang.Class [] java.lang.Class.getInterfaces()
+		Class[] interfaces;
+		List interfaceList;
+		interfaces = java.lang.Object.class.getInterfaces();
+		assertTrue("Incorrect interface list for Object",
+				interfaces.length == 0);
+		interfaceList = Arrays.asList(java.util.Vector.class.getInterfaces());
+		assertTrue("Incorrect interface list for Vector", interfaceList
+				.contains(java.lang.Cloneable.class)
+				&& interfaceList.contains(java.io.Serializable.class)
+				&& interfaceList.contains(java.util.List.class));
+	}
+
+	/**
+	 * @tests java.lang.Class#getMethod(java.lang.String, java.lang.Class[])
+	 */
+	public void test_getMethodLjava_lang_String$Ljava_lang_Class() {
+		// Test for method java.lang.reflect.Method
+		// java.lang.Class.getMethod(java.lang.String, java.lang.Class [])
+		try {
+			java.lang.reflect.Method m = TestClass.class.getMethod("pubMethod",
+					new Class[0]);
+			assertTrue("Returned incorrect method", ((Integer) (m.invoke(
+					new TestClass(), new Class[0]))).intValue() == 2);
+			try {
+				m = TestClass.class.getMethod("privMethod", new Class[0]);
+			} catch (NoSuchMethodException e) {
+				// Correct
+				return;
+			}
+			fail("Failed to throw exception accessing private method");
+		} catch (Exception e) {
+			fail("Exception getting methods : " + e.getMessage());
+		}
+	}
+
+	/**
+	 * @tests java.lang.Class#getMethods()
+	 */
+	public void test_getMethods() {
+		// Test for method java.lang.reflect.Method []
+		// java.lang.Class.getMethods()
+		try {
+			java.lang.reflect.Method[] m = TestClass.class.getMethods();
+			assertTrue("Returned incorrect number of methods: " + m.length,
+					m.length == 2 + Object.class.getMethods().length);
+			m = SubTestClass.class.getMethods();
+			assertTrue("Returned incorrect number of sub-class methods: "
+					+ m.length,
+					m.length == 2 + Object.class.getMethods().length);
+			// Number of inherited methods
+		} catch (Exception e) {
+			fail("Exception getting methods : " + e.getMessage());
+		}
+	}
+
+	/**
+	 * @tests java.lang.Class#getModifiers()
+	 */
+	public void test_getModifiers() {
+		// Test for method int java.lang.Class.getModifiers()
+
+		class defaultClass {
+		}
+		;
+
+		final int publicFlag = 0x0001;
+		final int privateFlag = 0x0002;
+		final int protectedFlag = 0x0004;
+		assertTrue("default class is public", (defaultClass.class
+				.getModifiers() & publicFlag) == 0);
+		assertTrue("default class is protected", (defaultClass.class
+				.getModifiers() & protectedFlag) == 0);
+		assertTrue("default class is private", (defaultClass.class
+				.getModifiers() & privateFlag) == 0);
+		assertTrue("public class is not public",
+				(Object.class.getModifiers() & publicFlag) != 0);
+		assertTrue("public class is protected",
+				(Object.class.getModifiers() & protectedFlag) == 0);
+		assertTrue("public class is private",
+				(Object.class.getModifiers() & privateFlag) == 0);
+	}
+
+	/**
+	 * @tests java.lang.Class#getName()
+	 */
+	public void test_getName() {
+		// Test for method java.lang.String java.lang.Class.getName()
+		String className = null;
+		try {
+			className = Class.forName("java.lang.Object").getName();
+		} catch (ClassNotFoundException e) {
+			fail("Should be able to find java.lang.Object");
+			return;
+		}
+		assertTrue("Class getName printed wrong value:" + className, className
+				.equals("java.lang.Object"));
+		assertTrue("Class getName printed wrong value:" + int.class.getName(),
+				int.class.getName().equals("int"));
+		try {
+			className = Class.forName("[I").getName();
+		} catch (ClassNotFoundException e) {
+			fail("Should be able to find class [I");
+			return;
+		}
+		assertTrue("Class getName printed wrong value:" + className, className
+				.equals("[I"));
+
+		try {
+			className = Class.forName("[Ljava.lang.Object;").getName();
+		} catch (ClassNotFoundException e) {
+			fail("Should be able to find [Ljava.lang.Object;");
+			return;
+		}
+
+		assertTrue("Class getName printed wrong value:" + className, className
+				.equals("[Ljava.lang.Object;"));
+	}
+
+	/**
+	 * @tests java.lang.Class#getResource(java.lang.String)
+	 */
+	public void test_getResourceLjava_lang_String() {
+		// Test for method java.net.URL
+		// java.lang.Class.getResource(java.lang.String)
+		String name = Support_Resources.RESOURCE_PACKAGE + "hyts_compressD.txt";
+		System.setSecurityManager(new SecurityManager());
+		try {
+			java.net.URL res = Object.class.getResource("Object.class");
+			assertTrue("Object.class should not be found", res == null);
+
+			assertTrue("Security: the file " + name
+					+ " can not be found in this directory", ClassTest.class
+					.getResource(name) != null);
+		} finally {
+			System.setSecurityManager(null);
+		}
+	}
+
+	/**
+	 * @tests java.lang.Class#getResourceAsStream(java.lang.String)
+	 */
+	public void test_getResourceAsStreamLjava_lang_String() {
+		// Test for method java.io.InputStream
+		// java.lang.Class.getResourceAsStream(java.lang.String)
+
+		String name = Support_Resources.RESOURCE_PACKAGE + "hyts_compressD.txt";
+		Class clazz = null;
+		try {
+			clazz = Class.forName("tests.api.java.lang.ClassTest");
+		} catch (ClassNotFoundException e) {
+			fail(
+					"Should be able to find the class tests.api.java.lang.ClassTest");
+		}
+		assertTrue("the file " + name + " can not be found in this directory",
+				clazz.getResourceAsStream(name) != null);
+
+		System.setSecurityManager(new SecurityManager());
+		try {
+			InputStream res = Object.class.getResourceAsStream("Object.class");
+			assertTrue("Object.class should not be found", res == null);
+			InputStream is = ClassTest.class.getResourceAsStream(name);
+			assertTrue("Security: the file " + name
+					+ " can not be found in this directory", is != null);
+		} finally {
+			System.setSecurityManager(null);
+		}
+
+		name = "hyts_Foo.c";
+		assertTrue("the file " + name
+				+ " should not be found in this directory", clazz
+				.getResourceAsStream(name) == null);
+		assertTrue("the file " + name
+				+ " can not be found in the root directory", clazz
+				.getResourceAsStream("/" + name) != null);
+
+		try {
+			clazz = Class.forName("java.lang.Object");
+		} catch (ClassNotFoundException e) {
+			fail("Should be able to find the class java.lang.Object");
+		}
+		InputStream str = clazz.getResourceAsStream("Class.class");
+		assertTrue(
+				"java.lang.Object couldn't find its class with getResource...",
+				str != null);
+		try {
+			assertTrue("Cannot read single byte", str.read() != -1);
+			assertTrue("Cannot read multiple bytes", str.read(new byte[5]) == 5);
+			str.close();
+		} catch (IOException e) {
+			fail("Exception while closing resource stream 1.");
+		}
+
+		InputStream str2 = getClass().getResourceAsStream(
+				Support_Resources.RESOURCE_PACKAGE + "hyts_compressD.txt");
+		assertTrue("Can't find resource", str2 != null);
+		try {
+			assertTrue("Cannot read single byte", str2.read() != -1);
+			assertTrue("Cannot read multiple bytes",
+					str2.read(new byte[5]) == 5);
+			str2.close();
+		} catch (IOException e) {
+			fail("IOException while closing resource stream 2 : "
+					+ e.getMessage());
+		}
+
+	}
+
+	/**
+	 * @tests java.lang.Class#getSuperclass()
+	 */
+	public void test_getSuperclass() {
+		// Test for method java.lang.Class java.lang.Class.getSuperclass()
+
+		assertTrue("Object has a superclass???",
+				Object.class.getSuperclass() == null);
+		assertTrue(
+				"Normal class has bogus superclass",
+				java.io.FileInputStream.class.getSuperclass() == java.io.InputStream.class);
+		assertTrue("Array class has bogus superclass",
+				java.io.FileInputStream[].class.getSuperclass() == Object.class);
+		assertTrue("Base class has a superclass",
+				int.class.getSuperclass() == null);
+		assertTrue("Interface class has a superclass", Cloneable.class
+				.getSuperclass() == null);
+	}
+
+	/**
+	 * @tests java.lang.Class#isArray()
+	 */
+	public void test_isArray() {
+		// Test for method boolean java.lang.Class.isArray()
+		assertTrue("Non-array type claims to be.", !int.class.isArray());
+		Class clazz = null;
+		try {
+			clazz = Class.forName("[I");
+		} catch (ClassNotFoundException e) {
+			fail("Should be able to find the class [I");
+		}
+		assertTrue("int Array type claims not to be.", clazz.isArray());
+
+		try {
+			clazz = Class.forName("[Ljava.lang.Object;");
+		} catch (ClassNotFoundException e) {
+			fail("Should be able to find the class [Ljava.lang.Object;");
+		}
+
+		assertTrue("Object Array type claims not to be.", clazz.isArray());
+
+		try {
+			clazz = Class.forName("java.lang.Object");
+		} catch (ClassNotFoundException e) {
+			fail("Should be able to find the class java.lang.Object");
+		}
+		assertTrue("Non-array Object type claims to be.", !clazz.isArray());
+	}
+
+	/**
+	 * @tests java.lang.Class#isAssignableFrom(java.lang.Class)
+	 */
+	public void test_isAssignableFromLjava_lang_Class() {
+		// Test for method boolean
+		// java.lang.Class.isAssignableFrom(java.lang.Class)
+		Class clazz1 = null;
+		Class clazz2 = null;
+		try {
+			clazz1 = Class.forName("java.lang.Object");
+		} catch (ClassNotFoundException e) {
+			fail("Should be able to find the class java.lang.Object");
+		}
+		try {
+			clazz2 = Class.forName("java.lang.Class");
+		} catch (ClassNotFoundException e) {
+			fail("Should be able to find the class java.lang.Class");
+		}
+		assertTrue("returned false for superclass", clazz1
+				.isAssignableFrom(clazz2));
+
+		try {
+			clazz1 = Class.forName("tests.api.java.lang.ClassTest$TestClass");
+		} catch (ClassNotFoundException e) {
+			fail(
+					"Should be able to find the class tests.api.java.lang.ClassTest$TestClass");
+		}
+		assertTrue("returned false for same class", clazz1
+				.isAssignableFrom(clazz1));
+
+		try {
+			clazz1 = Class.forName("java.lang.Runnable");
+		} catch (ClassNotFoundException e) {
+			fail("Should be able to find the class java.lang.Runnable");
+		}
+		try {
+			clazz2 = Class.forName("java.lang.Thread");
+		} catch (ClassNotFoundException e) {
+			fail("Should be able to find the class java.lang.Thread");
+		}
+		assertTrue("returned false for implemented interface", clazz1
+				.isAssignableFrom(clazz2));
+	}
+
+	/**
+	 * @tests java.lang.Class#isInterface()
+	 */
+	public void test_isInterface() {
+		// Test for method boolean java.lang.Class.isInterface()
+		assertTrue("Prim type claims to be interface.", !int.class
+				.isInterface());
+		Class clazz = null;
+		try {
+			clazz = Class.forName("[I");
+		} catch (ClassNotFoundException e) {
+			fail("Should be able to find the class [I");
+		}
+		assertTrue("Prim Array type claims to be interface.", !clazz
+				.isInterface());
+
+		try {
+			clazz = Class.forName("java.lang.Runnable");
+		} catch (ClassNotFoundException e) {
+			fail("Should be able to find the class java.lang.Runnable");
+		}
+		assertTrue("Interface type claims not to be interface.", clazz
+				.isInterface());
+
+		try {
+			clazz = Class.forName("java.lang.Object");
+		} catch (ClassNotFoundException e) {
+			fail("Should be able to find the class java.lang.Object");
+		}
+		assertTrue("Object type claims to be interface.", !clazz.isInterface());
+
+		try {
+			clazz = Class.forName("[Ljava.lang.Object;");
+		} catch (ClassNotFoundException e) {
+			fail("Should be able to find the class [Ljava.lang.Object;");
+		}
+		assertTrue("Array type claims to be interface.", !clazz.isInterface());
+	}
+
+	/**
+	 * @tests java.lang.Class#isPrimitive()
+	 */
+	public void test_isPrimitive() {
+		// Test for method boolean java.lang.Class.isPrimitive()
+		assertTrue("Interface type claims to be primitive.", !Runnable.class
+				.isPrimitive());
+		assertTrue("Object type claims to be primitive.", !Object.class
+				.isPrimitive());
+		assertTrue("Prim Array type claims to be primitive.", !int[].class
+				.isPrimitive());
+		assertTrue("Array type claims to be primitive.", !Object[].class
+				.isPrimitive());
+		assertTrue("Prim type claims not to be primitive.", int.class
+				.isPrimitive());
+		assertTrue("Object type claims to be primitive.", !Object.class
+				.isPrimitive());
+	}
+
+	/**
+	 * @tests java.lang.Class#newInstance()
+	 */
+	public void test_newInstance() {
+		// Test for method java.lang.Object java.lang.Class.newInstance()
+
+		Class clazz = null;
+		try {
+			try {
+				clazz = Class.forName("java.lang.Object");
+			} catch (ClassNotFoundException e) {
+				fail("Should be able to find the class java.lang.Object");
+			}
+			assertTrue("new object instance was null",
+					clazz.newInstance() != null);
+		} catch (Exception e) {
+			fail("Unexpected exception " + e + " in newInstance()");
+		}
+		try {
+			try {
+				clazz = Class.forName("java.lang.Throwable");
+			} catch (ClassNotFoundException e) {
+				fail(
+						"Should be able to find the class java.lang.Throwable");
+			}
+			assertTrue("new Throwable instance was not a throwable", clazz
+					.newInstance().getClass() == clazz);
+		} catch (Exception e) {
+			fail("Unexpected exception " + e + " in newInstance()");
+		}
+		int r = 0;
+		try {
+			try {
+				clazz = Class.forName("java.lang.Integer");
+			} catch (ClassNotFoundException e) {
+				fail(
+						"Should be able to find the class java.lang.Integer");
+			}
+			assertTrue(
+					"Allowed to do newInstance, when no default constructor",
+					clazz.newInstance() != null || clazz.newInstance() == null);
+		} catch (Exception e) {
+			r = 1;
+		}
+		assertTrue(
+				"Exception for instantiating a newInstance with no default constructor is not thrown",
+				r == 1);
+		// There needs to be considerably more testing here.
+	}
+
+	/**
+	 * @tests java.lang.Class#toString()
+	 */
+	public void test_toString() {
+		// Test for method java.lang.String java.lang.Class.toString()
+		assertTrue(
+				"Class toString printed wrong value:" + int.class.toString(),
+				int.class.toString().equals("int"));
+		Class clazz = null;
+		try {
+			clazz = Class.forName("[I");
+		} catch (ClassNotFoundException e) {
+			fail("Should be able to find the class [I");
+		}
+		assertTrue("Class toString printed wrong value:" + clazz.toString(),
+				clazz.toString().equals("class [I"));
+
+		try {
+			clazz = Class.forName("java.lang.Object");
+		} catch (ClassNotFoundException e) {
+			fail("Should be able to find the class java.lang.Object");
+		}
+		assertTrue("Class toString printed wrong value:" + clazz.toString(),
+				clazz.toString().equals("class java.lang.Object"));
+
+		try {
+			clazz = Class.forName("[Ljava.lang.Object;");
+		} catch (ClassNotFoundException e) {
+			fail("Should be able to find the class [Ljava.lang.Object;");
+		}
+		assertTrue("Class toString printed wrong value:" + clazz.toString(),
+				clazz.toString().equals("class [Ljava.lang.Object;"));
+	}
+
+	/**
+	 * Sets up the fixture, for example, open a network connection. This method
+	 * is called before a test is executed.
+	 */
+	protected void setUp() {
+	}
+
+	/**
+	 * Tears down the fixture, for example, close a network connection. This
+	 * method is called after a test is executed.
+	 */
+	protected void tearDown() {
+	}
+}

Added: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/CloneNotSupportedExceptionTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/CloneNotSupportedExceptionTest.java?rev=386058&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/CloneNotSupportedExceptionTest.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/CloneNotSupportedExceptionTest.java Wed Mar 15 03:46:17 2006
@@ -0,0 +1,72 @@
+/* Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * 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
+ * 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
+ * limitations under the License.
+ */
+
+package tests.api.java.lang;
+
+public class CloneNotSupportedExceptionTest extends junit.framework.TestCase {
+
+	/**
+	 * @tests java.lang.CloneNotSupportedException#CloneNotSupportedException()
+	 */
+	public void test_Constructor() {
+		// Test for method java.lang.CloneNotSupportedException()
+		class NoClone extends Object {
+			public Object clone() throws CloneNotSupportedException {
+				return super.clone();
+			}
+		}
+		try {
+			NoClone x = new NoClone();
+			NoClone y = (NoClone) x.clone();
+		} catch (CloneNotSupportedException e) {
+			return;
+		}
+		fail("Failed to generate expected exception");
+	}
+
+	/**
+	 * @tests java.lang.CloneNotSupportedException#CloneNotSupportedException(java.lang.String)
+	 */
+	public void test_ConstructorLjava_lang_String() {
+		// Test for method
+		// java.lang.CloneNotSupportedException(java.lang.String)
+		class NoClone extends Object {
+			public Object clone() throws CloneNotSupportedException {
+				return super.clone();
+			}
+		}
+		try {
+			NoClone x = new NoClone();
+			x.clone();
+		} catch (CloneNotSupportedException e) {
+			return;
+		}
+		fail("Failed to generate expected exception");
+	}
+
+	/**
+	 * Sets up the fixture, for example, open a network connection. This method
+	 * is called before a test is executed.
+	 */
+	protected void setUp() {
+	}
+
+	/**
+	 * Tears down the fixture, for example, close a network connection. This
+	 * method is called after a test is executed.
+	 */
+	protected void tearDown() {
+	}
+}

Added: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/CompilerTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/CompilerTest.java?rev=386058&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/CompilerTest.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/CompilerTest.java Wed Mar 15 03:46:17 2006
@@ -0,0 +1,104 @@
+/* Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * 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
+ * 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
+ * limitations under the License.
+ */
+
+package tests.api.java.lang;
+
+public class CompilerTest extends junit.framework.TestCase {
+
+	/**
+	 * @tests java.lang.Compiler#command(java.lang.Object)
+	 */
+	public void test_commandLjava_lang_Object() {
+		// Test for method java.lang.Object
+		// java.lang.Compiler.command(java.lang.Object)
+		try {
+			assertTrue("Incorrect behavior.",
+					Compiler.command(new Object()) == null);
+		} catch (Exception e) {
+			fail("Exception during test : " + e.getMessage());
+		}
+	}
+
+	/**
+	 * @tests java.lang.Compiler#compileClass(java.lang.Class)
+	 */
+	public void test_compileClassLjava_lang_Class() {
+		// Test for method boolean
+		// java.lang.Compiler.compileClass(java.lang.Class)
+		try {
+			// Do not test return value, may return true or false depending on
+			// if the jit is enabled. Make the call to ensure it doesn't crash.
+			Compiler.compileClass(Compiler.class);
+		} catch (Exception e) {
+			fail("Exception during test.");
+		}
+	}
+
+	/**
+	 * @tests java.lang.Compiler#compileClasses(java.lang.String)
+	 */
+	public void test_compileClassesLjava_lang_String() {
+		// Test for method boolean
+		// java.lang.Compiler.compileClasses(java.lang.String)
+		try {
+			// Do not test return value, may return true or false depending on
+			// if the jit is enabled. Make the call to ensure it doesn't crash.
+			Compiler.compileClasses("Compiler");
+		} catch (Exception e) {
+			fail("Exception during test.");
+		}
+	}
+
+	/**
+	 * @tests java.lang.Compiler#disable()
+	 */
+	public void test_disable() {
+		// Test for method void java.lang.Compiler.disable()
+		try {
+			Compiler.disable();
+			Compiler.compileClass(Compiler.class);
+		} catch (Exception e) {
+			fail("Exception during test : " + e.getMessage());
+		}
+	}
+
+	/**
+	 * @tests java.lang.Compiler#enable()
+	 */
+	public void test_enable() {
+		// Test for method void java.lang.Compiler.enable()
+		try {
+			Compiler.disable();
+			Compiler.enable();
+			Compiler.compileClass(Compiler.class);
+		} catch (Exception e) {
+			fail("Exception during test : " + e.getMessage());
+		}
+	}
+
+	/**
+	 * Sets up the fixture, for example, open a network connection. This method
+	 * is called before a test is executed.
+	 */
+	protected void setUp() {
+	}
+
+	/**
+	 * Tears down the fixture, for example, close a network connection. This
+	 * method is called after a test is executed.
+	 */
+	protected void tearDown() {
+	}
+}



Mime
View raw message