You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by te...@apache.org on 2006/03/15 12:47:39 UTC

svn commit: r386058 [19/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/...

Added: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/IllegalMonitorStateExceptionTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/IllegalMonitorStateExceptionTest.java?rev=386058&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/IllegalMonitorStateExceptionTest.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/IllegalMonitorStateExceptionTest.java Wed Mar 15 03:46:17 2006
@@ -0,0 +1,70 @@
+/* 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 IllegalMonitorStateExceptionTest extends junit.framework.TestCase {
+
+	/**
+	 * @tests java.lang.IllegalMonitorStateException#IllegalMonitorStateException()
+	 */
+	public void test_Constructor() {
+		// Test for method java.lang.IllegalMonitorStateException()
+		try {
+			try {
+				Object o = new Object();
+				o.wait();
+			} catch (IllegalMonitorStateException e) {
+				return;
+			}
+			fail("Failed to generate Exception");
+		} catch (Exception e) {
+			fail("Exception during test : " + e.getMessage());
+		}
+	}
+
+	/**
+	 * @tests java.lang.IllegalMonitorStateException#IllegalMonitorStateException(java.lang.String)
+	 */
+	public void test_ConstructorLjava_lang_String() {
+		// Test for method
+		// java.lang.IllegalMonitorStateException(java.lang.String)
+		try {
+			try {
+				Object o = new Object();
+				o.wait();
+			} catch (IllegalMonitorStateException e) {
+				return;
+			}
+			fail("Failed to generate 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/IllegalStateExceptionTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/IllegalStateExceptionTest.java?rev=386058&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/IllegalStateExceptionTest.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/IllegalStateExceptionTest.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 IllegalStateExceptionTest extends junit.framework.TestCase {
+
+	/**
+	 * @tests java.lang.IllegalStateException#IllegalStateException()
+	 */
+	public void test_Constructor() {
+		// Test for method java.lang.IllegalStateException()
+		IllegalStateException ill = new IllegalStateException();
+		assertTrue("failed to create an instance of illegalStateException", ill
+				.getMessage() == null);
+		try {
+			try {
+				java.util.zip.Inflater inflater = new java.util.zip.Inflater();
+				inflater.end();
+				inflater.getAdler();
+			} catch (IllegalStateException e) {
+				return;
+			}
+			fail("Failed to generate Exception");
+		} catch (Exception e) {
+			fail("Exception during test : " + e.getMessage());
+		}
+	}
+
+	/**
+	 * @tests java.lang.IllegalStateException#IllegalStateException(java.lang.String)
+	 */
+	public void test_ConstructorLjava_lang_String() {
+		// Test for method java.lang.IllegalStateException(java.lang.String)
+		IllegalStateException ill = new IllegalStateException(
+				"testing illState exception");
+		assertTrue(
+				"failed to create instance of illegalStateException(string)",
+				ill.getMessage().equals("testing illState 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/IllegalThreadStateExceptionTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/IllegalThreadStateExceptionTest.java?rev=386058&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/IllegalThreadStateExceptionTest.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/IllegalThreadStateExceptionTest.java Wed Mar 15 03:46:17 2006
@@ -0,0 +1,82 @@
+/* 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 IllegalThreadStateExceptionTest extends junit.framework.TestCase {
+
+	class TestThread implements Runnable {
+		public void run() {
+			try {
+				Thread.currentThread().sleep(1000);
+			} catch (Exception e) {
+				System.out.println("Unable to start thread");
+			}
+		}
+	}
+
+	/**
+	 * @tests java.lang.IllegalThreadStateException#IllegalThreadStateException()
+	 */
+	public void test_Constructor() {
+		// Test for method java.lang.IllegalThreadStateException()
+		try {
+			try {
+				Thread t = new Thread(new TestThread());
+				t.start();
+				t.start();
+			} catch (IllegalThreadStateException e) {
+				return;
+			}
+			fail("Failed to generate Exception");
+		} catch (Exception e) {
+			fail("Exception during test : " + e.getMessage());
+		}
+	}
+
+	/**
+	 * @tests java.lang.IllegalThreadStateException#IllegalThreadStateException(java.lang.String)
+	 */
+	public void test_ConstructorLjava_lang_String() {
+		// Test for method
+		// java.lang.IllegalThreadStateException(java.lang.String)
+		try {
+			try {
+				Thread t = new Thread(new TestThread());
+				t.start();
+				t.start();
+			} catch (IllegalThreadStateException e) {
+				return;
+			}
+			fail("Failed to generate 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/IncompatibleClassChangeErrorTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/IncompatibleClassChangeErrorTest.java?rev=386058&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/IncompatibleClassChangeErrorTest.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/IncompatibleClassChangeErrorTest.java Wed Mar 15 03:46:17 2006
@@ -0,0 +1,56 @@
+/* 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 IncompatibleClassChangeErrorTest extends junit.framework.TestCase {
+
+	/**
+	 * @tests java.lang.IncompatibleClassChangeError#IncompatibleClassChangeError()
+	 */
+	public void test_Constructor() {
+		try {
+			if (true) {
+				throw new IncompatibleClassChangeError();
+			}
+			fail("Error not thrown.");
+		} catch (IncompatibleClassChangeError e) {
+			assertTrue("Wrong message." + e.toString(), e.toString().equals(
+					"java.lang.IncompatibleClassChangeError"));
+		}
+	}
+
+	/**
+	 * @tests java.lang.IncompatibleClassChangeError#IncompatibleClassChangeError(java.lang.String)
+	 */
+	public void test_ConstructorLjava_lang_String() {
+		// Indirect testing done through subclasses.
+		try {
+			if (true)
+				throw new IncompatibleClassChangeError("Hello World");
+		} catch (IncompatibleClassChangeError e) {
+			assertTrue("Wrong message." + e.getMessage(), e.getMessage()
+					.equals("Hello World"));
+		} catch (Exception e) {
+			fail("Exception during test : " + e.getMessage());
+		}
+	}
+
+	protected void setUp() {
+	}
+
+	protected void tearDown() {
+	}
+}

Added: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/IndexOutOfBoundsExceptionTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/IndexOutOfBoundsExceptionTest.java?rev=386058&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/IndexOutOfBoundsExceptionTest.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/IndexOutOfBoundsExceptionTest.java Wed Mar 15 03:46:17 2006
@@ -0,0 +1,73 @@
+/* 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 IndexOutOfBoundsExceptionTest extends junit.framework.TestCase {
+
+	/**
+	 * @tests java.lang.IndexOutOfBoundsException#IndexOutOfBoundsException()
+	 */
+	public void test_Constructor() {
+		// Test for method java.lang.IndexOutOfBoundsException()
+		try {
+			try {
+				byte[] buf = new byte[1];
+				byte z = buf[1];
+				if (z > 0)
+					; // use z to avoid unused var warning
+			} catch (IndexOutOfBoundsException e) {
+				return;
+			}
+			fail("Failed to generate Exception");
+		} catch (Exception e) {
+			fail("Exception during test : " + e.getMessage());
+		}
+	}
+
+	/**
+	 * @tests java.lang.IndexOutOfBoundsException#IndexOutOfBoundsException(java.lang.String)
+	 */
+	public void test_ConstructorLjava_lang_String() {
+		// Test for method java.lang.IndexOutOfBoundsException(java.lang.String)
+		try {
+			try {
+				byte[] buf = new byte[1];
+				byte z = buf[1];
+				if (z > 0)
+					; // use z to avoid warning msg
+			} catch (IndexOutOfBoundsException e) {
+				return;
+			}
+			fail("Failed to generate 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/InheritableThreadLocalTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/InheritableThreadLocalTest.java?rev=386058&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/InheritableThreadLocalTest.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/InheritableThreadLocalTest.java Wed Mar 15 03:46:17 2006
@@ -0,0 +1,44 @@
+/* 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 InheritableThreadLocalTest extends junit.framework.TestCase {
+
+	/**
+	 * @tests java.lang.InheritableThreadLocal#InheritableThreadLocal()
+	 */
+	public void test_Constructor() {
+		// Test for method java.lang.InheritableThreadLocal()
+
+		InheritableThreadLocal l = new InheritableThreadLocal();
+		assertTrue("Failed to create InheritableThreadLocal",
+				l instanceof InheritableThreadLocal);
+	}
+
+	/**
+	 * 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/InstantiationErrorTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/InstantiationErrorTest.java?rev=386058&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/InstantiationErrorTest.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/InstantiationErrorTest.java Wed Mar 15 03:46:17 2006
@@ -0,0 +1,40 @@
+/* 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 InstantiationErrorTest extends junit.framework.TestCase {
+
+	/**
+	 * @tests java.lang.InstantiationError#InstantiationError()
+	 */
+	public void test_Constructor() {
+		try {
+			if (true)
+				throw new InstantiationError();
+		} catch (InstantiationError e) {
+			assertTrue("Error not instantiated correctly: " + e.toString(), e
+					.toString().equals("java.lang.InstantiationError"));
+		} catch (Exception e) {
+			fail("Exception occured during test : " + e.getMessage());
+		}
+	}
+
+	protected void setUp() {
+	}
+
+	protected void tearDown() {
+	}
+}

Added: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/InstantiationExceptionTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/InstantiationExceptionTest.java?rev=386058&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/InstantiationExceptionTest.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/InstantiationExceptionTest.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 InstantiationExceptionTest extends junit.framework.TestCase {
+
+	/**
+	 * @tests java.lang.InstantiationException#InstantiationException()
+	 */
+	public void test_Constructor() {
+		// Test for method java.lang.InstantiationException()
+		try {
+			try {
+				Class cl = null;
+				cl = Class.forName("java.io.OutputStream");
+				cl.newInstance();
+			} catch (InstantiationException e) {
+				return;
+			}
+			fail("Failed to generate Exception");
+		} catch (Exception e) {
+			fail("Exception during test : " + e.getMessage());
+		}
+	}
+
+	/**
+	 * @tests java.lang.InstantiationException#InstantiationException(java.lang.String)
+	 */
+	public void test_ConstructorLjava_lang_String() {
+		// Test for method java.lang.InstantiationException(java.lang.String)
+		try {
+			try {
+				Class cl = null;
+				cl = Class.forName("java.io.OutputStream");
+				cl.newInstance();
+			} catch (InstantiationException e) {
+				return;
+			}
+			fail("Failed to generate 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/IntegerTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/IntegerTest.java?rev=386058&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/IntegerTest.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/IntegerTest.java Wed Mar 15 03:46:17 2006
@@ -0,0 +1,647 @@
+/* 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.util.Properties;
+
+public class IntegerTest extends junit.framework.TestCase {
+
+	Properties orgProps;
+
+	/**
+	 * @tests java.lang.Integer#Integer(int)
+	 */
+	public void test_ConstructorI() {
+		// Test for method java.lang.Integer(int)
+		Integer i = new Integer(-89000);
+		assertTrue("Incorrect Integer created", i.intValue() == -89000);
+	}
+
+	/**
+	 * @tests java.lang.Integer#Integer(java.lang.String)
+	 */
+	public void test_ConstructorLjava_lang_String() {
+		// Test for method java.lang.Integer(java.lang.String)
+		Integer i = new Integer("65000");
+		assertTrue("Created incorrect Integer", i.intValue() == 65000);
+	}
+
+	/**
+	 * @tests java.lang.Integer#byteValue()
+	 */
+	public void test_byteValue() {
+		// Test for method byte java.lang.Integer.byteValue()
+		assertTrue("Returned incorrect byte value", new Integer(65535)
+				.byteValue() == -1);
+		assertTrue("Returned incorrect byte value", new Integer(127)
+				.byteValue() == 127);
+	}
+
+	/**
+	 * @tests java.lang.Integer#compareTo(java.lang.Integer)
+	 */
+	public void test_compareToLjava_lang_Integer() {
+		// Test for method int java.lang.Integer.compareTo(java.lang.Integer)
+		assertTrue("-2 compared to 1 gave non-negative answer", new Integer(-2)
+				.compareTo(new Integer(1)) < 0);
+		assertTrue("-2 compared to -2 gave non-zero answer", new Integer(-2)
+				.compareTo(new Integer(-2)) == 0);
+		assertTrue("3 compared to 2 gave non-positive answer", new Integer(3)
+				.compareTo(new Integer(2)) > 0);
+	}
+
+	/**
+	 * @tests java.lang.Integer#compareTo(java.lang.Object)
+	 */
+	public void test_compareToLjava_lang_Object() {
+		// Test for method int java.lang.Integer.compareTo(java.lang.Object)
+		assertTrue("-2 compared to 1 gave non-negative answer", new Integer(-2)
+				.compareTo((Object) new Integer(1)) < 0);
+		assertTrue("-2 compared to -2 gave non-zero answer", new Integer(-2)
+				.compareTo((Object) new Integer(-2)) == 0);
+		assertTrue("3 compared to 2 gave non-positive answer", new Integer(3)
+				.compareTo((Object) new Integer(2)) > 0);
+		try {
+			new Integer(3).compareTo(new Object());
+		} catch (ClassCastException e) {
+			// correct
+			return;
+		}
+		fail(
+				"3 compared to a non-integer object failed to throw an exception");
+	}
+
+	/**
+	 * @tests java.lang.Integer#decode(java.lang.String)
+	 */
+	public void test_decodeLjava_lang_String() {
+		// Test for method java.lang.Integer
+		// java.lang.Integer.decode(java.lang.String)
+		assertTrue("Failed for 132233",
+				Integer.decode("132233").intValue() == 132233);
+		assertTrue("Failed for 07654321",
+				Integer.decode("07654321").intValue() == 07654321);
+		assertTrue("Failed for #1234567",
+				Integer.decode("#1234567").intValue() == 0x1234567);
+		assertTrue("Failed for 0xdAd",
+				Integer.decode("0xdAd").intValue() == 0xdad);
+		assertTrue("Failed for -23", Integer.decode("-23").intValue() == -23);
+		assertTrue("Returned incorrect value for 0 decimal", Integer
+				.decode("0").intValue() == 0);
+		assertTrue("Returned incorrect value for 0 hex", Integer.decode("0x0")
+				.intValue() == 0);
+		assertTrue("Returned incorrect value for most negative value decimal",
+				Integer.decode("-2147483648").intValue() == 0x80000000);
+		assertTrue("Returned incorrect value for most negative value hex",
+				Integer.decode("-0x80000000").intValue() == 0x80000000);
+		assertTrue("Returned incorrect value for most positive value decimal",
+				Integer.decode("2147483647").intValue() == 0x7fffffff);
+		assertTrue("Returned incorrect value for most positive value hex",
+				Integer.decode("0x7fffffff").intValue() == 0x7fffffff);
+
+		boolean exception = false;
+		try {
+			Integer.decode("0a");
+		} catch (NumberFormatException e) {
+			// correct
+			exception = true;
+		}
+		assertTrue("Failed to throw NumberFormatException for \"Oa\"",
+				exception);
+
+		exception = false;
+		try {
+			Integer.decode("2147483648");
+		} catch (NumberFormatException e) {
+			// Correct
+			exception = true;
+		}
+		assertTrue("Failed to throw exception for MAX_VALUE + 1", exception);
+
+		exception = false;
+		try {
+			Integer.decode("-2147483649");
+		} catch (NumberFormatException e) {
+			// Correct
+			exception = true;
+		}
+		assertTrue("Failed to throw exception for MIN_VALUE - 1", exception);
+
+		exception = false;
+		try {
+			Integer.decode("0x80000000");
+		} catch (NumberFormatException e) {
+			// Correct
+			exception = true;
+		}
+		assertTrue("Failed to throw exception for hex MAX_VALUE + 1", exception);
+
+		exception = false;
+		try {
+			Integer.decode("-0x80000001");
+		} catch (NumberFormatException e) {
+			// Correct
+			exception = true;
+		}
+		assertTrue("Failed to throw exception for hex MIN_VALUE - 1", exception);
+
+		exception = false;
+		try {
+			Integer.decode("9999999999");
+		} catch (NumberFormatException e) {
+			// Correct
+			exception = true;
+		}
+		assertTrue("Failed to throw exception for 9999999999", exception);
+	}
+
+	/**
+	 * @tests java.lang.Integer#doubleValue()
+	 */
+	public void test_doubleValue() {
+		// Test for method double java.lang.Integer.doubleValue()
+		assertTrue("Returned incorrect double value", new Integer(2147483647)
+				.doubleValue() == 2147483647.0);
+		assertTrue("Returned incorrect double value", new Integer(-2147483647)
+				.doubleValue() == -2147483647.0);
+	}
+
+	/**
+	 * @tests java.lang.Integer#equals(java.lang.Object)
+	 */
+	public void test_equalsLjava_lang_Object() {
+		// Test for method boolean java.lang.Integer.equals(java.lang.Object)
+		Integer i1 = new Integer(1000);
+		Integer i2 = new Integer(1000);
+		Integer i3 = new Integer(-1000);
+		assertTrue("Equality test failed", i1.equals(i2) && !(i1.equals(i3)));
+	}
+
+	/**
+	 * @tests java.lang.Integer#floatValue()
+	 */
+	public void test_floatValue() {
+		// Test for method float java.lang.Integer.floatValue()
+		assertTrue("Returned incorrect float value", new Integer(65535)
+				.floatValue() == 65535.0f);
+		assertTrue("Returned incorrect float value", new Integer(-65535)
+				.floatValue() == -65535.0f);
+	}
+
+	/**
+	 * @tests java.lang.Integer#getInteger(java.lang.String)
+	 */
+	public void test_getIntegerLjava_lang_String() {
+		// Test for method java.lang.Integer
+		// java.lang.Integer.getInteger(java.lang.String)
+		Properties tProps = new Properties();
+		tProps.put("testInt", "99");
+		System.setProperties(tProps);
+		assertTrue("returned incorrect Integer", Integer.getInteger("testInt")
+				.equals(new Integer(99)));
+		assertTrue("returned incorrect default Integer", Integer
+				.getInteger("ff") == null);
+	}
+
+	/**
+	 * @tests java.lang.Integer#getInteger(java.lang.String, int)
+	 */
+	public void test_getIntegerLjava_lang_StringI() {
+		// Test for method java.lang.Integer
+		// java.lang.Integer.getInteger(java.lang.String, int)
+		Properties tProps = new Properties();
+		tProps.put("testInt", "99");
+		System.setProperties(tProps);
+		assertTrue("returned incorrect Integer", Integer.getInteger("testInt",
+				4).equals(new Integer(99)));
+		assertTrue("returned incorrect default Integer", Integer.getInteger(
+				"ff", 4).equals(new Integer(4)));
+	}
+
+	/**
+	 * @tests java.lang.Integer#getInteger(java.lang.String, java.lang.Integer)
+	 */
+	public void test_getIntegerLjava_lang_StringLjava_lang_Integer() {
+		// Test for method java.lang.Integer
+		// java.lang.Integer.getInteger(java.lang.String, java.lang.Integer)
+		Properties tProps = new Properties();
+		tProps.put("testInt", "99");
+		System.setProperties(tProps);
+		assertTrue("returned incorrect Integer", Integer.getInteger("testInt",
+				new Integer(4)).equals(new Integer(99)));
+		assertTrue("returned incorrect default Integer", Integer.getInteger(
+				"ff", new Integer(4)).equals(new Integer(4)));
+	}
+
+	/**
+	 * @tests java.lang.Integer#hashCode()
+	 */
+	public void test_hashCode() {
+		// Test for method int java.lang.Integer.hashCode()
+
+		Integer i1 = new Integer(1000);
+		Integer i2 = new Integer(-1000);
+		assertTrue("Returned incorrect hashcode", i1.hashCode() == 1000
+				&& (i2.hashCode() == -1000));
+	}
+
+	/**
+	 * @tests java.lang.Integer#intValue()
+	 */
+	public void test_intValue() {
+		// Test for method int java.lang.Integer.intValue()
+
+		Integer i = new Integer(8900);
+		assertTrue("Returned incorrect int value", i.intValue() == 8900);
+	}
+
+	/**
+	 * @tests java.lang.Integer#longValue()
+	 */
+	public void test_longValue() {
+		// Test for method long java.lang.Integer.longValue()
+		Integer i = new Integer(8900);
+		assertTrue("Returned incorrect long value", i.longValue() == 8900L);
+	}
+
+	/**
+	 * @tests java.lang.Integer#parseInt(java.lang.String)
+	 */
+	public void test_parseIntLjava_lang_String() {
+		// Test for method int java.lang.Integer.parseInt(java.lang.String)
+
+		int i = Integer.parseInt("-8900");
+		assertTrue("Returned incorrect int", i == -8900);
+		assertTrue("Returned incorrect value for 0", Integer.parseInt("0") == 0);
+		assertTrue("Returned incorrect value for most negative value", Integer
+				.parseInt("-2147483648") == 0x80000000);
+		assertTrue("Returned incorrect value for most positive value", Integer
+				.parseInt("2147483647") == 0x7fffffff);
+
+		boolean exception = false;
+		try {
+			Integer.parseInt("999999999999");
+		} catch (NumberFormatException e) {
+			// Correct
+			exception = true;
+		}
+		assertTrue("Failed to throw exception for value > int", exception);
+
+		exception = false;
+		try {
+			Integer.parseInt("2147483648");
+		} catch (NumberFormatException e) {
+			// Correct
+			exception = true;
+		}
+		assertTrue("Failed to throw exception for MAX_VALUE + 1", exception);
+
+		exception = false;
+		try {
+			Integer.parseInt("-2147483649");
+		} catch (NumberFormatException e) {
+			// Correct
+			exception = true;
+		}
+		assertTrue("Failed to throw exception for MIN_VALUE - 1", exception);
+	}
+
+	/**
+	 * @tests java.lang.Integer#parseInt(java.lang.String, int)
+	 */
+	public void test_parseIntLjava_lang_StringI() {
+		// Test for method int java.lang.Integer.parseInt(java.lang.String, int)
+		assertTrue("Parsed dec val incorrectly",
+				Integer.parseInt("-8000", 10) == -8000);
+		assertTrue("Parsed hex val incorrectly",
+				Integer.parseInt("FF", 16) == 255);
+		assertTrue("Parsed oct val incorrectly",
+				Integer.parseInt("20", 8) == 16);
+		assertTrue("Returned incorrect value for 0 hex", Integer.parseInt("0",
+				16) == 0);
+		assertTrue("Returned incorrect value for most negative value hex",
+				Integer.parseInt("-80000000", 16) == 0x80000000);
+		assertTrue("Returned incorrect value for most positive value hex",
+				Integer.parseInt("7fffffff", 16) == 0x7fffffff);
+		assertTrue("Returned incorrect value for 0 decimal", Integer.parseInt(
+				"0", 10) == 0);
+		assertTrue("Returned incorrect value for most negative value decimal",
+				Integer.parseInt("-2147483648", 10) == 0x80000000);
+		assertTrue("Returned incorrect value for most positive value decimal",
+				Integer.parseInt("2147483647", 10) == 0x7fffffff);
+
+		boolean exception = false;
+		try {
+			Integer.parseInt("FFFF", 10);
+		} catch (NumberFormatException e) {
+			// Correct
+			exception = true;
+		}
+		assertTrue(
+				"Failed to throw exception when passes hex string and dec parm",
+				exception);
+
+		exception = false;
+		try {
+			Integer.parseInt("2147483648", 10);
+		} catch (NumberFormatException e) {
+			// Correct
+			exception = true;
+		}
+		assertTrue("Failed to throw exception for MAX_VALUE + 1", exception);
+
+		exception = false;
+		try {
+			Integer.parseInt("-2147483649", 10);
+		} catch (NumberFormatException e) {
+			// Correct
+			exception = true;
+		}
+		assertTrue("Failed to throw exception for MIN_VALUE - 1", exception);
+
+		exception = false;
+		try {
+			Integer.parseInt("80000000", 16);
+		} catch (NumberFormatException e) {
+			// Correct
+			exception = true;
+		}
+		assertTrue("Failed to throw exception for hex MAX_VALUE + 1", exception);
+
+		exception = false;
+		try {
+			Integer.parseInt("-80000001", 16);
+		} catch (NumberFormatException e) {
+			// Correct
+			exception = true;
+		}
+		assertTrue("Failed to throw exception for hex MIN_VALUE + 1", exception);
+
+		exception = false;
+		try {
+			Integer.parseInt("9999999999", 10);
+		} catch (NumberFormatException e) {
+			// Correct
+			exception = true;
+		}
+		assertTrue("Failed to throw exception for 9999999999", exception);
+	}
+
+	/**
+	 * @tests java.lang.Integer#shortValue()
+	 */
+	public void test_shortValue() {
+		// Test for method short java.lang.Integer.shortValue()
+		Integer i = new Integer(2147450880);
+		assertTrue("Returned incorrect long value", i.shortValue() == -32768);
+	}
+
+	/**
+	 * @tests java.lang.Integer#toBinaryString(int)
+	 */
+	public void test_toBinaryStringI() {
+		// Test for method java.lang.String
+		// java.lang.Integer.toBinaryString(int)
+		assertTrue("Incorrect string returned", Integer.toBinaryString(
+				Integer.MAX_VALUE).equals("1111111111111111111111111111111"));
+		assertTrue("Incorrect string returned", Integer.toBinaryString(
+				Integer.MIN_VALUE).equals("10000000000000000000000000000000"));
+	}
+
+	/**
+	 * @tests java.lang.Integer#toHexString(int)
+	 */
+	public void test_toHexStringI() {
+		// Test for method java.lang.String java.lang.Integer.toHexString(int)
+
+		String[] hexvals = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9",
+				"a", "b", "c", "d", "e", "f" };
+
+		for (int i = 0; i < 16; i++)
+			assertTrue("Incorrect string returned " + hexvals[i], Integer
+					.toHexString(i).equals(hexvals[i]));
+
+		assertTrue("Returned incorrect hex string: "
+				+ Integer.toHexString(Integer.MAX_VALUE), Integer.toHexString(
+				Integer.MAX_VALUE).equals("7fffffff"));
+		assertTrue("Returned incorrect hex string: "
+				+ Integer.toHexString(Integer.MIN_VALUE), Integer.toHexString(
+				Integer.MIN_VALUE).equals("80000000"));
+	}
+
+	/**
+	 * @tests java.lang.Integer#toOctalString(int)
+	 */
+	public void test_toOctalStringI() {
+		// Test for method java.lang.String java.lang.Integer.toOctalString(int)
+		// Spec states that the int arg is treated as unsigned
+		assertTrue("Returned incorrect octal string", Integer.toOctalString(
+				Integer.MAX_VALUE).equals("17777777777"));
+		assertTrue("Returned incorrect octal string", Integer.toOctalString(
+				Integer.MIN_VALUE).equals("20000000000"));
+	}
+
+	/**
+	 * @tests java.lang.Integer#toString()
+	 */
+	public void test_toString() {
+		// Test for method java.lang.String java.lang.Integer.toString()
+
+		Integer i = new Integer(-80001);
+
+		assertTrue("Returned incorrect String", i.toString().equals("-80001"));
+	}
+
+	/**
+	 * @tests java.lang.Integer#toString(int)
+	 */
+	public void test_toStringI() {
+		// Test for method java.lang.String java.lang.Integer.toString(int)
+
+		assertTrue("Returned incorrect String", Integer.toString(-80765)
+				.equals("-80765"));
+		assertTrue("Returned incorrect octal string", Integer.toString(
+				Integer.MAX_VALUE).equals("2147483647"));
+		assertTrue("Returned incorrect octal string", Integer.toString(
+				-Integer.MAX_VALUE).equals("-2147483647"));
+		assertTrue("Returned incorrect octal string", Integer.toString(
+				Integer.MIN_VALUE).equals("-2147483648"));
+	}
+
+	/**
+	 * @tests java.lang.Integer#toString(int, int)
+	 */
+	public void test_toStringII() {
+		// Test for method java.lang.String java.lang.Integer.toString(int, int)
+		assertTrue("Returned incorrect octal string", Integer.toString(
+				2147483647, 8).equals("17777777777"));
+		assertTrue("Returned incorrect hex string--wanted 7fffffff but got: "
+				+ Integer.toString(2147483647, 16), Integer.toString(
+				2147483647, 16).equals("7fffffff"));
+		assertTrue("Incorrect string returned", Integer.toString(2147483647, 2)
+				.equals("1111111111111111111111111111111"));
+		assertTrue("Incorrect string returned", Integer
+				.toString(2147483647, 10).equals("2147483647"));
+
+		assertTrue("Returned incorrect octal string", Integer.toString(
+				-2147483647, 8).equals("-17777777777"));
+		assertTrue("Returned incorrect hex string--wanted -7fffffff but got: "
+				+ Integer.toString(-2147483647, 16), Integer.toString(
+				-2147483647, 16).equals("-7fffffff"));
+		assertTrue("Incorrect string returned", Integer
+				.toString(-2147483647, 2).equals(
+						"-1111111111111111111111111111111"));
+		assertTrue("Incorrect string returned", Integer.toString(-2147483647,
+				10).equals("-2147483647"));
+
+		assertTrue("Returned incorrect octal string", Integer.toString(
+				-2147483648, 8).equals("-20000000000"));
+		assertTrue("Returned incorrect hex string--wanted -80000000 but got: "
+				+ Integer.toString(-2147483648, 16), Integer.toString(
+				-2147483648, 16).equals("-80000000"));
+		assertTrue("Incorrect string returned", Integer
+				.toString(-2147483648, 2).equals(
+						"-10000000000000000000000000000000"));
+		assertTrue("Incorrect string returned", Integer.toString(-2147483648,
+				10).equals("-2147483648"));
+	}
+
+	/**
+	 * @tests java.lang.Integer#valueOf(java.lang.String)
+	 */
+	public void test_valueOfLjava_lang_String() {
+		// Test for method java.lang.Integer
+		// java.lang.Integer.valueOf(java.lang.String)
+		assertTrue("Returned incorrect int", Integer.valueOf("8888888")
+				.intValue() == 8888888);
+		assertTrue("Returned incorrect int", Integer.valueOf("2147483647")
+				.intValue() == Integer.MAX_VALUE);
+		assertTrue("Returned incorrect int", Integer.valueOf("-2147483648")
+				.intValue() == Integer.MIN_VALUE);
+
+		boolean exception = false;
+		try {
+			Integer.valueOf("2147483648");
+		} catch (NumberFormatException e) {
+			// Correct
+			exception = true;
+		}
+		assertTrue("Failed to throw exception with MAX_VALUE + 1", exception);
+
+		exception = false;
+		try {
+			Integer.valueOf("-2147483649");
+		} catch (NumberFormatException e) {
+			// Correct
+			exception = true;
+		}
+		assertTrue("Failed to throw exception with MIN_VALUE - 1", exception);
+	}
+
+	/**
+	 * @tests java.lang.Integer#valueOf(java.lang.String, int)
+	 */
+	public void test_valueOfLjava_lang_StringI() {
+		// Test for method java.lang.Integer
+		// java.lang.Integer.valueOf(java.lang.String, int)
+		assertTrue("Returned incorrect int for hex string", Integer.valueOf(
+				"FF", 16).intValue() == 255);
+		assertTrue("Returned incorrect int for oct string", Integer.valueOf(
+				"20", 8).intValue() == 16);
+		assertTrue("Returned incorrect int for bin string", Integer.valueOf(
+				"100", 2).intValue() == 4);
+
+		assertTrue("Returned incorrect int for - hex string", Integer.valueOf(
+				"-FF", 16).intValue() == -255);
+		assertTrue("Returned incorrect int for - oct string", Integer.valueOf(
+				"-20", 8).intValue() == -16);
+		assertTrue("Returned incorrect int for - bin string", Integer.valueOf(
+				"-100", 2).intValue() == -4);
+		assertTrue("Returned incorrect int", Integer.valueOf("2147483647", 10)
+				.intValue() == Integer.MAX_VALUE);
+		assertTrue("Returned incorrect int", Integer.valueOf("-2147483648", 10)
+				.intValue() == Integer.MIN_VALUE);
+		assertTrue("Returned incorrect int", Integer.valueOf("7fffffff", 16)
+				.intValue() == Integer.MAX_VALUE);
+		assertTrue("Returned incorrect int", Integer.valueOf("-80000000", 16)
+				.intValue() == Integer.MIN_VALUE);
+
+		boolean exception = false;
+		try {
+			Integer.valueOf("FF", 2);
+		} catch (NumberFormatException e) {
+			// Correct
+			exception = true;
+		}
+		assertTrue(
+				"Failed to throw exception with hex string and base 2 radix",
+				exception);
+
+		exception = false;
+		try {
+			Integer.valueOf("2147483648", 10);
+		} catch (NumberFormatException e) {
+			// Correct
+			exception = true;
+		}
+		assertTrue("Failed to throw exception with MAX_VALUE + 1", exception);
+
+		exception = false;
+		try {
+			Integer.valueOf("-2147483649", 10);
+		} catch (NumberFormatException e) {
+			// Correct
+			exception = true;
+		}
+		assertTrue("Failed to throw exception with MIN_VALUE - 1", exception);
+
+		exception = false;
+		try {
+			Integer.valueOf("80000000", 16);
+		} catch (NumberFormatException e) {
+			// Correct
+			exception = true;
+		}
+		assertTrue("Failed to throw exception with hex MAX_VALUE + 1",
+				exception);
+
+		exception = false;
+		try {
+			Integer.valueOf("-80000001", 16);
+		} catch (NumberFormatException e) {
+			// Correct
+			exception = true;
+		}
+		assertTrue("Failed to throw exception with hex MIN_VALUE - 1",
+				exception);
+	}
+
+	/**
+	 * Sets up the fixture, for example, open a network connection. This method
+	 * is called before a test is executed.
+	 */
+	protected void setUp() {
+		orgProps = System.getProperties();
+	}
+
+	/**
+	 * Tears down the fixture, for example, close a network connection. This
+	 * method is called after a test is executed.
+	 */
+	protected void tearDown() {
+		System.setProperties(orgProps);
+	}
+}

Added: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/InternalErrorTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/InternalErrorTest.java?rev=386058&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/InternalErrorTest.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/InternalErrorTest.java Wed Mar 15 03:46:17 2006
@@ -0,0 +1,64 @@
+/* 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 InternalErrorTest extends junit.framework.TestCase {
+
+	/**
+	 * @tests java.lang.InternalError#InternalError()
+	 */
+	public void test_Constructor() {
+		// Test for method java.lang.InternalError()
+		// TODO : How do you create an actual InternalError ?
+		try {
+			if (true)
+				throw new InternalError();
+		} catch (InternalError e) {
+			return;
+		}
+		fail("Failed to throw Runtime Exception");
+	}
+
+	/**
+	 * @tests java.lang.InternalError#InternalError(java.lang.String)
+	 */
+	public void test_ConstructorLjava_lang_String() {
+		// Test for method java.lang.InternalError(java.lang.String)
+		try {
+			if (true)
+				throw new InternalError("Test");
+		} catch (InternalError e) {
+			assertTrue("Returned incorrect message", e.getMessage().equals(
+					"Test"));
+			return;
+		}
+		fail("Failed to throw Runtime 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/InterruptedExceptionTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/InterruptedExceptionTest.java?rev=386058&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/InterruptedExceptionTest.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/InterruptedExceptionTest.java Wed Mar 15 03:46:17 2006
@@ -0,0 +1,64 @@
+/* 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 InterruptedExceptionTest extends junit.framework.TestCase {
+
+	/**
+	 * @tests java.lang.InterruptedException#InterruptedException()
+	 */
+	public void test_Constructor() {
+		// Test for method java.lang.InterruptedException()
+		try {
+			throw new InterruptedException();
+		} catch (InterruptedException e) {
+			return;
+		} catch (Exception e) {
+			fail("Exception during InterruptedException() test"
+					+ e.toString());
+		}
+		fail("Failed to generate Exception");
+	}
+
+	/**
+	 * @tests java.lang.InterruptedException#InterruptedException(java.lang.String)
+	 */
+	public void test_ConstructorLjava_lang_String() {
+		// Test for method java.lang.InterruptedException(java.lang.String)
+		try {
+			throw new InterruptedException("Message");
+		} catch (InterruptedException e) {
+			return;
+		} catch (Exception e) {
+			fail("Exception during InterruptedException(String) test");
+		}
+		fail("Failed to generate 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/LinkageErrorTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/LinkageErrorTest.java?rev=386058&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/LinkageErrorTest.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/LinkageErrorTest.java Wed Mar 15 03:46:17 2006
@@ -0,0 +1,56 @@
+/* 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 LinkageErrorTest extends junit.framework.TestCase {
+
+	/**
+	 * @tests java.lang.LinkageError#LinkageError()
+	 */
+	public void test_Constructor() {
+		try {
+			if (true) {
+				throw new LinkageError();
+			}
+			fail("Error not thrown.");
+		} catch (LinkageError e) {
+			assertTrue("Error not initialized.", e.toString().equals(
+					"java.lang.LinkageError"));
+		}
+	}
+
+	/**
+	 * @tests java.lang.LinkageError#LinkageError(java.lang.String)
+	 */
+	public void test_ConstructorLjava_lang_String() {
+		// Indirect testing is done for subclasses.
+		try {
+			if (true) {
+				throw new LinkageError("Hello World");
+			}
+			fail("Error not thrown.");
+		} catch (LinkageError e) {
+			assertTrue("Wrong error message: " + e.getMessage(), e.getMessage()
+					.equals("Hello World"));
+		}
+	}
+
+	protected void setUp() {
+	}
+
+	protected void tearDown() {
+	}
+}

Added: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/LongTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/LongTest.java?rev=386058&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/LongTest.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/LongTest.java Wed Mar 15 03:46:17 2006
@@ -0,0 +1,628 @@
+/* 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.util.Properties;
+
+public class LongTest extends junit.framework.TestCase {
+
+	Properties orgProps;
+
+	/**
+	 * @tests java.lang.Long#Long(long)
+	 */
+	public void test_ConstructorJ() {
+		// Test for method java.lang.Long(long)
+
+		Long l = new Long(-8900000006L);
+		assertTrue("Created incorrect Long", l.longValue() == -8900000006L);
+	}
+
+	/**
+	 * @tests java.lang.Long#Long(java.lang.String)
+	 */
+	public void test_ConstructorLjava_lang_String() {
+		// Test for method java.lang.Long(java.lang.String)
+
+		Long l = new Long("-8900000006");
+		assertTrue("Created incorrect Long", l.longValue() == -8900000006L);
+	}
+
+	/**
+	 * @tests java.lang.Long#byteValue()
+	 */
+	public void test_byteValue() {
+		// Test for method byte java.lang.Long.byteValue()
+		Long l = new Long(127);
+		assertTrue("Returned incorrect byte value", l.byteValue() == 127);
+		assertTrue("Returned incorrect byte value", new Long(Long.MAX_VALUE)
+				.byteValue() == -1);
+	}
+
+	/**
+	 * @tests java.lang.Long#compareTo(java.lang.Long)
+	 */
+	public void test_compareToLjava_lang_Long() {
+		// Test for method int java.lang.Long.compareTo(java.lang.Long)
+		assertTrue("-2 compared to 1 gave non-negative answer", new Long(-2L)
+				.compareTo(new Long(1L)) < 0);
+		assertTrue("-2 compared to -2 gave non-zero answer", new Long(-2L)
+				.compareTo(new Long(-2L)) == 0);
+		assertTrue("3 compared to 2 gave non-positive answer", new Long(3L)
+				.compareTo(new Long(2L)) > 0);
+	}
+
+	/**
+	 * @tests java.lang.Long#compareTo(java.lang.Object)
+	 */
+	public void test_compareToLjava_lang_Object() {
+		// Test for method int java.lang.Long.compareTo(java.lang.Object)
+		assertTrue("-2 compared to 1 gave non-negative answer", new Long(-2L)
+				.compareTo((Object) new Long(1L)) < 0);
+		assertTrue("-2 compared to -2 gave non-zero answer", new Long(-2L)
+				.compareTo((Object) new Long(-2L)) == 0);
+		assertTrue("3 compared to 2 gave non-positive answer", new Long(3L)
+				.compareTo((Object) new Long(2L)) > 0);
+		try {
+			new Long(3).compareTo(new Object());
+		} catch (ClassCastException e) {
+			// correct
+			return;
+		}
+		fail(
+				"3 compared to a non-integer object failed to throw an exception");
+	}
+
+	/**
+	 * @tests java.lang.Long#decode(java.lang.String)
+	 */
+	public void test_decodeLjava_lang_String() {
+		// Test for method java.lang.Long
+		// java.lang.Long.decode(java.lang.String)
+		assertTrue("Returned incorrect value for hex string", Long.decode(
+				"0xFF").longValue() == 255L);
+		assertTrue("Returned incorrect value for dec string", Long.decode(
+				"-89000").longValue() == -89000L);
+		assertTrue("Returned incorrect value for 0 decimal", Long.decode("0")
+				.longValue() == 0);
+		assertTrue("Returned incorrect value for 0 hex", Long.decode("0x0")
+				.longValue() == 0);
+		assertTrue(
+				"Returned incorrect value for most negative value decimal",
+				Long.decode("-9223372036854775808").longValue() == 0x8000000000000000L);
+		assertTrue(
+				"Returned incorrect value for most negative value hex",
+				Long.decode("-0x8000000000000000").longValue() == 0x8000000000000000L);
+		assertTrue(
+				"Returned incorrect value for most positive value decimal",
+				Long.decode("9223372036854775807").longValue() == 0x7fffffffffffffffL);
+		assertTrue(
+				"Returned incorrect value for most positive value hex",
+				Long.decode("0x7fffffffffffffff").longValue() == 0x7fffffffffffffffL);
+		assertTrue("Failed for 07654321765432", Long.decode("07654321765432")
+				.longValue() == 07654321765432l);
+
+		boolean exception = false;
+		try {
+			Long
+					.decode("999999999999999999999999999999999999999999999999999999");
+		} catch (NumberFormatException e) {
+			// Correct
+			exception = true;
+		}
+		assertTrue("Failed to throw exception for value > ilong", exception);
+
+		exception = false;
+		try {
+			Long.decode("9223372036854775808");
+		} catch (NumberFormatException e) {
+			// Correct
+			exception = true;
+		}
+		assertTrue("Failed to throw exception for MAX_VALUE + 1", exception);
+
+		exception = false;
+		try {
+			Long.decode("-9223372036854775809");
+		} catch (NumberFormatException e) {
+			// Correct
+			exception = true;
+		}
+		assertTrue("Failed to throw exception for MIN_VALUE - 1", exception);
+
+		exception = false;
+		try {
+			Long.decode("0x8000000000000000");
+		} catch (NumberFormatException e) {
+			// Correct
+			exception = true;
+		}
+		assertTrue("Failed to throw exception for hex MAX_VALUE + 1", exception);
+
+		exception = false;
+		try {
+			Long.decode("-0x8000000000000001");
+		} catch (NumberFormatException e) {
+			// Correct
+			exception = true;
+		}
+		assertTrue("Failed to throw exception for hex MIN_VALUE - 1", exception);
+
+		exception = false;
+		try {
+			Long.decode("42325917317067571199");
+		} catch (NumberFormatException e) {
+			// Correct
+			exception = true;
+		}
+		assertTrue("Failed to throw exception for 42325917317067571199",
+				exception);
+	}
+
+	/**
+	 * @tests java.lang.Long#doubleValue()
+	 */
+	public void test_doubleValue() {
+		// Test for method double java.lang.Long.doubleValue()
+		Long l = new Long(10000000);
+		assertTrue("Returned incorrect double value",
+				l.doubleValue() == 10000000.0);
+
+	}
+
+	/**
+	 * @tests java.lang.Long#equals(java.lang.Object)
+	 */
+	public void test_equalsLjava_lang_Object() {
+		// Test for method boolean java.lang.Long.equals(java.lang.Object)
+
+		Long l = new Long(80000006777L);
+		Long l2 = new Long(80000006777L);
+		Long l3 = new Long(806777L);
+		assertTrue("Equality test failed", l.equals(l2) && !(l.equals(l3)));
+	}
+
+	/**
+	 * @tests java.lang.Long#floatValue()
+	 */
+	public void test_floatValue() {
+		// Test for method float java.lang.Long.floatValue()
+		Long l = new Long(100000);
+		assertTrue("Returned incorrect float value: " + l.floatValue(), l
+				.floatValue() == 100000f);
+	}
+
+	/**
+	 * @tests java.lang.Long#getLong(java.lang.String)
+	 */
+	public void test_getLongLjava_lang_String() {
+		// Test for method java.lang.Long
+		// java.lang.Long.getLong(java.lang.String)
+		Properties tProps = new Properties();
+		tProps.put("testLong", "99");
+		System.setProperties(tProps);
+		assertTrue("returned incorrect Long", Long.getLong("testLong").equals(
+				new Long(99)));
+		assertTrue("returned incorrect default Long",
+				Long.getLong("ff") == null);
+	}
+
+	/**
+	 * @tests java.lang.Long#getLong(java.lang.String, long)
+	 */
+	public void test_getLongLjava_lang_StringJ() {
+		// Test for method java.lang.Long
+		// java.lang.Long.getLong(java.lang.String, long)
+		Properties tProps = new Properties();
+		tProps.put("testLong", "99");
+		System.setProperties(tProps);
+		assertTrue("returned incorrect Long", Long.getLong("testLong", 4L)
+				.equals(new Long(99)));
+		assertTrue("returned incorrect default Long", Long.getLong("ff", 4L)
+				.equals(new Long(4)));
+	}
+
+	/**
+	 * @tests java.lang.Long#getLong(java.lang.String, java.lang.Long)
+	 */
+	public void test_getLongLjava_lang_StringLjava_lang_Long() {
+		// Test for method java.lang.Long
+		// java.lang.Long.getLong(java.lang.String, java.lang.Long)
+		Properties tProps = new Properties();
+		tProps.put("testLong", "99");
+		System.setProperties(tProps);
+		assertTrue("returned incorrect Long", Long.getLong("testLong",
+				new Long(4)).equals(new Long(99)));
+		assertTrue("returned incorrect default Long", Long.getLong("ff",
+				new Long(4)).equals(new Long(4)));
+	}
+
+	/**
+	 * @tests java.lang.Long#hashCode()
+	 */
+	public void test_hashCode() {
+		// Test for method int java.lang.Long.hashCode()
+
+		Long l = new Long(Long.MAX_VALUE);
+		Long l2 = new Long(89000L);
+		// hashCode is implemented as val ^ (val>>>32)
+		// for max int this is 7fffffffffffffff ^ 000000007fffffff
+		// result is the low 32 of 7fffffff80000000
+		assertTrue("Returned invalid hashcode", l.hashCode() == 0x80000000
+				&& (l2.hashCode() == 89000));
+	}
+
+	/**
+	 * @tests java.lang.Long#intValue()
+	 */
+	public void test_intValue() {
+		// Test for method int java.lang.Long.intValue()
+		Long l = new Long(100000);
+		assertTrue("Returned incorrect int value", l.intValue() == 100000);
+		assertTrue("Returned incorrect int value", new Long(Long.MAX_VALUE)
+				.intValue() == -1);
+	}
+
+	/**
+	 * @tests java.lang.Long#longValue()
+	 */
+	public void test_longValue() {
+		// Test for method long java.lang.Long.longValue()
+		Long l = new Long(89000000005L);
+		assertTrue("Returned incorrect long value",
+				l.longValue() == 89000000005L);
+	}
+
+	/**
+	 * @tests java.lang.Long#parseLong(java.lang.String)
+	 */
+	public void test_parseLongLjava_lang_String() {
+		// Test for method long java.lang.Long.parseLong(java.lang.String)
+
+		long l = Long.parseLong("89000000005");
+		assertTrue("Parsed to incorrect long value", l == 89000000005L);
+		assertTrue("Returned incorrect value for 0", Long.parseLong("0") == 0);
+		assertTrue("Returned incorrect value for most negative value", Long
+				.parseLong("-9223372036854775808") == 0x8000000000000000L);
+		assertTrue("Returned incorrect value for most positive value", Long
+				.parseLong("9223372036854775807") == 0x7fffffffffffffffL);
+
+		boolean exception = false;
+		try {
+			Long.parseLong("9223372036854775808");
+		} catch (NumberFormatException e) {
+			// Correct
+			exception = true;
+		}
+		assertTrue("Failed to throw exception for MAX_VALUE + 1", exception);
+
+		exception = false;
+		try {
+			Long.parseLong("-9223372036854775809");
+		} catch (NumberFormatException e) {
+			// Correct
+			exception = true;
+		}
+		assertTrue("Failed to throw exception for MIN_VALUE - 1", exception);
+	}
+
+	/**
+	 * @tests java.lang.Long#parseLong(java.lang.String, int)
+	 */
+	public void test_parseLongLjava_lang_StringI() {
+		// Test for method long java.lang.Long.parseLong(java.lang.String, int)
+		assertTrue("Returned incorrect value",
+				Long.parseLong("100000000", 10) == 100000000L);
+		assertTrue("Returned incorrect value from hex string", Long.parseLong(
+				"FFFFFFFFF", 16) == 68719476735L);
+		assertTrue("Returned incorrect value from octal string: "
+				+ Long.parseLong("77777777777"), Long.parseLong("77777777777",
+				8) == 8589934591L);
+		assertTrue("Returned incorrect value for 0 hex", Long
+				.parseLong("0", 16) == 0);
+		assertTrue("Returned incorrect value for most negative value hex", Long
+				.parseLong("-8000000000000000", 16) == 0x8000000000000000L);
+		assertTrue("Returned incorrect value for most positive value hex", Long
+				.parseLong("7fffffffffffffff", 16) == 0x7fffffffffffffffL);
+		assertTrue("Returned incorrect value for 0 decimal", Long.parseLong(
+				"0", 10) == 0);
+		assertTrue(
+				"Returned incorrect value for most negative value decimal",
+				Long.parseLong("-9223372036854775808", 10) == 0x8000000000000000L);
+		assertTrue(
+				"Returned incorrect value for most positive value decimal",
+				Long.parseLong("9223372036854775807", 10) == 0x7fffffffffffffffL);
+
+		boolean exception = false;
+		try {
+			Long.parseLong("999999999999", 8);
+		} catch (NumberFormatException e) {
+			// correct
+			exception = true;
+		}
+		assertTrue("Failed to throw exception when passed invalid string",
+				exception);
+
+		exception = false;
+		try {
+			Long.parseLong("9223372036854775808", 10);
+		} catch (NumberFormatException e) {
+			// Correct
+			exception = true;
+		}
+		assertTrue("Failed to throw exception for MAX_VALUE + 1", exception);
+
+		exception = false;
+		try {
+			Long.parseLong("-9223372036854775809", 10);
+		} catch (NumberFormatException e) {
+			// Correct
+			exception = true;
+		}
+		assertTrue("Failed to throw exception for MIN_VALUE - 1", exception);
+
+		exception = false;
+		try {
+			Long.parseLong("8000000000000000", 16);
+		} catch (NumberFormatException e) {
+			// Correct
+			exception = true;
+		}
+		assertTrue("Failed to throw exception for hex MAX_VALUE + 1", exception);
+
+		exception = false;
+		try {
+			Long.parseLong("-8000000000000001", 16);
+		} catch (NumberFormatException e) {
+			// Correct
+			exception = true;
+		}
+		assertTrue("Failed to throw exception for hex MIN_VALUE + 1", exception);
+
+		exception = false;
+		try {
+			Long.parseLong("42325917317067571199", 10);
+		} catch (NumberFormatException e) {
+			// Correct
+			exception = true;
+		}
+		assertTrue("Failed to throw exception for 42325917317067571199",
+				exception);
+	}
+
+	/**
+	 * @tests java.lang.Long#shortValue()
+	 */
+	public void test_shortValue() {
+		// Test for method short java.lang.Long.shortValue()
+		Long l = new Long(10000);
+		assertTrue("Returned incorrect short value", l.shortValue() == 10000);
+		assertTrue("Returned incorrect short value", new Long(Long.MAX_VALUE)
+				.shortValue() == -1);
+	}
+
+	/**
+	 * @tests java.lang.Long#toBinaryString(long)
+	 */
+	public void test_toBinaryStringJ() {
+		// Test for method java.lang.String java.lang.Long.toBinaryString(long)
+		assertTrue("Incorrect binary string returned", Long.toBinaryString(
+				890000L).equals("11011001010010010000"));
+		assertTrue(
+				"Incorrect binary string returned",
+				Long
+						.toBinaryString(Long.MIN_VALUE)
+						.equals(
+								"1000000000000000000000000000000000000000000000000000000000000000"));
+		assertTrue(
+				"Incorrect binary string returned",
+				Long
+						.toBinaryString(Long.MAX_VALUE)
+						.equals(
+								"111111111111111111111111111111111111111111111111111111111111111"));
+	}
+
+	/**
+	 * @tests java.lang.Long#toHexString(long)
+	 */
+	public void test_toHexStringJ() {
+		// Test for method java.lang.String java.lang.Long.toHexString(long)
+		assertTrue("Incorrect hex string returned", Long.toHexString(89000005L)
+				.equals("54e0845"));
+		assertTrue("Incorrect hex string returned", Long.toHexString(
+				Long.MIN_VALUE).equals("8000000000000000"));
+		assertTrue("Incorrect hex string returned", Long.toHexString(
+				Long.MAX_VALUE).equals("7fffffffffffffff"));
+	}
+
+	/**
+	 * @tests java.lang.Long#toOctalString(long)
+	 */
+	public void test_toOctalStringJ() {
+		// Test for method java.lang.String java.lang.Long.toOctalString(long)
+		assertTrue("Returned incorrect oct string", Long.toOctalString(
+				8589934591L).equals("77777777777"));
+		assertTrue("Returned incorrect oct string", Long.toOctalString(
+				Long.MIN_VALUE).equals("1000000000000000000000"));
+		assertTrue("Returned incorrect oct string", Long.toOctalString(
+				Long.MAX_VALUE).equals("777777777777777777777"));
+	}
+
+	/**
+	 * @tests java.lang.Long#toString()
+	 */
+	public void test_toString() {
+		// Test for method java.lang.String java.lang.Long.toString()
+		Long l = new Long(89000000005L);
+		assertTrue("Returned incorrect String", l.toString().equals(
+				"89000000005"));
+		assertTrue("Returned incorrect String", new Long(Long.MIN_VALUE)
+				.toString().equals("-9223372036854775808"));
+		assertTrue("Returned incorrect String", new Long(Long.MAX_VALUE)
+				.toString().equals("9223372036854775807"));
+	}
+
+	/**
+	 * @tests java.lang.Long#toString(long)
+	 */
+	public void test_toStringJ() {
+		// Test for method java.lang.String java.lang.Long.toString(long)
+
+		assertTrue("Returned incorrect String", Long.toString(89000000005L)
+				.equals("89000000005"));
+		assertTrue("Returned incorrect String", Long.toString(Long.MIN_VALUE)
+				.equals("-9223372036854775808"));
+		assertTrue("Returned incorrect String", Long.toString(Long.MAX_VALUE)
+				.equals("9223372036854775807"));
+	}
+
+	/**
+	 * @tests java.lang.Long#toString(long, int)
+	 */
+	public void test_toStringJI() {
+		// Test for method java.lang.String java.lang.Long.toString(long, int)
+		assertTrue("Returned incorrect dec string", Long.toString(100000000L,
+				10).equals("100000000"));
+		assertTrue("Returned incorrect hex string", Long.toString(68719476735L,
+				16).equals("fffffffff"));
+		assertTrue("Returned incorrect oct string", Long.toString(8589934591L,
+				8).equals("77777777777"));
+		assertTrue("Returned incorrect bin string", Long.toString(
+				8796093022207L, 2).equals(
+				"1111111111111111111111111111111111111111111"));
+		assertTrue("Returned incorrect min string", Long.toString(
+				0x8000000000000000L, 10).equals("-9223372036854775808"));
+		assertTrue("Returned incorrect max string", Long.toString(
+				0x7fffffffffffffffL, 10).equals("9223372036854775807"));
+		assertTrue("Returned incorrect min string", Long.toString(
+				0x8000000000000000L, 16).equals("-8000000000000000"));
+		assertTrue("Returned incorrect max string", Long.toString(
+				0x7fffffffffffffffL, 16).equals("7fffffffffffffff"));
+	}
+
+	/**
+	 * @tests java.lang.Long#valueOf(java.lang.String)
+	 */
+	public void test_valueOfLjava_lang_String() {
+		// Test for method java.lang.Long
+		// java.lang.Long.valueOf(java.lang.String)
+		assertTrue("Returned incorrect value", Long.valueOf("100000000")
+				.longValue() == 100000000L);
+		assertTrue("Returned incorrect value", Long.valueOf(
+				"9223372036854775807").longValue() == Long.MAX_VALUE);
+		assertTrue("Returned incorrect value", Long.valueOf(
+				"-9223372036854775808").longValue() == Long.MIN_VALUE);
+
+		boolean exception = false;
+		try {
+			Long
+					.valueOf("999999999999999999999999999999999999999999999999999999999999");
+		} catch (NumberFormatException e) {
+			// correct
+			exception = true;
+		}
+		assertTrue("Failed to throw exception when passed invalid string",
+				exception);
+
+		exception = false;
+		try {
+			Long.valueOf("9223372036854775808");
+		} catch (NumberFormatException e) {
+			// correct
+			exception = true;
+		}
+		assertTrue("Failed to throw exception when passed invalid string",
+				exception);
+
+		exception = false;
+		try {
+			Long.valueOf("-9223372036854775809");
+		} catch (NumberFormatException e) {
+			// correct
+			exception = true;
+		}
+		assertTrue("Failed to throw exception when passed invalid string",
+				exception);
+	}
+
+	/**
+	 * @tests java.lang.Long#valueOf(java.lang.String, int)
+	 */
+	public void test_valueOfLjava_lang_StringI() {
+		// Test for method java.lang.Long
+		// java.lang.Long.valueOf(java.lang.String, int)
+		assertTrue("Returned incorrect value", Long.valueOf("100000000", 10)
+				.longValue() == 100000000L);
+		assertTrue("Returned incorrect value from hex string", Long.valueOf(
+				"FFFFFFFFF", 16).longValue() == 68719476735L);
+		assertTrue("Returned incorrect value from octal string: "
+				+ Long.valueOf("77777777777", 8).toString(), Long.valueOf(
+				"77777777777", 8).longValue() == 8589934591L);
+		assertTrue("Returned incorrect value", Long.valueOf(
+				"9223372036854775807", 10).longValue() == Long.MAX_VALUE);
+		assertTrue("Returned incorrect value", Long.valueOf(
+				"-9223372036854775808", 10).longValue() == Long.MIN_VALUE);
+		assertTrue("Returned incorrect value", Long.valueOf("7fffffffffffffff",
+				16).longValue() == Long.MAX_VALUE);
+		assertTrue("Returned incorrect value", Long.valueOf(
+				"-8000000000000000", 16).longValue() == Long.MIN_VALUE);
+
+		boolean exception = false;
+		try {
+			Long.valueOf("999999999999", 8);
+		} catch (NumberFormatException e) {
+			// correct
+			exception = true;
+		}
+		assertTrue("Failed to throw exception when passed invalid string",
+				exception);
+
+		exception = false;
+		try {
+			Long.valueOf("9223372036854775808", 10);
+		} catch (NumberFormatException e) {
+			// correct
+			exception = true;
+		}
+		assertTrue("Failed to throw exception when passed invalid string",
+				exception);
+
+		exception = false;
+		try {
+			Long.valueOf("-9223372036854775809", 10);
+		} catch (NumberFormatException e) {
+			// correct
+			exception = true;
+		}
+		assertTrue("Failed to throw exception when passed invalid string",
+				exception);
+	}
+
+	/**
+	 * Sets up the fixture, for example, open a network connection. This method
+	 * is called before a test is executed.
+	 */
+	protected void setUp() {
+		orgProps = System.getProperties();
+	}
+
+	/**
+	 * Tears down the fixture, for example, close a network connection. This
+	 * method is called after a test is executed.
+	 */
+	protected void tearDown() {
+		System.setProperties(orgProps);
+	}
+}

Added: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/MathTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/MathTest.java?rev=386058&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/MathTest.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/MathTest.java Wed Mar 15 03:46:17 2006
@@ -0,0 +1,407 @@
+/* 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 MathTest extends junit.framework.TestCase {
+
+	double HYP = Math.sqrt(2.0);
+
+	double OPP = 1.0;
+
+	double ADJ = 1.0;
+
+	/* Required to make previous preprocessor flags work - do not remove */
+	int unused = 0;
+
+	/**
+	 * @tests java.lang.Math#abs(double)
+	 */
+	public void test_absD() {
+		// Test for method double java.lang.Math.abs(double)
+
+		assertTrue("Incorrect double abs value",
+				(Math.abs(-1908.8976) == 1908.8976));
+		assertTrue("Incorrect double abs value",
+				(Math.abs(1908.8976) == 1908.8976));
+	}
+
+	/**
+	 * @tests java.lang.Math#abs(float)
+	 */
+	public void test_absF() {
+		// Test for method float java.lang.Math.abs(float)
+		assertTrue("Incorrect float abs value",
+				(Math.abs(-1908.8976f) == 1908.8976f));
+		assertTrue("Incorrect float abs value",
+				(Math.abs(1908.8976f) == 1908.8976f));
+	}
+
+	/**
+	 * @tests java.lang.Math#abs(int)
+	 */
+	public void test_absI() {
+		// Test for method int java.lang.Math.abs(int)
+		assertTrue("Incorrect int abs value", (Math.abs(-1908897) == 1908897));
+		assertTrue("Incorrect int abs value", (Math.abs(1908897) == 1908897));
+	}
+
+	/**
+	 * @tests java.lang.Math#abs(long)
+	 */
+	public void test_absJ() {
+		// Test for method long java.lang.Math.abs(long)
+		assertTrue("Incorrect long abs value",
+				(Math.abs(-19088976000089L) == 19088976000089L));
+		assertTrue("Incorrect long abs value",
+				(Math.abs(19088976000089L) == 19088976000089L));
+	}
+
+	/**
+	 * @tests java.lang.Math#acos(double)
+	 */
+	public void test_acosD() {
+		// Test for method double java.lang.Math.acos(double)
+		double r = Math.cos(Math.acos(ADJ / HYP));
+		long lr = Double.doubleToLongBits(r);
+		long t = Double.doubleToLongBits(ADJ / HYP);
+		assertTrue("Returned incorrect arc cosine", lr == t || (lr + 1) == t
+				|| (lr - 1) == t);
+	}
+
+	/**
+	 * @tests java.lang.Math#asin(double)
+	 */
+	public void test_asinD() {
+		// Test for method double java.lang.Math.asin(double)
+		double r = Math.sin(Math.asin(OPP / HYP));
+		long lr = Double.doubleToLongBits(r);
+		long t = Double.doubleToLongBits(OPP / HYP);
+		assertTrue("Returned incorrect arc sine", lr == t || (lr + 1) == t
+				|| (lr - 1) == t);
+	}
+
+	/**
+	 * @tests java.lang.Math#atan(double)
+	 */
+	public void test_atanD() {
+		// Test for method double java.lang.Math.atan(double)
+		double answer = Math.tan(Math.atan(1.0));
+		assertTrue("Returned incorrect arc tangent: " + answer, answer <= 1.0
+				&& answer >= 9.9999999999999983E-1);
+	}
+
+	/**
+	 * @tests java.lang.Math#atan2(double, double)
+	 */
+	public void test_atan2DD() {
+		// Test for method double java.lang.Math.atan2(double, double)
+		double answer = Math.atan(Math.tan(1.0));
+		assertTrue("Returned incorrect arc tangent: " + answer, answer <= 1.0
+				&& answer >= 9.9999999999999983E-1);
+	}
+
+	/**
+	 * @tests java.lang.Math#ceil(double)
+	 */
+	public void test_ceilD() {
+		// Test for method double java.lang.Math.ceil(double)
+		assertTrue("Incorrect ceiling for double", Math.ceil(78.89) == 79);
+		assertTrue("Incorrect ceiling for double", Math.ceil(-78.89) == -78);
+	}
+
+	/**
+	 * @tests java.lang.Math#cos(double)
+	 */
+	public void test_cosD() {
+		// Test for method double java.lang.Math.cos(double)
+		assertTrue("Incorrect answer", Math.cos(0) == 1.0);
+		assertTrue("Incorrect answer", Math.cos(1) == 0.5403023058681398);
+	}
+
+	/**
+	 * @tests java.lang.Math#exp(double)
+	 */
+	public void test_expD() {
+		// Test for method double java.lang.Math.exp(double)
+		assertTrue("Incorrect answer returned for simple power", Math.abs(Math
+				.exp(4D)
+				- Math.E * Math.E * Math.E * Math.E) < 0.1D);
+		assertTrue("Incorrect answer returned for larger power", Math.log(Math
+				.abs(Math.exp(5.5D)) - 5.5D) < 10.0D);
+	}
+
+	/**
+	 * @tests java.lang.Math#floor(double)
+	 */
+	public void test_floorD() {
+		// Test for method double java.lang.Math.floor(double)
+		assertTrue("Incorrect floor for double", Math.floor(78.89) == 78);
+		assertTrue("Incorrect floor for double", Math.floor(-78.89) == -79);
+	}
+
+	/**
+	 * @tests java.lang.Math#IEEEremainder(double, double)
+	 */
+	public void test_IEEEremainderDD() {
+		// Test for method double java.lang.Math.IEEEremainder(double, double)
+		assertTrue("Incorrect remainder returned",
+				Math.IEEEremainder(1.0, 1.0) == 0.0);
+		assertTrue("Incorrect remainder returned", Math.IEEEremainder(1.32,
+				89.765) >= 1.4705063220631647E-2
+				|| Math.IEEEremainder(1.32, 89.765) >= 1.4705063220631649E-2);
+	}
+
+	/**
+	 * @tests java.lang.Math#log(double)
+	 */
+	public void test_logD() {
+		// Test for method double java.lang.Math.log(double)
+		for (double d = 10; d >= -10; d -= 0.5) {
+			double answer = Math.log(Math.exp(d));
+			assertTrue("Answer does not equal expected answer for d = " + d
+					+ " answer = " + answer, Math.abs(answer - d) <= Math
+					.abs(d * 0.00000001));
+		}
+	}
+
+	/**
+	 * @tests java.lang.Math#max(double, double)
+	 */
+	public void test_maxDD() {
+		// Test for method double java.lang.Math.max(double, double)
+		assertTrue("Incorrect double max value", Math.max(-1908897.6000089,
+				1908897.6000089) == 1908897.6000089);
+		assertTrue("Incorrect double max value",
+				Math.max(2.0, 1908897.6000089) == 1908897.6000089);
+		assertTrue("Incorrect double max value", Math.max(-2.0,
+				-1908897.6000089) == -2.0);
+
+	}
+
+	/**
+	 * @tests java.lang.Math#max(float, float)
+	 */
+	public void test_maxFF() {
+		// Test for method float java.lang.Math.max(float, float)
+		assertTrue("Incorrect float max value", Math.max(-1908897.600f,
+				1908897.600f) == 1908897.600f);
+		assertTrue("Incorrect float max value",
+				Math.max(2.0f, 1908897.600f) == 1908897.600f);
+		assertTrue("Incorrect float max value",
+				Math.max(-2.0f, -1908897.600f) == -2.0f);
+	}
+
+	/**
+	 * @tests java.lang.Math#max(int, int)
+	 */
+	public void test_maxII() {
+		// Test for method int java.lang.Math.max(int, int)
+		assertTrue("Incorrect int max value",
+				Math.max(-19088976, 19088976) == 19088976);
+		assertTrue("Incorrect int max value",
+				Math.max(20, 19088976) == 19088976);
+		assertTrue("Incorrect int max value", Math.max(-20, -19088976) == -20);
+	}
+
+	/**
+	 * @tests java.lang.Math#max(long, long)
+	 */
+	public void test_maxJJ() {
+		// Test for method long java.lang.Math.max(long, long)
+		assertTrue("Incorrect long max value", Math.max(-19088976000089L,
+				19088976000089L) == 19088976000089L);
+		assertTrue("Incorrect long max value",
+				Math.max(20, 19088976000089L) == 19088976000089L);
+		assertTrue("Incorrect long max value",
+				Math.max(-20, -19088976000089L) == -20);
+	}
+
+	/**
+	 * @tests java.lang.Math#min(double, double)
+	 */
+	public void test_minDD() {
+		// Test for method double java.lang.Math.min(double, double)
+		assertTrue("Incorrect double min value", Math.min(-1908897.6000089,
+				1908897.6000089) == -1908897.6000089);
+		assertTrue("Incorrect double min value",
+				Math.min(2.0, 1908897.6000089) == 2.0);
+		assertTrue("Incorrect double min value", Math.min(-2.0,
+				-1908897.6000089) == -1908897.6000089);
+	}
+
+	/**
+	 * @tests java.lang.Math#min(float, float)
+	 */
+	public void test_minFF() {
+		// Test for method float java.lang.Math.min(float, float)
+		assertTrue("Incorrect float min value", Math.min(-1908897.600f,
+				1908897.600f) == -1908897.600f);
+		assertTrue("Incorrect float min value",
+				Math.min(2.0f, 1908897.600f) == 2.0f);
+		assertTrue("Incorrect float min value",
+				Math.min(-2.0f, -1908897.600f) == -1908897.600f);
+	}
+
+	/**
+	 * @tests java.lang.Math#min(int, int)
+	 */
+	public void test_minII() {
+		// Test for method int java.lang.Math.min(int, int)
+		assertTrue("Incorrect int min value",
+				Math.min(-19088976, 19088976) == -19088976);
+		assertTrue("Incorrect int min value", Math.min(20, 19088976) == 20);
+		assertTrue("Incorrect int min value",
+				Math.min(-20, -19088976) == -19088976);
+
+	}
+
+	/**
+	 * @tests java.lang.Math#min(long, long)
+	 */
+	public void test_minJJ() {
+		// Test for method long java.lang.Math.min(long, long)
+		assertTrue("Incorrect long min value", Math.min(-19088976000089L,
+				19088976000089L) == -19088976000089L);
+		assertTrue("Incorrect long min value",
+				Math.min(20, 19088976000089L) == 20);
+		assertTrue("Incorrect long min value",
+				Math.min(-20, -19088976000089L) == -19088976000089L);
+	}
+
+	/**
+	 * @tests java.lang.Math#pow(double, double)
+	 */
+	public void test_powDD() {
+		// Test for method double java.lang.Math.pow(double, double)
+		assertTrue("pow returned incorrect value",
+				(long) Math.pow(2, 8) == 256l);
+		assertTrue("pow returned incorrect value",
+				Math.pow(2, -8) == 0.00390625d);
+		assertTrue("Incorrect root returned1", Math.sqrt(Math.pow(Math.sqrt(2),
+				4)) == 2);
+	}
+
+	/**
+	 * @tests java.lang.Math#rint(double)
+	 */
+	public void test_rintD() {
+		// Test for method double java.lang.Math.rint(double)
+		assertTrue("Failed to round properly - up to odd",
+				Math.rint(2.9) == 3.0);
+		assertTrue("Failed to round properly - NaN", Double.isNaN(Math
+				.rint(Double.NaN)));
+		assertTrue("Failed to round properly down  to even",
+				Math.rint(2.1) == 2.0);
+		assertTrue("Failed to round properly " + 2.5 + " to even", Math
+				.rint(2.5) == 2.0);
+	}
+
+	/**
+	 * @tests java.lang.Math#round(double)
+	 */
+	public void test_roundD() {
+		// Test for method long java.lang.Math.round(double)
+		assertTrue("Incorrect rounding of a float", Math.round(-90.89d) == -91);
+	}
+
+	/**
+	 * @tests java.lang.Math#round(float)
+	 */
+	public void test_roundF() {
+		// Test for method int java.lang.Math.round(float)
+		assertTrue("Incorrect rounding of a float", Math.round(-90.89f) == -91);
+	}
+
+	/**
+	 * @tests java.lang.Math#sin(double)
+	 */
+	public void test_sinD() {
+		// Test for method double java.lang.Math.sin(double)
+		assertTrue("Incorrect answer", Math.sin(0) == 0.0);
+		assertTrue("Incorrect answer", Math.sin(1) == 0.8414709848078965);
+	}
+
+	/**
+	 * @tests java.lang.Math#sqrt(double)
+	 */
+	public void test_sqrtD() {
+		// Test for method double java.lang.Math.sqrt(double)
+		assertTrue("Incorrect root returned2", Math.sqrt(49) == 7);
+	}
+
+	/**
+	 * @tests java.lang.Math#tan(double)
+	 */
+	public void test_tanD() {
+		// Test for method double java.lang.Math.tan(double)
+		assertTrue("Incorrect answer", Math.tan(0) == 0.0);
+		assertTrue("Incorrect answer", Math.tan(1) == 1.5574077246549023);
+
+	}
+
+	/**
+	 * @tests java.lang.Math#random()
+	 */
+	public void test_random() {
+		// There isn't a place for these tests so just stick them here
+		assertTrue("Wrong value E",
+				Double.doubleToLongBits(Math.E) == 4613303445314885481L);
+		assertTrue("Wrong value PI",
+				Double.doubleToLongBits(Math.PI) == 4614256656552045848L);
+
+		for (int i = 500; i >= 0; i--) {
+			double d = Math.random();
+			assertTrue("Generated number is out of range: " + d, d >= 0.0
+					&& d < 1.0);
+		}
+	}
+
+	/**
+	 * @tests java.lang.Math#toRadians(double)
+	 */
+	public void test_toRadiansD() {
+		for (double d = 500; d >= 0; d -= 1.0) {
+			double converted = Math.toDegrees(Math.toRadians(d));
+			assertTrue("Converted number not equal to original. d = " + d,
+					converted >= d * 0.99999999 && converted <= d * 1.00000001);
+		}
+	}
+
+	/**
+	 * @tests java.lang.Math#toDegrees(double)
+	 */
+	public void test_toDegreesD() {
+		for (double d = 500; d >= 0; d -= 1.0) {
+			double converted = Math.toRadians(Math.toDegrees(d));
+			assertTrue("Converted number not equal to original. d = " + d,
+					converted >= d * 0.99999999 && converted <= d * 1.00000001);
+		}
+	}
+
+	/**
+	 * 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() {
+	}
+}