You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by li...@apache.org on 2007/03/13 10:54:43 UTC

svn commit: r517623 - /harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/NotActiveExceptionTest.java

Author: liangyx
Date: Tue Mar 13 02:54:42 2007
New Revision: 517623

URL: http://svn.apache.org/viewvc?view=rev&rev=517623
Log:
Apply patch for HARMONY-3354([classlib][test] Refactor test for java.io.NotActiveException's default constructor)

Modified:
    harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/NotActiveExceptionTest.java

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/NotActiveExceptionTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/NotActiveExceptionTest.java?view=diff&rev=517623&r1=517622&r2=517623
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/NotActiveExceptionTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/NotActiveExceptionTest.java Tue Mar 13 02:54:42 2007
@@ -26,37 +26,20 @@
 	/**
 	 * @tests java.io.NotActiveException#NotActiveException()
 	 */
-	public void test_Constructor() {
-		// Test for method java.io.NotActiveException()
-		try {
-			ObjectOutputStream os = new ObjectOutputStream(
-					new ByteArrayOutputStream());
-			os.defaultWriteObject();
-		} catch (NotActiveException e) {
-			// Correct
-			return;
-		} catch (Exception e) {
-			fail("Exception during test : " + e.getMessage());
-		}
-		fail("Failed to throw exception");
-	}
+    public void test_Constructor() {
+        // Test for method java.io.NotActiveException()
+        NotActiveException e = new NotActiveException();
+        assertNull(e.getMessage());
+    }
 
 	/**
 	 * @tests java.io.NotActiveException#NotActiveException(java.lang.String)
 	 */
 	public void test_ConstructorLjava_lang_String() {
 		// Test for method java.io.NotActiveException(java.lang.String)
-		try {
-			ObjectOutputStream os = new ObjectOutputStream(
-					new ByteArrayOutputStream());
-			os.defaultWriteObject();
-		} catch (NotActiveException e) {
-			// Correct
-			return;
-		} catch (Exception e) {
-			fail("Exception during test : " + e.getMessage());
-		}
-		fail("Failed to throw expected exception");
+        String message = "Exception message";
+        NotActiveException e = new NotActiveException(message);
+        assertSame(message, e.getMessage());
 	}
 
 	/**