harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lian...@apache.org
Subject svn commit: r518078 - /harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/NotSerializableExceptionTest.java
Date Wed, 14 Mar 2007 09:14:59 GMT
Author: liangyx
Date: Wed Mar 14 02:14:58 2007
New Revision: 518078

URL: http://svn.apache.org/viewvc?view=rev&rev=518078
Log:
Apply patch for HARMONY-3388([classlib][luni] Refactor the default constuctor of NotSerializableException)

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

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/NotSerializableExceptionTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/NotSerializableExceptionTest.java?view=diff&rev=518078&r1=518077&r2=518078
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/NotSerializableExceptionTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/NotSerializableExceptionTest.java
Wed Mar 14 02:14:58 2007
@@ -17,11 +17,7 @@
 
 package tests.api.java.io;
 
-import java.io.ByteArrayOutputStream;
 import java.io.NotSerializableException;
-import java.io.ObjectOutputStream;
-
-import tests.support.Support_StringReader;
 
 public class NotSerializableExceptionTest extends junit.framework.TestCase {
 
@@ -29,18 +25,8 @@
 	 * @tests java.io.NotSerializableException#NotSerializableException()
 	 */
 	public void test_Constructor() {
-		// Test for method java.io.NotSerializableException()
-		try {
-			ObjectOutputStream os = new ObjectOutputStream(
-					new ByteArrayOutputStream());
-			os.writeObject(new Support_StringReader("l"));
-		} catch (NotSerializableException e) {
-			// Correct
-			return;
-		} catch (Exception e) {
-			fail("Exception during test : " + e.getMessage());
-		}
-		fail("Failed to throw expected exception");
+        NotSerializableException nse = new NotSerializableException();
+        assertNull(nse.getMessage());
 	}
 
 	/**
@@ -48,17 +34,9 @@
 	 */
 	public void test_ConstructorLjava_lang_String() {
 		// Test for method java.io.NotSerializableException(java.lang.String)
-		try {
-			ObjectOutputStream os = new ObjectOutputStream(
-					new ByteArrayOutputStream());
-			os.writeObject(new Support_StringReader("l"));
-		} catch (NotSerializableException e) {
-			// Correct
-			return;
-		} catch (Exception e) {
-			fail("Exception during test : " + e.getMessage());
-		}
-		fail("Failed to throw expected exception");
+        String message = "Test message";
+        NotSerializableException nse = new NotSerializableException(message);
+        assertSame(message, nse.getMessage());
 	}
 
 	/**



Mime
View raw message