harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smish...@apache.org
Subject svn commit: r397369 - in /incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java: io/CharArrayWriterTest.java io/PipedOutputStreamTest.java io/PrintStreamTest.java io/StringWriterTest.java lang/reflect/FieldTest.java
Date Thu, 27 Apr 2006 02:37:00 GMT
Author: smishura
Date: Wed Apr 26 19:36:58 2006
New Revision: 397369

URL: http://svn.apache.org/viewcvs?rev=397369&view=rev
Log:
Apply final patch for HARMONY-353(improvements to junit test method usage) + missed update
for FieldTest

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/CharArrayWriterTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/PipedOutputStreamTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/PrintStreamTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/StringWriterTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/reflect/FieldTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/CharArrayWriterTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/CharArrayWriterTest.java?rev=397369&r1=397368&r2=397369&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/CharArrayWriterTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/CharArrayWriterTest.java
Wed Apr 26 19:36:58 2006
@@ -34,7 +34,7 @@
     public void test_Constructor() {
         // Test for method java.io.CharArrayWriter()
         cw = new CharArrayWriter(90);
-        assertTrue("Created incorrect writer", cw.size() == 0);
+        assertEquals("Created incorrect writer", 0, cw.size());
     }
 
     /**
@@ -43,7 +43,7 @@
     public void test_ConstructorI() {
         // Test for method java.io.CharArrayWriter(int)
         cw = new CharArrayWriter();
-        assertTrue("Created incorrect writer", cw.size() == 0);
+        assertEquals("Created incorrect writer", 0, cw.size());
     }
 
     /**
@@ -74,8 +74,8 @@
         try {
             char[] c = new char[100];
             cr.read(c, 0, 5);
-            assertTrue("Reset failed to reset buffer", "Hello"
-                    .equals(new String(c, 0, 5)));
+            assertEquals("Reset failed to reset buffer",
+                         "Hello", new String(c, 0, 5));
         } catch (IOException e) {
             fail("Exception during reset test : " + e.getMessage());
         }
@@ -86,9 +86,9 @@
      */
     public void test_size() {
         // Test for method int java.io.CharArrayWriter.size()
-        assertTrue("Returned incorrect size", cw.size() == 0);
+        assertEquals("Returned incorrect size", 0, cw.size());
         cw.write(hw, 5, 5);
-        assertTrue("Returned incorrect size", cw.size() == 5);
+        assertEquals("Returned incorrect size", 5, cw.size());
     }
 
     /**
@@ -101,8 +101,8 @@
         try {
             char[] c = new char[100];
             cr.read(c, 0, 10);
-            assertTrue("toCharArray failed to return correct array",
-                    "HelloWorld".equals(new String(c, 0, 10)));
+            assertEquals("toCharArray failed to return correct array",
+                         "HelloWorld", new String(c, 0, 10));
         } catch (IOException e) {
             fail("Exception during toCharArray test : " + e.getMessage());
         }
@@ -115,7 +115,8 @@
         // Test for method java.lang.String java.io.CharArrayWriter.toString()
         cw.write("HelloWorld", 5, 5);
         cr = new CharArrayReader(cw.toCharArray());
-        assertTrue("Returned incorrect string", "World".equals(cw.toString()));
+        assertEquals("Returned incorrect string",
+                     "World", cw.toString());
     }
 
     /**
@@ -128,8 +129,8 @@
         try {
             char[] c = new char[100];
             cr.read(c, 0, 5);
-            assertTrue("Writer failed to write correct chars", "World"
-                    .equals(new String(c, 0, 5)));
+            assertEquals("Writer failed to write correct chars",
+                         "World", new String(c, 0, 5));
         } catch (IOException e) {
             fail("Exception during write test : " + e.getMessage());
         }
@@ -159,7 +160,7 @@
         cw.write('T');
         cr = new CharArrayReader(cw.toCharArray());
         try {
-            assertTrue("Writer failed to write char", cr.read() == 'T');
+            assertEquals("Writer failed to write char", 'T', cr.read());
         } catch (IOException e) {
             fail("Exception during write test : " + e.getMessage());
         }
@@ -176,8 +177,8 @@
         try {
             char[] c = new char[100];
             cr.read(c, 0, 5);
-            assertTrue("Writer failed to write correct chars", "World"
-                    .equals(new String(c, 0, 5)));
+            assertEquals("Writer failed to write correct chars",
+                         "World", new String(c, 0, 5));
         } catch (IOException e) {
             fail("Exception during write test : " + e.getMessage());
         }
@@ -205,8 +206,8 @@
         StringWriter sw = new StringWriter();
         try {
             cw.writeTo(sw);
-            assertTrue("Writer failed to write correct chars", "HelloWorld"
-                    .equals(sw.toString()));
+            assertEquals("Writer failed to write correct chars",
+                         "HelloWorld", sw.toString());
         } catch (IOException e) {
             fail("Exception during writeTo test : " + e.getMessage());
         }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/PipedOutputStreamTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/PipedOutputStreamTest.java?rev=397369&r1=397368&r2=397369&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/PipedOutputStreamTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/PipedOutputStreamTest.java
Wed Apr 26 19:36:58 2006
@@ -196,7 +196,7 @@
 			rt.start();
 			out.write('c');
 			out.flush();
-			assertTrue("Wrote incorrect byte", reader.read(1).equals("c"));
+			assertEquals("Wrote incorrect byte", "c", reader.read(1));
 		} catch (IOException e) {
 			fail("IOException during write test : " + e.getMessage());
 		}

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/PrintStreamTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/PrintStreamTest.java?rev=397369&r1=397368&r2=397369&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/PrintStreamTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/PrintStreamTest.java
Wed Apr 26 19:36:58 2006
@@ -500,7 +500,7 @@
 		os = new java.io.PrintStream(bos, true);
 		os.write('t');
 		bis = new java.io.ByteArrayInputStream(bos.toByteArray());
-		assertTrue("Incorrect char written", bis.read() == 't');
+		assertEquals("Incorrect char written", 't', bis.read());
 	}
 	
 	

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/StringWriterTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/StringWriterTest.java?rev=397369&r1=397368&r2=397369&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/StringWriterTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/StringWriterTest.java
Wed Apr 26 19:36:58 2006
@@ -83,8 +83,8 @@
 		char[] c = new char[1000];
 		"This is a test string".getChars(0, 21, c, 0);
 		sw.write(c, 0, 21);
-		assertTrue("Chars not written properly", sw.toString().equals(
-				"This is a test string"));
+		assertEquals("Chars not written properly", 
+				"This is a test string", sw.toString());
 	}
 
     /**
@@ -140,7 +140,7 @@
 	public void test_writeI() {
 		// Test for method void java.io.StringWriter.write(int)
 		sw.write('c');
-		assertTrue("Char not written properly", sw.toString().equals("c"));
+		assertEquals("Char not written properly", "c", sw.toString());
 	}
 
 	/**
@@ -149,8 +149,8 @@
 	public void test_writeLjava_lang_String() {
 		// Test for method void java.io.StringWriter.write(java.lang.String)
 		sw.write("This is a test string");
-		assertTrue("String not written properly", sw.toString().equals(
-				"This is a test string"));
+		assertEquals("String not written properly", 
+				"This is a test string", sw.toString());
 	}
 
 	/**
@@ -160,7 +160,7 @@
 		// Test for method void java.io.StringWriter.write(java.lang.String,
 		// int, int)
 		sw.write("This is a test string", 2, 2);
-		assertTrue("String not written properly", sw.toString().equals("is"));
+		assertEquals("String not written properly", "is", sw.toString());
 	}
     
 	/**

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/reflect/FieldTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/reflect/FieldTest.java?rev=397369&r1=397368&r2=397369&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/reflect/FieldTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/reflect/FieldTest.java
Wed Apr 26 19:36:58 2006
@@ -125,8 +125,8 @@
 			f = x.getClass().getDeclaredField("doubleSField");
 			f.set(x, new Double(1.0));
 			val = (Double) f.get(x);
-			assertTrue("Returned incorrect double field value", val
-					.doubleValue() == 1.0);
+			assertEquals("Returned incorrect double field value", 1.0, val
+					.doubleValue());
 
 			// Try a get on a private field
 			try {
@@ -552,7 +552,7 @@
 		} catch (Exception e) {
 			fail("Exception during getCharacter test: " + e.toString());
 		}
-		assertTrue("Returned incorrect char field value", val == 'T');
+		assertEquals("Returned incorrect char field value", 'T', val);
 		try {
 			try {
 				f = x.getClass().getDeclaredField("booleanField");
@@ -749,8 +749,8 @@
 		} catch (Exception e) {
 			fail("Exception during getType test : " + e.getMessage());
 		}
-		assertTrue("Returned incorrect field name", f.getName().equals(
-				"shortField"));
+		assertEquals("Returned incorrect field name", 
+				"shortField", f.getName());
 	}
 
 	/**
@@ -818,7 +818,7 @@
 		} catch (Exception e) {
 			fail("Exception during set test : " + e.getMessage());
 		}
-		assertTrue("Returned incorrect double field value", val == 1.0);
+		assertEquals("Returned incorrect double field value", 1.0, val);
 		try {
 			try {
 				f = x.getClass().getDeclaredField("booleanField");
@@ -840,7 +840,7 @@
 			f = x.getClass().getDeclaredField("doubleSField");
 			f.set(x, new Double(1.0));
 			val = f.getDouble(x);
-			assertTrue("Returned incorrect double field value", val == 1.0);
+			assertEquals("Returned incorrect double field value", 1.0, val);
 		} catch (Exception e) {
 			fail("Exception during setDouble test: " + e.toString());
 		}
@@ -904,7 +904,7 @@
 		} catch (Exception e) {
 			fail("Exception during setByte test : " + e.getMessage());
 		}
-		assertTrue("Returned incorrect float field value", val == 1);
+		assertEquals("Returned incorrect float field value", 1, val);
 		try {
 			try {
 				f = x.getClass().getDeclaredField("booleanField");
@@ -945,7 +945,7 @@
 		} catch (Exception e) {
 			fail("Exception during setChar test : " + e.getMessage());
 		}
-		assertTrue("Returned incorrect float field value", val == 1);
+		assertEquals("Returned incorrect float field value", 1, val);
 		try {
 			try {
 				f = x.getClass().getDeclaredField("booleanField");
@@ -986,7 +986,7 @@
 		} catch (Exception e) {
 			fail("Exception during setDouble test: " + e.toString());
 		}
-		assertTrue("Returned incorrect double field value", val == 1.0);
+		assertEquals("Returned incorrect double field value", 1.0, val);
 		try {
 			try {
 				f = x.getClass().getDeclaredField("booleanField");
@@ -1067,7 +1067,7 @@
 		} catch (Exception e) {
 			fail("Exception during setInteger test: " + e.toString());
 		}
-		assertTrue("Returned incorrect int field value", val == 1);
+		assertEquals("Returned incorrect int field value", 1, val);
 		try {
 			try {
 				f = x.getClass().getDeclaredField("booleanField");
@@ -1107,7 +1107,7 @@
 		} catch (Exception e) {
 			fail("Exception during setLong test : " + e.getMessage());
 		}
-		assertTrue("Returned incorrect long field value", val == 1);
+		assertEquals("Returned incorrect long field value", 1, val);
 		try {
 			try {
 				f = x.getClass().getDeclaredField("booleanField");
@@ -1147,7 +1147,7 @@
 		} catch (Exception e) {
 			fail("Exception during setShort test : " + e.getMessage());
 		}
-		assertTrue("Returned incorrect short field value", val == 1);
+		assertEquals("Returned incorrect short field value", 1, val);
 		try {
 			try {
 				f = x.getClass().getDeclaredField("booleanField");
@@ -1183,12 +1183,9 @@
 		} catch (Exception e) {
 			fail("Exception getting field : " + e.getMessage());
 		}
-		assertTrue(
-				"Field returned incorrect string",
-				f
-						.toString()
-						.equals(
-								"private static final int tests.api.java.lang.reflect.FieldTest$TestField.x"));
+		assertEquals("Field returned incorrect string",
+				"private static final int tests.api.java.lang.reflect.FieldTest$TestField.x",
+						f.toString());
 	}
 
 	/**



Mime
View raw message