harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ndbe...@apache.org
Subject svn commit: r437061 - /incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/
Date Sat, 26 Aug 2006 03:41:23 GMT
Author: ndbeyer
Date: Fri Aug 25 20:41:21 2006
New Revision: 437061

URL: http://svn.apache.org/viewvc?rev=437061&view=rev
Log:
Rework java.lang exception tests to assert the exceptions classes behavior, not the behavior that causes it.

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/IllegalArgumentExceptionTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/IllegalMonitorStateExceptionTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/IllegalStateExceptionTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/IllegalThreadStateExceptionTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/IncompatibleClassChangeErrorTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/IndexOutOfBoundsExceptionTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/InstantiationErrorTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/InstantiationExceptionTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/InternalErrorTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/InterruptedExceptionTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/LinkageErrorTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/NegativeArraySizeExceptionTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/NoClassDefFoundErrorTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/NoSuchFieldErrorTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/NoSuchFieldExceptionTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/NoSuchMethodErrorTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/NoSuchMethodExceptionTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/NullPointerExceptionTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/NumberFormatExceptionTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/RuntimeExceptionTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/SecurityExceptionTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/StackOverflowErrorTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/StringIndexOutOfBoundsExceptionTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/ThrowableTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/IllegalArgumentExceptionTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/IllegalArgumentExceptionTest.java?rev=437061&r1=437060&r2=437061&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/IllegalArgumentExceptionTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/IllegalArgumentExceptionTest.java Fri Aug 25 20:41:21 2006
@@ -15,39 +15,29 @@
 
 package org.apache.harmony.luni.tests.java.lang;
 
+import junit.framework.TestCase;
+
 import org.apache.harmony.testframework.serialization.SerializationTest;
 
-public class IllegalArgumentExceptionTest extends junit.framework.TestCase {
+public class IllegalArgumentExceptionTest extends TestCase {
 
 	/**
 	 * @tests java.lang.IllegalArgumentException#IllegalArgumentException()
 	 */
 	public void test_Constructor() {
-		// Test for method java.lang.IllegalArgumentException()
-		IllegalArgumentException ill = new IllegalArgumentException();
-		assertNull("failed to create an instance of illegalArgumentException",
-				ill.getMessage());
-		try {
-			try {
-				new java.io.ByteArrayOutputStream(-12);
-			} catch (IllegalArgumentException e) {
-				return;
-			}
-			fail("Failed to generate Exception");
-		} catch (Exception e) {
-			fail("Exception during test : " + e.getMessage());
-		}
+		IllegalArgumentException e = new IllegalArgumentException();
+        assertNull(e.getMessage());
+        assertNull(e.getLocalizedMessage());
+        assertNull(e.getCause());
 	}
 
 	/**
 	 * @tests java.lang.IllegalArgumentException#IllegalArgumentException(java.lang.String)
 	 */
 	public void test_ConstructorLjava_lang_String() {
-		// Test for method java.lang.IllegalArgumentException(java.lang.String)
-		IllegalArgumentException ill = new IllegalArgumentException(
-				"testing illArg exception");
-		assertEquals("failed to create instance of illegalArgumentException(string)",
-				"testing illArg exception", ill.getMessage());
+        IllegalArgumentException e = new IllegalArgumentException("fixture");
+        assertEquals("fixture", e.getMessage());
+        assertNull(e.getCause());
 	}
 
     /**
@@ -63,18 +53,4 @@
     public void testSerializationCompatibility() throws Exception {
         SerializationTest.verifyGolden(this, new IllegalArgumentException());
     }
-
-	/**
-	 * 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() {
-	}
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/IllegalMonitorStateExceptionTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/IllegalMonitorStateExceptionTest.java?rev=437061&r1=437060&r2=437061&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/IllegalMonitorStateExceptionTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/IllegalMonitorStateExceptionTest.java Fri Aug 25 20:41:21 2006
@@ -15,56 +15,26 @@
 
 package org.apache.harmony.luni.tests.java.lang;
 
-public class IllegalMonitorStateExceptionTest extends junit.framework.TestCase {
+import 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());
-		}
-	}
+public class IllegalMonitorStateExceptionTest extends TestCase {
 
-	/**
-	 * @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());
-		}
-	}
+    /**
+     * @tests java.lang.IllegalMonitorStateException#IllegalMonitorStateException()
+     */
+    public void test_Constructor() {
+        IllegalMonitorStateException e = new IllegalMonitorStateException();
+        assertNull(e.getMessage());
+        assertNull(e.getLocalizedMessage());
+        assertNull(e.getCause());
+    }
 
-	/**
-	 * 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() {
-	}
+    /**
+     * @tests java.lang.IllegalMonitorStateException#IllegalMonitorStateException(java.lang.String)
+     */
+    public void test_ConstructorLjava_lang_String() {
+        IllegalMonitorStateException e = new IllegalMonitorStateException("fixture");
+        assertEquals("fixture", e.getMessage());
+        assertNull(e.getCause());
+    }
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/IllegalStateExceptionTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/IllegalStateExceptionTest.java?rev=437061&r1=437060&r2=437061&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/IllegalStateExceptionTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/IllegalStateExceptionTest.java Fri Aug 25 20:41:21 2006
@@ -15,9 +15,10 @@
 
 package org.apache.harmony.luni.tests.java.lang;
 
+import junit.framework.TestCase;
 import tests.util.SerializationTester;
 
-public class IllegalStateExceptionTest extends junit.framework.TestCase {
+public class IllegalStateExceptionTest extends TestCase {
 
 	private static final String SERIALIZATION_FILE_NAME =
 		"serialization/java/lang/IllegalStateException.ser"; //$NON-NLS-1$
@@ -25,23 +26,21 @@
 	/**
 	 * @tests java.lang.IllegalStateException#IllegalStateException()
 	 */
-	public void test_Constructor() {
-		// Test for method java.lang.IllegalStateException()
-		IllegalStateException ill = new IllegalStateException();
-		assertNull("failed to create an instance of illegalStateException",
-                           ill.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");
-		assertEquals("failed to create instance of illegalStateException(string)",
-				"testing illState exception", ill.getMessage());
-	}
+    public void test_Constructor() {
+        IllegalStateException e = new IllegalStateException();
+        assertNull(e.getMessage());
+        assertNull(e.getLocalizedMessage());
+        assertNull(e.getCause());
+    }
+
+    /**
+     * @tests java.lang.IllegalStateException#IllegalStateException(java.lang.String)
+     */
+    public void test_ConstructorLjava_lang_String() {
+        IllegalStateException e = new IllegalStateException("fixture");
+        assertEquals("fixture", e.getMessage());
+        assertNull(e.getCause());
+    }
 
 	/**
 	 * @tests serialization/deserilazation.
@@ -60,20 +59,5 @@
 		IllegalStateException destIllegalStateException = (IllegalStateException) SerializationTester
 				.readObject(srcIllegalStateException,
 						SERIALIZATION_FILE_NAME);
-	}
-	
-	
-	/**
-	 * 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() {
 	}
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/IllegalThreadStateExceptionTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/IllegalThreadStateExceptionTest.java?rev=437061&r1=437060&r2=437061&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/IllegalThreadStateExceptionTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/IllegalThreadStateExceptionTest.java Fri Aug 25 20:41:21 2006
@@ -15,68 +15,26 @@
 
 package org.apache.harmony.luni.tests.java.lang;
 
-public class IllegalThreadStateExceptionTest extends junit.framework.TestCase {
+import junit.framework.TestCase;
 
-	class TestThread implements Runnable {
-		public void run() {
-			try {
-				Thread.sleep(1000);
-			} catch (Exception e) {
-				System.out.println("Unable to start thread");
-			}
-		}
-	}
+public class IllegalThreadStateExceptionTest extends TestCase {
 
 	/**
-	 * @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()
+     */
+    public void test_Constructor() {
+        IllegalThreadStateException e = new IllegalThreadStateException();
+        assertNull(e.getMessage());
+        assertNull(e.getLocalizedMessage());
+        assertNull(e.getCause());
+    }
 
-	/**
-	 * @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() {
-	}
+    /**
+     * @tests java.lang.IllegalThreadStateException#IllegalThreadStateException(java.lang.String)
+     */
+    public void test_ConstructorLjava_lang_String() {
+        IllegalThreadStateException e = new IllegalThreadStateException("fixture");
+        assertEquals("fixture", e.getMessage());
+        assertNull(e.getCause());
+    }
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/IncompatibleClassChangeErrorTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/IncompatibleClassChangeErrorTest.java?rev=437061&r1=437060&r2=437061&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/IncompatibleClassChangeErrorTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/IncompatibleClassChangeErrorTest.java Fri Aug 25 20:41:21 2006
@@ -15,42 +15,26 @@
 
 package org.apache.harmony.luni.tests.java.lang;
 
-public class IncompatibleClassChangeErrorTest extends junit.framework.TestCase {
+import 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"));
-		}
-	}
+public class IncompatibleClassChangeErrorTest extends TestCase {
 
 	/**
-	 * @tests java.lang.IncompatibleClassChangeError#IncompatibleClassChangeError(java.lang.String)
+	 * @tests java.lang.IncompatibleClassChangeError#IncompatibleClassChangeError()
 	 */
-	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() {
-	}
+    public void test_Constructor() {
+        IncompatibleClassChangeError e = new IncompatibleClassChangeError();
+        assertNull(e.getMessage());
+        assertNull(e.getLocalizedMessage());
+        assertNull(e.getCause());
+    }
 
-	protected void tearDown() {
-	}
+    /**
+     * @tests java.lang.IncompatibleClassChangeError#IncompatibleClassChangeError(java.lang.String)
+     */
+    public void test_ConstructorLjava_lang_String() {
+        IncompatibleClassChangeError e = new IncompatibleClassChangeError("fixture");
+        assertEquals("fixture", e.getMessage());
+        assertNull(e.getCause());
+    }
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/IndexOutOfBoundsExceptionTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/IndexOutOfBoundsExceptionTest.java?rev=437061&r1=437060&r2=437061&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/IndexOutOfBoundsExceptionTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/IndexOutOfBoundsExceptionTest.java Fri Aug 25 20:41:21 2006
@@ -15,59 +15,26 @@
 
 package org.apache.harmony.luni.tests.java.lang;
 
-public class IndexOutOfBoundsExceptionTest extends junit.framework.TestCase {
+import 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());
-		}
-	}
+public class IndexOutOfBoundsExceptionTest extends TestCase {
 
 	/**
-	 * @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.
+	 * @tests java.lang.IndexOutOfBoundsException#IndexOutOfBoundsException()
 	 */
-	protected void setUp() {
-	}
+    public void test_Constructor() {
+        IndexOutOfBoundsException e = new IndexOutOfBoundsException();
+        assertNull(e.getMessage());
+        assertNull(e.getLocalizedMessage());
+        assertNull(e.getCause());
+    }
 
-	/**
-	 * Tears down the fixture, for example, close a network connection. This
-	 * method is called after a test is executed.
-	 */
-	protected void tearDown() {
-	}
+    /**
+     * @tests java.lang.IndexOutOfBoundsException#IndexOutOfBoundsException(java.lang.String)
+     */
+    public void test_ConstructorLjava_lang_String() {
+        IndexOutOfBoundsException e = new IndexOutOfBoundsException("fixture");
+        assertEquals("fixture", e.getMessage());
+        assertNull(e.getCause());
+    }
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/InstantiationErrorTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/InstantiationErrorTest.java?rev=437061&r1=437060&r2=437061&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/InstantiationErrorTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/InstantiationErrorTest.java Fri Aug 25 20:41:21 2006
@@ -15,26 +15,26 @@
 
 package org.apache.harmony.luni.tests.java.lang;
 
-public class InstantiationErrorTest extends junit.framework.TestCase {
+import junit.framework.TestCase;
+
+public class InstantiationErrorTest extends 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() {
-	}
+    public void test_Constructor() {
+        InstantiationError e = new InstantiationError();
+        assertNull(e.getMessage());
+        assertNull(e.getLocalizedMessage());
+        assertNull(e.getCause());
+    }
 
-	protected void tearDown() {
-	}
+    /**
+     * @tests java.lang.InstantiationError#InstantiationError(java.lang.String)
+     */
+    public void test_ConstructorLjava_lang_String() {
+        InstantiationError e = new InstantiationError("fixture");
+        assertEquals("fixture", e.getMessage());
+        assertNull(e.getCause());
+    }
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/InstantiationExceptionTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/InstantiationExceptionTest.java?rev=437061&r1=437060&r2=437061&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/InstantiationExceptionTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/InstantiationExceptionTest.java Fri Aug 25 20:41:21 2006
@@ -15,57 +15,26 @@
 
 package org.apache.harmony.luni.tests.java.lang;
 
-public class InstantiationExceptionTest extends junit.framework.TestCase {
+import 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());
-		}
-	}
+public class InstantiationExceptionTest extends TestCase {
 
 	/**
-	 * @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.
+	 * @tests java.lang.InstantiationException#InstantiationException()
 	 */
-	protected void setUp() {
-	}
+    public void test_Constructor() {
+        InstantiationException e = new InstantiationException();
+        assertNull(e.getMessage());
+        assertNull(e.getLocalizedMessage());
+        assertNull(e.getCause());
+    }
 
-	/**
-	 * Tears down the fixture, for example, close a network connection. This
-	 * method is called after a test is executed.
-	 */
-	protected void tearDown() {
-	}
+    /**
+     * @tests java.lang.InstantiationException#InstantiationException(java.lang.String)
+     */
+    public void test_ConstructorLjava_lang_String() {
+        InstantiationException e = new InstantiationException("fixture");
+        assertEquals("fixture", e.getMessage());
+        assertNull(e.getCause());
+    }
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/InternalErrorTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/InternalErrorTest.java?rev=437061&r1=437060&r2=437061&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/InternalErrorTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/InternalErrorTest.java Fri Aug 25 20:41:21 2006
@@ -15,50 +15,26 @@
 
 package org.apache.harmony.luni.tests.java.lang;
 
-public class InternalErrorTest extends junit.framework.TestCase {
+import 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");
-	}
+public class InternalErrorTest extends TestCase {
 
 	/**
-	 * @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) {
-			assertEquals("Returned incorrect message", 
-					"Test", e.getMessage());
-			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.
+	 * @tests java.lang.InternalError#InternalError()
 	 */
-	protected void setUp() {
-	}
+    public void test_Constructor() {
+        InternalError e = new InternalError();
+        assertNull(e.getMessage());
+        assertNull(e.getLocalizedMessage());
+        assertNull(e.getCause());
+    }
 
-	/**
-	 * Tears down the fixture, for example, close a network connection. This
-	 * method is called after a test is executed.
-	 */
-	protected void tearDown() {
-	}
+    /**
+     * @tests java.lang.InternalError#InternalError(java.lang.String)
+     */
+    public void test_ConstructorLjava_lang_String() {
+        InternalError e = new InternalError("fixture");
+        assertEquals("fixture", e.getMessage());
+        assertNull(e.getCause());
+    }
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/InterruptedExceptionTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/InterruptedExceptionTest.java?rev=437061&r1=437060&r2=437061&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/InterruptedExceptionTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/InterruptedExceptionTest.java Fri Aug 25 20:41:21 2006
@@ -15,50 +15,26 @@
 
 package org.apache.harmony.luni.tests.java.lang;
 
-public class InterruptedExceptionTest extends junit.framework.TestCase {
+import 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");
-	}
+public class InterruptedExceptionTest extends TestCase {
 
 	/**
-	 * @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.
+	 * @tests java.lang.InterruptedException#InterruptedException()
 	 */
-	protected void setUp() {
-	}
+    public void test_Constructor() {
+        InterruptedException e = new InterruptedException();
+        assertNull(e.getMessage());
+        assertNull(e.getLocalizedMessage());
+        assertNull(e.getCause());
+    }
 
-	/**
-	 * Tears down the fixture, for example, close a network connection. This
-	 * method is called after a test is executed.
-	 */
-	protected void tearDown() {
-	}
+    /**
+     * @tests java.lang.InterruptedException#InterruptedException(java.lang.String)
+     */
+    public void test_ConstructorLjava_lang_String() {
+        InterruptedException e = new InterruptedException("fixture");
+        assertEquals("fixture", e.getMessage());
+        assertNull(e.getCause());
+    }
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/LinkageErrorTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/LinkageErrorTest.java?rev=437061&r1=437060&r2=437061&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/LinkageErrorTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/LinkageErrorTest.java Fri Aug 25 20:41:21 2006
@@ -15,42 +15,26 @@
 
 package org.apache.harmony.luni.tests.java.lang;
 
-public class LinkageErrorTest extends junit.framework.TestCase {
+import 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) {
-			assertEquals("Error not initialized.", 
-					"java.lang.LinkageError", e.toString());
-		}
-	}
+public class LinkageErrorTest extends TestCase {
 
 	/**
-	 * @tests java.lang.LinkageError#LinkageError(java.lang.String)
+	 * @tests java.lang.LinkageError#LinkageError()
 	 */
-	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() {
-	}
+    public void test_Constructor() {
+        LinkageError e = new LinkageError();
+        assertNull(e.getMessage());
+        assertNull(e.getLocalizedMessage());
+        assertNull(e.getCause());
+    }
 
-	protected void tearDown() {
-	}
+    /**
+     * @tests java.lang.LinkageError#LinkageError(java.lang.String)
+     */
+    public void test_ConstructorLjava_lang_String() {
+        LinkageError e = new LinkageError("fixture");
+        assertEquals("fixture", e.getMessage());
+        assertNull(e.getCause());
+    }
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/NegativeArraySizeExceptionTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/NegativeArraySizeExceptionTest.java?rev=437061&r1=437060&r2=437061&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/NegativeArraySizeExceptionTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/NegativeArraySizeExceptionTest.java Fri Aug 25 20:41:21 2006
@@ -15,50 +15,26 @@
 
 package org.apache.harmony.luni.tests.java.lang;
 
-public class NegativeArraySizeExceptionTest extends junit.framework.TestCase {
+import junit.framework.TestCase;
 
-	/**
-	 * @tests java.lang.NegativeArraySizeException#NegativeArraySizeException()
-	 */
-	public void test_Constructor() {
-		// Test for method java.lang.NegativeArraySizeException()
-		try {
-			int[] x = new int[-1];
-			if (x.length > 0)
-				; // use x[] to avoid a warning
-		} catch (NegativeArraySizeException e) {
-			return;
-		}
-		fail("Failed to generate exception");
-	}
+public class NegativeArraySizeExceptionTest extends TestCase {
 
 	/**
-	 * @tests java.lang.NegativeArraySizeException#NegativeArraySizeException(java.lang.String)
-	 */
-	public void test_ConstructorLjava_lang_String() {
-		// Test for method
-		// java.lang.NegativeArraySizeException(java.lang.String)
-		try {
-			int[] x = new int[-1];
-			if (x.length > 0)
-				;// use x to avoid a warning msg
-		} catch (NegativeArraySizeException e) {
-			return;
-		}
-		fail("Failed to generate exception");
-	}
-
-	/**
-	 * Sets up the fixture, for example, open a network connection. This method
-	 * is called before a test is executed.
+	 * @tests java.lang.NegativeArraySizeException#NegativeArraySizeException()
 	 */
-	protected void setUp() {
-	}
+    public void test_Constructor() {
+        NegativeArraySizeException e = new NegativeArraySizeException();
+        assertNull(e.getMessage());
+        assertNull(e.getLocalizedMessage());
+        assertNull(e.getCause());
+    }
 
-	/**
-	 * Tears down the fixture, for example, close a network connection. This
-	 * method is called after a test is executed.
-	 */
-	protected void tearDown() {
-	}
+    /**
+     * @tests java.lang.NegativeArraySizeException#NegativeArraySizeException(java.lang.String)
+     */
+    public void test_ConstructorLjava_lang_String() {
+        NegativeArraySizeException e = new NegativeArraySizeException("fixture");
+        assertEquals("fixture", e.getMessage());
+        assertNull(e.getCause());
+    }
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/NoClassDefFoundErrorTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/NoClassDefFoundErrorTest.java?rev=437061&r1=437060&r2=437061&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/NoClassDefFoundErrorTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/NoClassDefFoundErrorTest.java Fri Aug 25 20:41:21 2006
@@ -15,43 +15,26 @@
 
 package org.apache.harmony.luni.tests.java.lang;
 
-public class NoClassDefFoundErrorTest extends junit.framework.TestCase {
+import junit.framework.TestCase;
 
-	/**
-	 * @tests java.lang.NoClassDefFoundError#NoClassDefFoundError()
-	 */
-	public void test_Constructor() {
-		try {
-			if (true) {
-				throw new NoClassDefFoundError();
-			}
-			fail("Error not thrown.");
-		} catch (NoClassDefFoundError e) {
-			assertEquals("Error not intitialized.", 
-					"java.lang.NoClassDefFoundError", e.toString());
-		}
-	}
+public class NoClassDefFoundErrorTest extends TestCase {
 
 	/**
-	 * @tests java.lang.NoClassDefFoundError#NoClassDefFoundError(java.lang.String)
+	 * @tests java.lang.NoClassDefFoundError#NoClassDefFoundError()
 	 */
-	public void test_ConstructorLjava_lang_String() {
-		try {
-			if (true) {
-				throw new NoClassDefFoundError("Hello World");
-			}
-			fail("Error not thrown.");
-		} catch (NoClassDefFoundError e) {
-			assertTrue("Wrong error message: " + e.getMessage(), e.getMessage()
-					.equals("Hello World"));
-		} catch (Exception e) {
-			fail("Exception during test : " + e.getMessage());
-		}
-	}
-
-	protected void setUp() {
-	}
+    public void test_Constructor() {
+        NoClassDefFoundError e = new NoClassDefFoundError();
+        assertNull(e.getMessage());
+        assertNull(e.getLocalizedMessage());
+        assertNull(e.getCause());
+    }
 
-	protected void tearDown() {
-	}
+    /**
+     * @tests java.lang.NoClassDefFoundError#NoClassDefFoundError(java.lang.String)
+     */
+    public void test_ConstructorLjava_lang_String() {
+        NoClassDefFoundError e = new NoClassDefFoundError("fixture");
+        assertEquals("fixture", e.getMessage());
+        assertNull(e.getCause());
+    }
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/NoSuchFieldErrorTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/NoSuchFieldErrorTest.java?rev=437061&r1=437060&r2=437061&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/NoSuchFieldErrorTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/NoSuchFieldErrorTest.java Fri Aug 25 20:41:21 2006
@@ -15,43 +15,26 @@
 
 package org.apache.harmony.luni.tests.java.lang;
 
-public class NoSuchFieldErrorTest extends junit.framework.TestCase {
+import junit.framework.TestCase;
 
-	/**
-	 * @tests java.lang.NoSuchFieldError#NoSuchFieldError()
-	 */
-	public void test_Constructor() {
-		try {
-			if (true)
-				throw new NoSuchFieldError();
-		} catch (NoSuchFieldError e) {
-			assertNull("Initializer failed.", e.getMessage());
-			assertEquals("To string failed.", 
-					"java.lang.NoSuchFieldError", e.toString());
-		}
-	}
+public class NoSuchFieldErrorTest extends TestCase {
 
 	/**
-	 * @tests java.lang.NoSuchFieldError#NoSuchFieldError(java.lang.String)
+	 * @tests java.lang.NoSuchFieldError#NoSuchFieldError()
 	 */
-	public void test_ConstructorLjava_lang_String() {
-		// No accessible method throws this error.
-		try {
-			if (true)
-				throw new NoSuchFieldError("Hello World");
-		} catch (NoSuchFieldError e) {
-			assertTrue("Incorrect message: " + e.getMessage(), e.getMessage()
-					.equals("Hello World"));
-			return;
-		} catch (Throwable e) {
-			fail("Wrong error thrown : " + e.getMessage());
-		}
-		fail("Error not thrown.");
-	}
-
-	protected void setUp() {
-	}
+    public void test_Constructor() {
+        NoSuchFieldError e = new NoSuchFieldError();
+        assertNull(e.getMessage());
+        assertNull(e.getLocalizedMessage());
+        assertNull(e.getCause());
+    }
 
-	protected void tearDown() {
-	}
+    /**
+     * @tests java.lang.NoSuchFieldError#NoSuchFieldError(java.lang.String)
+     */
+    public void test_ConstructorLjava_lang_String() {
+        NoSuchFieldError e = new NoSuchFieldError("fixture");
+        assertEquals("fixture", e.getMessage());
+        assertNull(e.getCause());
+    }
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/NoSuchFieldExceptionTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/NoSuchFieldExceptionTest.java?rev=437061&r1=437060&r2=437061&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/NoSuchFieldExceptionTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/NoSuchFieldExceptionTest.java Fri Aug 25 20:41:21 2006
@@ -15,49 +15,26 @@
 
 package org.apache.harmony.luni.tests.java.lang;
 
-public class NoSuchFieldExceptionTest extends junit.framework.TestCase {
+import junit.framework.TestCase;
 
-	/**
-	 * @tests java.lang.NoSuchFieldException#NoSuchFieldException()
-	 */
-	public void test_Constructor() {
-		// Test for method java.lang.NoSuchFieldException()
-		try {
-			String.class.getDeclaredField("prsttrvol");
-		} catch (NoSuchFieldException e) {
-			// Correct
-			return;
-		}
-		fail("Failed to throw exception");
-
-	}
-
-	/**
-	 * @tests java.lang.NoSuchFieldException#NoSuchFieldException(java.lang.String)
-	 */
-	public void test_ConstructorLjava_lang_String() {
-		// Test for method java.lang.NoSuchFieldException(java.lang.String)
-		try {
-			String.class.getDeclaredField("prsttrvol");
-		} catch (NoSuchFieldException e) {
-			// Correct
-			return;
-		}
-		fail("Failed to throw exception");
-
-	}
-
-	/**
-	 * Sets up the fixture, for example, open a network connection. This method
-	 * is called before a test is executed.
-	 */
-	protected void setUp() {
-	}
+public class NoSuchFieldExceptionTest extends TestCase {
 
 	/**
-	 * Tears down the fixture, for example, close a network connection. This
-	 * method is called after a test is executed.
+	 * @tests java.lang.NoSuchFieldException#NoSuchFieldException()
 	 */
-	protected void tearDown() {
-	}
+    public void test_Constructor() {
+        NoSuchFieldException e = new NoSuchFieldException();
+        assertNull(e.getMessage());
+        assertNull(e.getLocalizedMessage());
+        assertNull(e.getCause());
+    }
+
+    /**
+     * @tests java.lang.NoSuchFieldException#NoSuchFieldException(java.lang.String)
+     */
+    public void test_ConstructorLjava_lang_String() {
+        NoSuchFieldException e = new NoSuchFieldException("fixture");
+        assertEquals("fixture", e.getMessage());
+        assertNull(e.getCause());
+    }
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/NoSuchMethodErrorTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/NoSuchMethodErrorTest.java?rev=437061&r1=437060&r2=437061&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/NoSuchMethodErrorTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/NoSuchMethodErrorTest.java Fri Aug 25 20:41:21 2006
@@ -15,43 +15,26 @@
 
 package org.apache.harmony.luni.tests.java.lang;
 
-public class NoSuchMethodErrorTest extends junit.framework.TestCase {
+import junit.framework.TestCase;
 
-	/**
-	 * @tests java.lang.NoSuchMethodError#NoSuchMethodError()
-	 */
-	public void test_Constructor() {
-		try {
-			if (true)
-				throw new NoSuchMethodError();
-		} catch (NoSuchMethodError e) {
-			assertNull("Initializer failed.", e.getMessage());
-			assertEquals("To string failed.", 
-					"java.lang.NoSuchMethodError", e.toString());
-		}
-	}
+public class NoSuchMethodErrorTest extends TestCase {
 
 	/**
-	 * @tests java.lang.NoSuchMethodError#NoSuchMethodError(java.lang.String)
+	 * @tests java.lang.NoSuchMethodError#NoSuchMethodError()
 	 */
-	public void test_ConstructorLjava_lang_String() {
-		// No accessible method throws this error.
-		try {
-			if (true)
-				throw new NoSuchMethodError("Hello World");
-		} catch (NoSuchMethodError e) {
-			assertTrue("Incorrect message: " + e.getMessage(), e.getMessage()
-					.equals("Hello World"));
-			return;
-		} catch (Throwable e) {
-			fail("Wrong error thrown : " + e);
-		}
-		fail("Error not thrown");
-	}
-
-	protected void setUp() {
-	}
+    public void test_Constructor() {
+        NoSuchMethodError e = new NoSuchMethodError();
+        assertNull(e.getMessage());
+        assertNull(e.getLocalizedMessage());
+        assertNull(e.getCause());
+    }
 
-	protected void tearDown() {
-	}
+    /**
+     * @tests java.lang.NoSuchMethodError#NoSuchMethodError(java.lang.String)
+     */
+    public void test_ConstructorLjava_lang_String() {
+        NoSuchMethodError e = new NoSuchMethodError("fixture");
+        assertEquals("fixture", e.getMessage());
+        assertNull(e.getCause());
+    }
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/NoSuchMethodExceptionTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/NoSuchMethodExceptionTest.java?rev=437061&r1=437060&r2=437061&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/NoSuchMethodExceptionTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/NoSuchMethodExceptionTest.java Fri Aug 25 20:41:21 2006
@@ -15,47 +15,26 @@
 
 package org.apache.harmony.luni.tests.java.lang;
 
-public class NoSuchMethodExceptionTest extends junit.framework.TestCase {
+import junit.framework.TestCase;
 
-	/**
-	 * @tests java.lang.NoSuchMethodException#NoSuchMethodException()
-	 */
-	public void test_Constructor() {
-		// Test for method java.lang.NoSuchMethodException()
-		try {
-			String.class.getMethod("voidMethod", new Class[0]);
-		} catch (NoSuchMethodException e) {
-			// Correct
-			return;
-		}
-		fail("Failed to throw exception");
-	}
+public class NoSuchMethodExceptionTest extends TestCase {
 
 	/**
-	 * @tests java.lang.NoSuchMethodException#NoSuchMethodException(java.lang.String)
-	 */
-	public void test_ConstructorLjava_lang_String() {
-		// Test for method java.lang.NoSuchMethodException(java.lang.String)
-		try {
-			String.class.getMethod("voidMethod", new Class[0]);
-		} catch (NoSuchMethodException e) {
-			// Correct
-			return;
-		}
-		fail("Failed to throw exception");
-	}
-
-	/**
-	 * Sets up the fixture, for example, open a network connection. This method
-	 * is called before a test is executed.
+	 * @tests java.lang.NoSuchMethodException#NoSuchMethodException()
 	 */
-	protected void setUp() {
-	}
+    public void test_Constructor() {
+        NoSuchMethodException e = new NoSuchMethodException();
+        assertNull(e.getMessage());
+        assertNull(e.getLocalizedMessage());
+        assertNull(e.getCause());
+    }
 
-	/**
-	 * Tears down the fixture, for example, close a network connection. This
-	 * method is called after a test is executed.
-	 */
-	protected void tearDown() {
-	}
+    /**
+     * @tests java.lang.NoSuchMethodException#NoSuchMethodException(java.lang.String)
+     */
+    public void test_ConstructorLjava_lang_String() {
+        NoSuchMethodException e = new NoSuchMethodException("fixture");
+        assertEquals("fixture", e.getMessage());
+        assertNull(e.getCause());
+    }
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/NullPointerExceptionTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/NullPointerExceptionTest.java?rev=437061&r1=437060&r2=437061&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/NullPointerExceptionTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/NullPointerExceptionTest.java Fri Aug 25 20:41:21 2006
@@ -14,51 +14,26 @@
  */
 package org.apache.harmony.luni.tests.java.lang;
 
-public class NullPointerExceptionTest extends junit.framework.TestCase {
+import junit.framework.TestCase;
 
-	/**
-	 * @tests java.lang.NullPointerException#NullPointerException()
-	 */
-	public void test_Constructor() {
-		// Test for method java.lang.NullPointerException()
-		try {
-			byte[] rbuf = null;
-			int z = rbuf.length;
-			if (z > 0)
-				; // use z to avoid a warning msg
-		} catch (java.lang.NullPointerException e) {
-			return;
-		}
-		fail("Failed to generate Exception");
-	}
+public class NullPointerExceptionTest extends TestCase {
 
 	/**
-	 * @tests java.lang.NullPointerException#NullPointerException(java.lang.String)
-	 */
-	public void test_ConstructorLjava_lang_String() {
-		// Test for method java.lang.NullPointerException(java.lang.String)
-		try {
-			byte[] rbuf = null;
-			int z = rbuf.length;
-			if (z > 0)
-				; // use z to avoid a warning msg
-		} catch (java.lang.NullPointerException e) {
-			return;
-		}
-		fail("Failed to generate Exception");
-	}
-
-	/**
-	 * Sets up the fixture, for example, open a network connection. This method
-	 * is called before a test is executed.
+	 * @tests java.lang.NullPointerException#NullPointerException()
 	 */
-	protected void setUp() {
-	}
+    public void test_Constructor() {
+        NullPointerException e = new NullPointerException();
+        assertNull(e.getMessage());
+        assertNull(e.getLocalizedMessage());
+        assertNull(e.getCause());
+    }
 
-	/**
-	 * Tears down the fixture, for example, close a network connection. This
-	 * method is called after a test is executed.
-	 */
-	protected void tearDown() {
-	}
+    /**
+     * @tests java.lang.NullPointerException#NullPointerException(java.lang.String)
+     */
+    public void test_ConstructorLjava_lang_String() {
+        NullPointerException e = new NullPointerException("fixture");
+        assertEquals("fixture", e.getMessage());
+        assertNull(e.getCause());
+    }
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/NumberFormatExceptionTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/NumberFormatExceptionTest.java?rev=437061&r1=437060&r2=437061&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/NumberFormatExceptionTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/NumberFormatExceptionTest.java Fri Aug 25 20:41:21 2006
@@ -15,53 +15,26 @@
 
 package org.apache.harmony.luni.tests.java.lang;
 
-public class NumberFormatExceptionTest extends junit.framework.TestCase {
+import junit.framework.TestCase;
 
-	/**
-	 * @tests java.lang.NumberFormatException#NumberFormatException()
-	 */
-	public void test_Constructor() {
-		// Test for method java.lang.NumberFormatException()
-		try {
-			try {
-				Byte.parseByte("128");
-			} catch (NumberFormatException e) {
-				return;
-			}
-			fail("Failed to generate Exception");
-		} catch (Exception e) {
-			fail("Exception during test : " + e.getMessage());
-		}
-	}
+public class NumberFormatExceptionTest extends TestCase {
 
 	/**
-	 * @tests java.lang.NumberFormatException#NumberFormatException(java.lang.String)
-	 */
-	public void test_ConstructorLjava_lang_String() {
-		// Test for method java.lang.NumberFormatException(java.lang.String)
-		try {
-			try {
-				Byte.parseByte("128");
-			} catch (NumberFormatException 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.
+	 * @tests java.lang.NumberFormatException#NumberFormatException()
 	 */
-	protected void setUp() {
-	}
+    public void test_Constructor() {
+        NumberFormatException e = new NumberFormatException();
+        assertNull(e.getMessage());
+        assertNull(e.getLocalizedMessage());
+        assertNull(e.getCause());
+    }
 
-	/**
-	 * Tears down the fixture, for example, close a network connection. This
-	 * method is called after a test is executed.
-	 */
-	protected void tearDown() {
-	}
+    /**
+     * @tests java.lang.NumberFormatException#NumberFormatException(java.lang.String)
+     */
+    public void test_ConstructorLjava_lang_String() {
+        NumberFormatException e = new NumberFormatException("fixture");
+        assertEquals("fixture", e.getMessage());
+        assertNull(e.getCause());
+    }
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/RuntimeExceptionTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/RuntimeExceptionTest.java?rev=437061&r1=437060&r2=437061&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/RuntimeExceptionTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/RuntimeExceptionTest.java Fri Aug 25 20:41:21 2006
@@ -15,53 +15,26 @@
 
 package org.apache.harmony.luni.tests.java.lang;
 
-public class RuntimeExceptionTest extends junit.framework.TestCase {
+import junit.framework.TestCase;
 
-	/**
-	 * @tests java.lang.RuntimeException#RuntimeException()
-	 */
-	public void test_Constructor() {
-		// Test for method java.lang.RuntimeException()
-		// Effectively tested by the subclasses
-
-		try {
-			if (true)
-				throw new RuntimeException();
-		} catch (RuntimeException e) {
-			return;
-		}
-		fail("Failed to throw Runtime Exception");
-	}
-
-	/**
-	 * @tests java.lang.RuntimeException#RuntimeException(java.lang.String)
-	 */
-	public void test_ConstructorLjava_lang_String() {
-		// Test for method java.lang.RuntimeException(java.lang.String)
-		// Effectively tested by the subclasses
-
-		try {
-			if (true)
-				throw new RuntimeException("Runtime message");
-		} catch (RuntimeException e) {
-			assertEquals("Incorrect message", 
-					"Runtime message", e.getMessage());
-			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() {
-	}
+public class RuntimeExceptionTest extends TestCase {
 
 	/**
-	 * Tears down the fixture, for example, close a network connection. This
-	 * method is called after a test is executed.
+	 * @tests java.lang.RuntimeException#RuntimeException()
 	 */
-	protected void tearDown() {
-	}
+    public void test_Constructor() {
+        RuntimeException e = new RuntimeException();
+        assertNull(e.getMessage());
+        assertNull(e.getLocalizedMessage());
+        assertNull(e.getCause());
+    }
+
+    /**
+     * @tests java.lang.RuntimeException#RuntimeException(java.lang.String)
+     */
+    public void test_ConstructorLjava_lang_String() {
+        RuntimeException e = new RuntimeException("fixture");
+        assertEquals("fixture", e.getMessage());
+        assertNull(e.getCause());
+    }
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/SecurityExceptionTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/SecurityExceptionTest.java?rev=437061&r1=437060&r2=437061&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/SecurityExceptionTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/SecurityExceptionTest.java Fri Aug 25 20:41:21 2006
@@ -15,9 +15,10 @@
 
 package org.apache.harmony.luni.tests.java.lang;
 
+import junit.framework.TestCase;
 import tests.util.SerializationTester;
 
-public class SecurityExceptionTest extends junit.framework.TestCase {
+public class SecurityExceptionTest extends TestCase {
 	
 	private static final String SERIALIZATION_FILE_NAME =
 		"serialization/java/lang/SecurityException.ser"; //$NON-NLS-1$
@@ -25,30 +26,21 @@
 	/**
 	 * @tests java.lang.SecurityException#SecurityException()
 	 */
-	public void test_Constructor() {
-		// Test for method java.lang.SecurityException()
-		boolean threwException = false;
-		try {
-			throw new SecurityException();
-		} catch (SecurityException e) {
-			threwException = true;
-		}
-		assertTrue("Failed to generate exception", threwException);
-	}
+    public void test_Constructor() {
+        SecurityException e = new SecurityException();
+        assertNull(e.getMessage());
+        assertNull(e.getLocalizedMessage());
+        assertNull(e.getCause());
+    }
 
-	/**
-	 * @tests java.lang.SecurityException#SecurityException(java.lang.String)
-	 */
-	public void test_ConstructorLjava_lang_String() {
-		// Test for method java.lang.SecurityException(java.lang.String)
-		boolean threwException = false;
-		try {
-			throw new SecurityException("Cannot use sockets with this manager");
-		} catch (SecurityException e) {
-			threwException = true;
-		}
-		assertTrue("Failed to generate exception", threwException);
-	}
+    /**
+     * @tests java.lang.SecurityException#SecurityException(java.lang.String)
+     */
+    public void test_ConstructorLjava_lang_String() {
+        SecurityException e = new SecurityException("fixture");
+        assertEquals("fixture", e.getMessage());
+        assertNull(e.getCause());
+    }
 
 	/**
 	 * @tests serialization/deserilazation.
@@ -67,20 +59,5 @@
 		SecurityException destSecurityException = (SecurityException) SerializationTester
 				.readObject(srcSecurityException,
 						SERIALIZATION_FILE_NAME);
-	}
-	
-	
-	/**
-	 * 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() {
 	}
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/StackOverflowErrorTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/StackOverflowErrorTest.java?rev=437061&r1=437060&r2=437061&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/StackOverflowErrorTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/StackOverflowErrorTest.java Fri Aug 25 20:41:21 2006
@@ -15,59 +15,26 @@
 
 package org.apache.harmony.luni.tests.java.lang;
 
-public class StackOverflowErrorTest extends junit.framework.TestCase {
+import junit.framework.TestCase;
 
-	/**
-	 * @tests java.lang.StackOverflowError#StackOverflowError()
-	 */
-	public void test_Constructor() {
-		// Test for method java.lang.StackOverflowError()
-		new StackOverflowError();
-		try {
-			this.createOverflow();
-		} catch (StackOverflowError e) {
-			return;
-		}
-		fail("Failed to generate stack overflow");
-	}
-
-	/**
-	 * @tests java.lang.StackOverflowError#StackOverflowError(java.lang.String)
-	 */
-	public void test_ConstructorLjava_lang_String() {
-		// Test for method java.lang.StackOverflowError(java.lang.String)
-		new StackOverflowError();
-		try {
-			this.createOverflow();
-		} catch (StackOverflowError e) {
-			return;
-		}
-		fail("Failed to generate stack overflow");
-	}
-
-	/**
-	 * Sets up the fixture, for example, open a network connection. This method
-	 * is called before a test is executed.
-	 */
-	protected void setUp() {
-	}
+public class StackOverflowErrorTest extends TestCase {
 
 	/**
-	 * Tears down the fixture, for example, close a network connection. This
-	 * method is called after a test is executed.
-	 */
-	protected void tearDown() {
-	}
-
-	/**
-	 * 
+	 * @tests java.lang.StackOverflowError#StackOverflowError()
 	 */
-	protected int createOverflow() {
-		this.createOverflow();
-		return dummy() + 1;
-	}
-
-	protected int dummy() {
-		return 0;
-	}
+    public void test_Constructor() {
+        StackOverflowError e = new StackOverflowError();
+        assertNull(e.getMessage());
+        assertNull(e.getLocalizedMessage());
+        assertNull(e.getCause());
+    }
+
+    /**
+     * @tests java.lang.StackOverflowError#StackOverflowError(java.lang.String)
+     */
+    public void test_ConstructorLjava_lang_String() {
+        StackOverflowError e = new StackOverflowError("fixture");
+        assertEquals("fixture", e.getMessage());
+        assertNull(e.getCause());
+    }
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/StringIndexOutOfBoundsExceptionTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/StringIndexOutOfBoundsExceptionTest.java?rev=437061&r1=437060&r2=437061&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/StringIndexOutOfBoundsExceptionTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/StringIndexOutOfBoundsExceptionTest.java Fri Aug 25 20:41:21 2006
@@ -15,48 +15,26 @@
 
 package org.apache.harmony.luni.tests.java.lang;
 
-public class StringIndexOutOfBoundsExceptionTest extends
-		junit.framework.TestCase {
+import junit.framework.TestCase;
 
-	/**
-	 * @tests java.lang.StringIndexOutOfBoundsException#StringIndexOutOfBoundsException()
-	 */
-	public void test_Constructor() {
-		// Test for method java.lang.StringIndexOutOfBoundsException()
+public class StringIndexOutOfBoundsExceptionTest extends TestCase {
 
-		try {
-			"X".charAt(99);
-		} catch (StringIndexOutOfBoundsException e) {
-			return;
-		}
-		fail("Failed to generate exception");
-	}
+    /**
+     * @tests java.lang.StringIndexOutOfBoundsException#StringIndexOutOfBoundsException()
+     */
+    public void test_Constructor() {
+        StringIndexOutOfBoundsException e = new StringIndexOutOfBoundsException();
+        assertNull(e.getMessage());
+        assertNull(e.getLocalizedMessage());
+        assertNull(e.getCause());
+    }
 
-	/**
-	 * @tests java.lang.StringIndexOutOfBoundsException#StringIndexOutOfBoundsException(java.lang.String)
-	 */
-	public void test_ConstructorLjava_lang_String() {
-		// Test for method
-		// java.lang.StringIndexOutOfBoundsException(java.lang.String)
-		try {
-			"X".charAt(99);
-		} catch (StringIndexOutOfBoundsException e) {
-			return;
-		}
-		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() {
-	}
+    /**
+     * @tests java.lang.StringIndexOutOfBoundsException#StringIndexOutOfBoundsException(java.lang.String)
+     */
+    public void test_ConstructorLjava_lang_String() {
+        StringIndexOutOfBoundsException e = new StringIndexOutOfBoundsException("fixture");
+        assertEquals("fixture", e.getMessage());
+        assertNull(e.getCause());
+    }
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/ThrowableTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/ThrowableTest.java?rev=437061&r1=437060&r2=437061&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/ThrowableTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/ThrowableTest.java Fri Aug 25 20:41:21 2006
@@ -18,37 +18,28 @@
 import java.io.PrintStream;
 import java.io.PrintWriter;
 
-public class ThrowableTest extends junit.framework.TestCase {
+import junit.framework.TestCase;
 
-	/**
-	 * @tests java.lang.Throwable#Throwable()
-	 */
-	public void test_Constructor() {
-		// Test for method java.lang.Throwable()
-		try {
-			if (true)
-				throw new Throwable();
-		} catch (Throwable e) {
-			return;
-		}
-		fail("Failed to throw Throwable");
-	}
+public class ThrowableTest extends TestCase {
 
 	/**
-	 * @tests java.lang.Throwable#Throwable(java.lang.String)
+	 * @tests java.lang.Throwable#Throwable()
 	 */
-	public void test_ConstructorLjava_lang_String() {
-		// Test for method java.lang.Throwable(java.lang.String)
-		try {
-			if (true)
-				throw new Throwable("Throw");
-		} catch (Throwable e) {
-			assertEquals("Threw Throwable with incorrect message", "Throw", e.getMessage()
-					);
-			return;
-		}
-		fail("Failed to throw Throwable");
-	}
+    public void test_Constructor() {
+        Throwable e = new Throwable();
+        assertNull(e.getMessage());
+        assertNull(e.getLocalizedMessage());
+        assertNull(e.getCause());
+    }
+
+    /**
+     * @tests java.lang.Throwable#Throwable(java.lang.String)
+     */
+    public void test_ConstructorLjava_lang_String() {
+        Throwable e = new Throwable("fixture");
+        assertEquals("fixture", e.getMessage());
+        assertNull(e.getCause());
+    }
 
 	/**
 	 * @tests java.lang.Throwable#fillInStackTrace()
@@ -204,19 +195,5 @@
 			return;
 		}
 		fail("Failed to throw Throwable");
-	}
-
-	/**
-	 * 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