harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From py...@apache.org
Subject svn commit: r527460 - in /harmony/enhanced/classlib/trunk/modules/luni/src/test/java: org/apache/harmony/luni/tests/java/io/ObjectInputStreamTest.java tests/api/java/io/FilterInputStreamTest.java
Date Wed, 11 Apr 2007 11:58:23 GMT
Author: pyang
Date: Wed Apr 11 04:58:22 2007
New Revision: 527460

URL: http://svn.apache.org/viewvc?view=rev&rev=527460
Log:
Apply patch for HARMONY-3612([classlib][luni]Add test cases for java.io.FilterInputStream
and ObjectInputStream)

Modified:
    harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/io/ObjectInputStreamTest.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/FilterInputStreamTest.java

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/io/ObjectInputStreamTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/io/ObjectInputStreamTest.java?view=diff&rev=527460&r1=527459&r2=527460
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/io/ObjectInputStreamTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/io/ObjectInputStreamTest.java
Wed Apr 11 04:58:22 2007
@@ -29,6 +29,8 @@
 import java.io.Serializable;
 import java.util.ArrayList;
 
+import org.apache.harmony.testframework.serialization.SerializationTest;
+
 import junit.framework.TestCase;
 
 public class ObjectInputStreamTest extends TestCase {
@@ -72,6 +74,44 @@
 	    assertFalse("should not construct self", B.list.contains(b));
 	    assertEquals("super field A.s", A.DEFAULT, ((A)b).s);
 	    assertNull("transient field B.s", b.s);
+	}
+	
+	/**
+	 * @tests {@link java.io.ObjectInputStream#readNewLongString()}
+	 */
+	public void test_readNewLongString() throws Exception {
+		LongString longString = new LongString();
+		SerializationTest.verifySelf(longString);
+	}
+	
+	private static class LongString implements Serializable{
+		String lString;
+		
+		public LongString() {
+			StringBuilder builder = new StringBuilder();
+			// construct a string whose length > 64K
+			for (int i = 0; i < 65636; i++) {
+				builder.append('1');
+			}
+			lString = builder.toString();
+		}
+		
+		@Override
+		public boolean equals(Object o) {
+			if (o == this) {
+				return true;
+			}
+			if (o instanceof LongString) {
+				LongString l = (LongString) o;
+				return l.lString.equals(l.lString);
+			}
+			return true;
+		}
+		
+		@Override
+		public int hashCode() {
+			return lString.hashCode();
+		}
 	}
 
 	static class A { 

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/FilterInputStreamTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/FilterInputStreamTest.java?view=diff&rev=527460&r1=527459&r2=527460
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/FilterInputStreamTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/FilterInputStreamTest.java
Wed Apr 11 04:58:22 2007
@@ -17,6 +17,8 @@
 
 package tests.api.java.io;
 
+import java.io.IOException;
+
 import tests.support.Support_PlatformFile;
 
 public class FilterInputStreamTest extends junit.framework.TestCase {
@@ -134,7 +136,12 @@
 	 */
 	public void test_reset() {
 		// Test for method void java.io.FilterInputStream.reset()
-		assertTrue("Not supported by underlying stream", true);
+        try {
+            is.reset();
+            fail("should throw IOException");
+        } catch (IOException e) {
+            // expected
+        }
 	}
 
 	/**



Mime
View raw message