You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by sm...@apache.org on 2006/04/26 10:39:51 UTC

svn commit: r397147 - in /incubator/harmony/enhanced/classlib/trunk: modules/jndi/src/test/java/tests/api/javax/naming/directory/ modules/logging/src/test/java/tests/api/java/util/logging/ support/src/test/java/tests/support/

Author: smishura
Date: Wed Apr 26 01:39:50 2006
New Revision: 397147

URL: http://svn.apache.org/viewcvs?rev=397147&view=rev
Log:
Apply patch for HARMONY-353 (improvements to junit test method usage) for jndi, loggining modules and support classes. All tests passed on Windows.

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/tests/api/javax/naming/directory/TestSearchControls.java
    incubator/harmony/enhanced/classlib/trunk/modules/logging/src/test/java/tests/api/java/util/logging/StreamHandlerTest.java
    incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_HttpTests.java
    incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_ListTest.java
    incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_MapTest2.java
    incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_UnmodifiableMapTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/tests/api/javax/naming/directory/TestSearchControls.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/tests/api/javax/naming/directory/TestSearchControls.java?rev=397147&r1=397146&r2=397147&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/tests/api/javax/naming/directory/TestSearchControls.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/tests/api/javax/naming/directory/TestSearchControls.java Wed Apr 26 01:39:50 2006
@@ -140,7 +140,7 @@
 		SearchControls ctrl;
 
 		ctrl = new SearchControls();
-		assertTrue(ctrl.toString() != null);
+		assertNotNull(ctrl.toString());
 	}
 
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/logging/src/test/java/tests/api/java/util/logging/StreamHandlerTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/logging/src/test/java/tests/api/java/util/logging/StreamHandlerTest.java?rev=397147&r1=397146&r2=397147&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/logging/src/test/java/tests/api/java/util/logging/StreamHandlerTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/logging/src/test/java/tests/api/java/util/logging/StreamHandlerTest.java Wed Apr 26 01:39:50 2006
@@ -381,8 +381,8 @@
 		assertEquals("flush", CallVerificationStack.getInstance()
 				.getCurrentSourceMethod());
 		CallVerificationStack.getInstance().clear();
-		assertTrue(aos.toString()
-				.equals("MockFormatter_HeadMockFormatter_Tail"));
+		assertEquals("MockFormatter_HeadMockFormatter_Tail", aos.toString()
+				);
 	}
 
 	/*

Modified: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_HttpTests.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_HttpTests.java?rev=397147&r1=397146&r2=397147&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_HttpTests.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_HttpTests.java Wed Apr 26 01:39:50 2006
@@ -79,8 +79,8 @@
 			c = is.read();
 			is.close();
 			connector.close();
-			TestCase.assertTrue("Error receiving chunked transfer coded data",
-					c == -1);
+			TestCase.assertEquals("Error receiving chunked transfer coded data",
+					-1, c);
 		} catch (Exception e) {
 			e.printStackTrace();
 			TestCase.fail("Exception during test a: " + e);
@@ -375,9 +375,8 @@
 				connector.close();
 
 				c = is.read();
-				TestCase.assertTrue(
-								"Incorrect data returned on redirection to a different port.",
-								c == 'A');
+				TestCase.assertEquals("Incorrect data returned on redirection to a different port.",
+								'A', c);
 				while (c > 0)
 					c = is.read();
 				c = is.read();
@@ -402,8 +401,8 @@
 			connector.close();
 
 			c = is.read();
-			TestCase.assertTrue("Incorrect data returned on redirect to relative URI.",
-					c == 'A');
+			TestCase.assertEquals("Incorrect data returned on redirect to relative URI.",
+					'A', c);
 			while (c > 0)
 				c = is.read();
 			c = is.read();

Modified: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_ListTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_ListTest.java?rev=397147&r1=397146&r2=397147&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_ListTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_ListTest.java Wed Apr 26 01:39:50 2006
@@ -92,7 +92,7 @@
 				list.get(49).equals(new Integer(49)));
 
 		List mySubList = list.subList(50, 53);
-		assertTrue(mySubList.size() == 3);
+		assertEquals(3, mySubList.size());
 		assertTrue(
 				"ListTest - a) sublist Failed--does not contain correct elements",
 				mySubList.get(0).equals(new Integer(500)));
@@ -106,9 +106,8 @@
 		t_listIterator(mySubList);
 
 		mySubList.clear();
-		assertTrue(
-				"ListTest - Clearing the sublist did not remove the appropriate elements from the original list",
-				list.size() == 100);
+		assertEquals("ListTest - Clearing the sublist did not remove the appropriate elements from the original list",
+				100, list.size());
 
 		t_listIterator(list);
 		ListIterator li = list.listIterator();
@@ -182,25 +181,25 @@
 		Integer add2 = new Integer(601);
 		li.add(add1);
 		assertTrue("list iterator add(), size()", list.size() == (orgSize + 1));
-		assertTrue("list iterator add(), nextIndex()", li.nextIndex() == 1);
-		assertTrue("list iterator add(), previousIndex()",
-				li.previousIndex() == 0);
+		assertEquals("list iterator add(), nextIndex()", 1, li.nextIndex());
+		assertEquals("list iterator add(), previousIndex()",
+				0, li.previousIndex());
 		Object next = li.next();
 		assertTrue("list iterator add(), next(): " + next, next == list.get(1));
 		li.add(add2);
 		Object previous = li.previous();
 		assertTrue("list iterator add(), previous(): " + previous,
 				previous == add2);
-		assertTrue("list iterator add(), nextIndex()2", li.nextIndex() == 2);
-		assertTrue("list iterator add(), previousIndex()2",
-				li.previousIndex() == 1);
+		assertEquals("list iterator add(), nextIndex()2", 2, li.nextIndex());
+		assertEquals("list iterator add(), previousIndex()2",
+				1, li.previousIndex());
 
 		li.remove();
 		assertTrue("list iterator remove(), size()",
 				list.size() == (orgSize + 1));
-		assertTrue("list iterator remove(), nextIndex()", li.nextIndex() == 2);
-		assertTrue("list iterator remove(), previousIndex()", li
-				.previousIndex() == 1);
+		assertEquals("list iterator remove(), nextIndex()", 2, li.nextIndex());
+		assertEquals("list iterator remove(), previousIndex()", 1, li
+				.previousIndex());
 		assertTrue("list iterator previous()2", li.previous() == list.get(1));
 		assertTrue("list iterator previous()3", li.previous() == list.get(0));
 		assertTrue("list iterator next()2", li.next() == list.get(0));
@@ -208,7 +207,7 @@
 		assertTrue("list iterator hasPrevious()3", !li.hasPrevious());
 		assertTrue("list iterator hasNext()3", li.hasNext());
 		assertTrue("list iterator size()", list.size() == orgSize);
-		assertTrue("list iterator nextIndex()3", li.nextIndex() == 0);
-		assertTrue("list iterator previousIndex()3", li.previousIndex() == -1);
+		assertEquals("list iterator nextIndex()3", 0, li.nextIndex());
+		assertEquals("list iterator previousIndex()3", -1, li.previousIndex());
 	}
 }

Modified: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_MapTest2.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_MapTest2.java?rev=397147&r1=397146&r2=397147&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_MapTest2.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_MapTest2.java Wed Apr 26 01:39:50 2006
@@ -32,9 +32,9 @@
 	public void runTest() {
 		try {
 			map.put("one", "1");
-			assertTrue("size should be one", map.size() == 1);
+			assertEquals("size should be one", 1, map.size());
 			map.clear();
-			assertTrue("size should be zero", map.size() == 0);
+			assertEquals("size should be zero", 0, map.size());
 			assertTrue("Should not have entries", !map.entrySet().iterator()
 					.hasNext());
 			assertTrue("Should not have keys", !map.keySet().iterator()
@@ -46,9 +46,9 @@
 
 		try {
 			map.put("one", "1");
-			assertTrue("size should be one", map.size() == 1);
+			assertEquals("size should be one", 1, map.size());
 			map.remove("one");
-			assertTrue("size should be zero", map.size() == 0);
+			assertEquals("size should be zero", 0, map.size());
 			assertTrue("Should not have entries", !map.entrySet().iterator()
 					.hasNext());
 			assertTrue("Should not have keys", !map.keySet().iterator()

Modified: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_UnmodifiableMapTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_UnmodifiableMapTest.java?rev=397147&r1=397146&r2=397147&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_UnmodifiableMapTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_UnmodifiableMapTest.java Wed Apr 26 01:39:50 2006
@@ -63,17 +63,16 @@
 					map.get(me.getKey()).equals(me.getValue()));
 			myCounter++;
 		}
-		assertTrue(
-				"UnmodifiableMapTest - Incorrect number of map entries returned",
-				myCounter == 100);
+		assertEquals("UnmodifiableMapTest - Incorrect number of map entries returned",
+				100, myCounter);
 
 		// get
 		assertTrue("UnmodifiableMapTest - getting \"0\" didn't return 0",
 				((Integer) map.get("0")).intValue() == 0);
 		assertTrue("UnmodifiableMapTest - getting \"50\" didn't return 0",
 				((Integer) map.get("0")).intValue() == 0);
-		assertTrue("UnmodifiableMapTest - getting \"100\" didn't return null",
-				map.get("100") == null);
+		assertNull("UnmodifiableMapTest - getting \"100\" didn't return null",
+				map.get("100"));
 
 		// isEmpty
 		assertTrue(