harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smish...@apache.org
Subject svn commit: r397123 [5/7] - in /incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java: org/apache/harmony/tests/java/util/ tests/api/java/io/ tests/api/java/lang/ tests/api/java/lang/ref/ tests/api/java/lang/reflect/ tests/api/java/net/ ...
Date Wed, 26 Apr 2006 07:12:49 GMT
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/SocketTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/SocketTest.java?rev=397123&r1=397122&r2=397123&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/SocketTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/SocketTest.java Wed Apr 26 00:12:16 2006
@@ -350,7 +350,7 @@
 			s = new Socket(InetAddress.getLocalHost(), sport, null, portNumber);
 			(t = new SServer()).start();
 			java.io.InputStream is = s.getInputStream();
-			assertTrue("Failed to get stream", is != null);
+			assertNotNull("Failed to get stream", is);
 			s.setSoTimeout(6000);
 			is.read();
 			s.close();
@@ -502,7 +502,7 @@
 			int portNumber = Support_PortManager.getNextPort();
 			s = new Socket(InetAddress.getLocalHost(), sport, null, portNumber);
 			java.io.OutputStream os = s.getOutputStream();
-			assertTrue("Failed to get stream", os != null);
+			assertNotNull("Failed to get stream", os);
 			tearDown();
 		} catch (Exception e) {
 			fail("Exception during getOutputStream test" + e.toString());
@@ -591,7 +591,7 @@
 			int portNumber = Support_PortManager.getNextPort();
 			s = new Socket(InetAddress.getLocalHost(), sport, null, portNumber);
 			s.setSoLinger(true, 200);
-			assertTrue("Returned incorrect linger", s.getSoLinger() == 200);
+			assertEquals("Returned incorrect linger", 200, s.getSoLinger());
 			ensureExceptionThrownIfOptionIsUnsupportedOnOS(SO_LINGER);
 			s.setSoLinger(false, 0);
 		} catch (Exception e) {
@@ -642,7 +642,7 @@
 			int sport = startServer("SServer getSoTimeout");
 			s = new Socket(InetAddress.getLocalHost(), sport);
 			s.setSoTimeout(100);
-			assertTrue("Returned incorrect sotimeout", s.getSoTimeout() == 100);
+			assertEquals("Returned incorrect sotimeout", 100, s.getSoTimeout());
 			ensureExceptionThrownIfOptionIsUnsupportedOnOS(SO_TIMEOUT);
 		} catch (Exception e) {
 			handleException(e, SO_TIMEOUT);
@@ -740,7 +740,7 @@
 			int portNumber = Support_PortManager.getNextPort();
 			s = new Socket(InetAddress.getLocalHost(), sport, null, portNumber);
 			s.setSoLinger(true, 500);
-			assertTrue("Set incorrect linger", s.getSoLinger() == 500);
+			assertEquals("Set incorrect linger", 500, s.getSoLinger());
 			ensureExceptionThrownIfOptionIsUnsupportedOnOS(SO_LINGER);
 			s.setSoLinger(false, 0); 
 		} catch (Exception e) {
@@ -758,7 +758,7 @@
 			int portNumber = Support_PortManager.getNextPort();
 			s = new Socket(InetAddress.getLocalHost(), sport, null, portNumber);
 			s.setSoTimeout(100);
-			assertTrue("Set incorrect sotimeout", s.getSoTimeout() == 100);
+			assertEquals("Set incorrect sotimeout", 100, s.getSoTimeout());
 			ensureExceptionThrownIfOptionIsUnsupportedOnOS(SO_TIMEOUT);
 		} catch (Exception e) {
 			handleException(e, SO_TIMEOUT);
@@ -908,9 +908,9 @@
 			// now create a socket that is not bound and validate we get the
 			// right answer
 			Socket theSocket = new Socket();
-			assertTrue(
+			assertNull(
 					"Returned incorrect InetSocketAddress -unbound socket- Expected null",
-					theSocket.getLocalSocketAddress() == null);
+					theSocket.getLocalSocketAddress());
 
 			// now bind the socket and make sure we get the right answer
 			portNumber = Support_PortManager.getNextPort();
@@ -1001,10 +1001,10 @@
 			theSocket.bind(new InetSocketAddress(InetAddress.getLocalHost(),
 					portNumber));
 
-			assertTrue(
+			assertNull(
 					"Returned incorrect InetSocketAddress -unconnected socket:"
 							+ "Expected: NULL", theSocket
-							.getRemoteSocketAddress() == null);
+							.getRemoteSocketAddress());
 
 			// now connect and validate we get the right answer
 			theSocket.connect(new InetSocketAddress(InetAddress.getLocalHost(),
@@ -1210,8 +1210,8 @@
 			// all is ok
 			theSocket = new Socket();
 			theSocket.bind(null);
-			assertTrue("Bind with null did not work", theSocket
-					.getLocalSocketAddress() != null);
+			assertNotNull("Bind with null did not work", theSocket
+					.getLocalSocketAddress());
 			theSocket.close();
 
 			// now check the error conditions
@@ -1810,12 +1810,12 @@
 			connector.start();
 			theSocket.setSoTimeout(100);
 			Thread.sleep(10);
-			assertTrue("Socket option not set during connect: 10 ", theSocket
-					.getSoTimeout() == 100);
+			assertEquals("Socket option not set during connect: 10 ", 100, theSocket
+					.getSoTimeout());
 			Thread.sleep(50);
 			theSocket.setSoTimeout(200);
-			assertTrue("Socket option not set during connect: 50 ", theSocket
-					.getSoTimeout() == 200);
+			assertEquals("Socket option not set during connect: 50 ", 200, theSocket
+					.getSoTimeout());
 			Thread.sleep(5000);
 			theSocket.close();
 		} catch (Exception e) {

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/URITest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/URITest.java?rev=397123&r1=397122&r2=397123&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/URITest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/URITest.java Wed Apr 26 00:12:16 2006
@@ -253,15 +253,15 @@
 		URI uri;
 		try {
 			uri = new URI("mailto", "mduerst@ifi.unizh.ch", null);
-			assertTrue("wrong userinfo", uri.getUserInfo() == null);
-			assertTrue("wrong hostname", uri.getHost() == null);
-			assertTrue("wrong authority", uri.getAuthority() == null);
-			assertTrue("wrong port number", uri.getPort() == -1);
-			assertTrue("wrong path", uri.getPath() == null);
-			assertTrue("wrong query", uri.getQuery() == null);
-			assertTrue("wrong fragment", uri.getFragment() == null);
-			assertTrue("wrong SchemeSpecificPart", uri.getSchemeSpecificPart()
-					.equals("mduerst@ifi.unizh.ch"));
+			assertNull("wrong userinfo", uri.getUserInfo());
+			assertNull("wrong hostname", uri.getHost());
+			assertNull("wrong authority", uri.getAuthority());
+			assertEquals("wrong port number", -1, uri.getPort());
+			assertNull("wrong path", uri.getPath());
+			assertNull("wrong query", uri.getQuery());
+			assertNull("wrong fragment", uri.getFragment());
+			assertEquals("wrong SchemeSpecificPart", "mduerst@ifi.unizh.ch", uri.getSchemeSpecificPart()
+					);
 		} catch (URISyntaxException e) {
 			fail("Unexpected Exception: " + e);
 		}
@@ -350,14 +350,14 @@
 		try {
 			uri = new URI("http", "us:e@r", "hostname", 85, "/file/dir#/qu?e/",
 					"qu?er#y", "frag#me?nt");
-			assertTrue("wrong userinfo", uri.getUserInfo().equals("us:e@r"));
-			assertTrue("wrong hostname", uri.getHost().equals("hostname"));
-			assertTrue("wrong port number", uri.getPort() == 85);
-			assertTrue("wrong path", uri.getPath().equals("/file/dir#/qu?e/"));
-			assertTrue("wrong query", uri.getQuery().equals("qu?er#y"));
-			assertTrue("wrong fragment", uri.getFragment().equals("frag#me?nt"));
-			assertTrue("wrong SchemeSpecificPart", uri.getSchemeSpecificPart()
-					.equals("//us:e@r@hostname:85/file/dir#/qu?e/?qu?er#y"));
+			assertEquals("wrong userinfo", "us:e@r", uri.getUserInfo());
+			assertEquals("wrong hostname", "hostname", uri.getHost());
+			assertEquals("wrong port number", 85, uri.getPort());
+			assertEquals("wrong path", "/file/dir#/qu?e/", uri.getPath());
+			assertEquals("wrong query", "qu?er#y", uri.getQuery());
+			assertEquals("wrong fragment", "frag#me?nt", uri.getFragment());
+			assertEquals("wrong SchemeSpecificPart", "//us:e@r@hostname:85/file/dir#/qu?e/?qu?er#y", uri.getSchemeSpecificPart()
+					);
 		} catch (URISyntaxException e) {
 			fail("Unexpected Exception: " + e);
 		}
@@ -447,29 +447,28 @@
 			fail("Unexpected URISyntaxException: " + e);
 		}
 
-		assertTrue("wrong scheme", uri.getScheme().equals("ht12-3+tp"));
-		assertTrue("wrong authority", uri.getUserInfo() == null);
-		assertTrue("wrong userinfo", uri.getUserInfo() == null);
-		assertTrue("wrong hostname", uri.getHost() == null);
-		assertTrue("wrong port number", uri.getPort() == -1);
-		assertTrue("wrong path", uri.getPath().equals("/p#a%E2%82%ACth"));
-		assertTrue("wrong query", uri.getQuery().equals("q^u%25ery"));
-		assertTrue("wrong fragment", uri.getFragment().equals("f/r\u00DFag"));
+		assertEquals("wrong scheme", "ht12-3+tp", uri.getScheme());
+		assertNull("wrong authority", uri.getUserInfo());
+		assertNull("wrong userinfo", uri.getUserInfo());
+		assertNull("wrong hostname", uri.getHost());
+		assertEquals("wrong port number", -1, uri.getPort());
+		assertEquals("wrong path", "/p#a%E2%82%ACth", uri.getPath());
+		assertEquals("wrong query", "q^u%25ery", uri.getQuery());
+		assertEquals("wrong fragment", "f/r\u00DFag", uri.getFragment());
 		// equivalent to = assertTrue("wrong fragment",
 		// uri.getFragment().equals("f/r\u00dfag"));
-		assertTrue("wrong SchemeSpecificPart", uri.getSchemeSpecificPart()
-				.equals("///p#a%E2%82%ACth?q^u%25ery"));
-		assertTrue("wrong RawSchemeSpecificPart", uri
-				.getRawSchemeSpecificPart().equals(
-						"///p%23a%25E2%2582%25ACth?q%5Eu%2525ery"));
-		assertTrue("incorrect toString()", uri.toString().equals(
-				"ht12-3+tp:///p%23a%25E2%2582%25ACth?q%5Eu%2525ery#f/r\u00dfag"));
-		assertTrue(
-				"incorrect toASCIIString()",
-				uri
+		assertEquals("wrong SchemeSpecificPart", "///p#a%E2%82%ACth?q^u%25ery", uri.getSchemeSpecificPart()
+				);
+		assertEquals("wrong RawSchemeSpecificPart", 
+						"///p%23a%25E2%2582%25ACth?q%5Eu%2525ery", uri
+				.getRawSchemeSpecificPart());
+		assertEquals("incorrect toString()", 
+				"ht12-3+tp:///p%23a%25E2%2582%25ACth?q%5Eu%2525ery#f/r\u00dfag", uri.toString());
+		assertEquals("incorrect toASCIIString()",
+				
+								"ht12-3+tp:///p%23a%25E2%2582%25ACth?q%5Eu%2525ery#f/r%C3%9Fag", uri
 						.toASCIIString()
-						.equals(
-								"ht12-3+tp:///p%23a%25E2%2582%25ACth?q%5Eu%2525ery#f/r%C3%9Fag"));
+						);
 	}
 
 	/**

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/URLClassLoaderTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/URLClassLoaderTest.java?rev=397123&r1=397122&r2=397123&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/URLClassLoaderTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/URLClassLoaderTest.java Wed Apr 26 00:12:16 2006
@@ -74,8 +74,8 @@
 		URL[] u = new URL[0];
 		ucl = new URLClassLoader(u, cl);
 		URL res = ucl.getResource("J");
-		assertTrue("Failed to set parent", res == null ? false : res.getFile()
-				.equals("/BogusClassLoader"));
+		assertEquals("Failed to set parent", "/BogusClassLoader", res == null ? false : res.getFile()
+				);
 	}
 
 	/**
@@ -162,10 +162,10 @@
 
 		try {
 			res = cl.getClassLoader().getResource("XX.class");
-			assertTrue("Failed to load class", cl != null);
-			assertTrue(
+			assertNotNull("Failed to load class", cl);
+			assertNotNull(
 					"Loaded class unable to access resource from same codeSource",
-					res != null);
+					res);
 			cl = null;
 		} catch (Error e) {
 			fail("Test error : " + e.getMessage());
@@ -178,7 +178,7 @@
 		} catch (Exception e) {
 			fail("Exception using explicit jar : " + e.getMessage());
 		}
-		assertTrue("Failed to load class from explicit jar URL", cl != null);
+		assertNotNull("Failed to load class from explicit jar URL", cl);
 	}
 
 	/**
@@ -190,8 +190,8 @@
 		URL[] u = new URL[0];
 		ucl = URLClassLoader.newInstance(u, cl);
 		URL res = ucl.getResource("J");
-		assertTrue("Failed to set parent", res == null ? false : res.getFile()
-				.equals("/BogusClassLoader"));
+		assertEquals("Failed to set parent", "/BogusClassLoader", res == null ? false : res.getFile()
+				);
 	}
 
 	/**
@@ -208,8 +208,8 @@
 		URL[] u = new URL[0];
 		ucl = new URLClassLoader(u, cl, new TestFactory());
 		URL res = ucl.getResource("J");
-		assertTrue("Failed to set parent", res == null ? false : res.getFile()
-				.equals("/BogusClassLoader"));
+		assertEquals("Failed to set parent", "/BogusClassLoader", res == null ? false : res.getFile()
+				);
 	}
 
 	/**
@@ -313,8 +313,8 @@
 					.copyFile(resources, "JarIndex", "hyts_22-new.jar");
 			urls[0] = new URL("file:/" + resPath + "/JarIndex/hyts_22-new.jar");
 			ucl = URLClassLoader.newInstance(urls, null);
-			assertTrue("Cannot find resource",
-					ucl.findResource("cpack/") != null);
+			assertNotNull("Cannot find resource",
+					ucl.findResource("cpack/"));
 			Support_Resources.copyFile(resources, "JarIndex", "hyts_11.jar");
 			urls[0] = new URL("file:/" + resPath + "/JarIndex/hyts_31.jar");
 			ucl = URLClassLoader.newInstance(urls, null);

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/URLConnectionTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/URLConnectionTest.java?rev=397123&r1=397122&r2=397123&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/URLConnectionTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/URLConnectionTest.java Wed Apr 26 00:12:16 2006
@@ -84,8 +84,8 @@
 	 */
 	public void test_getContentEncoding() {
 		// should not be known for a file
-		assertTrue("getContentEncoding failed: " + uc.getContentEncoding(), uc
-				.getContentEncoding() == null);
+		assertNull("getContentEncoding failed: " + uc.getContentEncoding(), uc
+				.getContentEncoding());
 	}
 
 	/**
@@ -109,8 +109,8 @@
 			Support_Resources.copyFile(resources, null, "Harmony.GIF");
 			URL url = new URL("file:/" + resources.toString() + "/Harmony.GIF");
 			URLConnection conn = url.openConnection();
-			assertTrue("type not GIF", conn.getContentType()
-					.equals("image/gif"));
+			assertEquals("type not GIF", "image/gif", conn.getContentType()
+					);
 		} catch (MalformedURLException e) {
 			fail("MalformedURLException for .gif");
 		} catch (IOException e) {
@@ -152,19 +152,19 @@
 	public void test_getDefaultRequestPropertyLjava_lang_String() {
 		try {
 			URLConnection.setDefaultRequestProperty("Shmoo", "Blah");
-			assertTrue(
+			assertNull(
 					"setDefaultRequestProperty should have returned: null, but returned: "
 							+ URLConnection.getDefaultRequestProperty("Shmoo"),
-					URLConnection.getDefaultRequestProperty("Shmoo") == null);
+					URLConnection.getDefaultRequestProperty("Shmoo"));
 			URLConnection.setDefaultRequestProperty("Shmoo", "Boom");
-			assertTrue(
+			assertNull(
 					"setDefaultRequestProperty should have returned: null, but returned: "
 							+ URLConnection.getDefaultRequestProperty("Shmoo"),
-					URLConnection.getDefaultRequestProperty("Shmoo") == null);
-			assertTrue(
+					URLConnection.getDefaultRequestProperty("Shmoo"));
+			assertNull(
 					"setDefaultRequestProperty should have returned: null, but returned: "
 							+ URLConnection.getDefaultRequestProperty("Kapow"),
-					URLConnection.getDefaultRequestProperty("Kapow") == null);
+					URLConnection.getDefaultRequestProperty("Kapow"));
 			URLConnection.setDefaultRequestProperty("Shmoo", null);
 		} catch (Exception e) {
 			fail("Exception during test : " + e.getMessage());
@@ -227,8 +227,8 @@
 			}
 		});
 		try {
-			assertTrue("Incorrect FileNameMap returned", URLConnection.getFileNameMap()
-					.getContentTypeFor(null).equals("Spam!"));
+			assertEquals("Incorrect FileNameMap returned", "Spam!", URLConnection.getFileNameMap()
+					.getContentTypeFor(null));
 		} finally {
 			// unset the map so other tests don't fail
 			URLConnection.setFileNameMap(null);
@@ -270,7 +270,7 @@
 		assertEquals("yo2", uc.getRequestProperty("prop"));
 		Map map = uc.getRequestProperties();
 		List props = (List) uc.getRequestProperties().get("prop");
-		assertTrue(props.size() == 1);
+		assertEquals(1, props.size());
 
 		try {
 			// the map should be unmodifiable
@@ -293,7 +293,7 @@
 			JarURLConnection con1 = (JarURLConnection) fUrl1.openConnection();
 			map = con1.getRequestProperties();
 			assertNotNull(map);
-			assertTrue(map.size() == 0);
+			assertEquals(0, map.size());
 			try {
 				// the map should be unmodifiable
 				map.put("hi", "bye");
@@ -337,7 +337,7 @@
 			JarURLConnection con1 = (JarURLConnection) fUrl1.openConnection();
 			headers = con1.getHeaderFields();
 			assertNotNull(headers);
-			assertTrue(headers.size() == 0);
+			assertEquals(0, headers.size());
 			try {
 				// the map should be unmodifiable
 				headers.put("hi", "bye");
@@ -387,9 +387,9 @@
 		String hf;
 		hf = uc.getHeaderField("Content-Encoding");
 		if (hf != null) {
-			assertTrue(
+			assertNull(
 					"Wrong value returned for header field 'Content-Encoding': "
-							+ hf, hf == null);
+							+ hf, hf);
 		}
 		hf = uc.getHeaderField("Content-Length");
 		if (hf != null) {
@@ -415,9 +415,9 @@
 		}
 		hf = uc.getHeaderField("Expires");
 		if (hf != null) {
-			assertTrue(
+			assertNull(
 					"Wrong value returned for header field 'Expires': " + hf,
-					hf == null);
+					hf);
 		}
 		hf = uc.getHeaderField("SERVER");
 		if (hf != null) {
@@ -441,8 +441,8 @@
 		}
 		hf = uc.getHeaderField("DoesNotExist");
 		if (hf != null) {
-			assertTrue("Wrong value returned for header field 'DoesNotExist': "
-					+ hf, hf == null);
+			assertNull("Wrong value returned for header field 'DoesNotExist': "
+					+ hf, hf);
 		}
 	}
 
@@ -494,8 +494,8 @@
 	 */
 	public void test_getIfModifiedSince() {
 		uc.setIfModifiedSince(200);
-		assertTrue("Returned wrong ifModifiedSince value", uc
-				.getIfModifiedSince() == 200);
+		assertEquals("Returned wrong ifModifiedSince value", 200, uc
+				.getIfModifiedSince());
 	}
 
 	/**
@@ -833,8 +833,8 @@
 		uc.setRequestProperty("Yo", "yo");
 		assertTrue("Wrong property returned: " + uc.getRequestProperty("Yo"),
 				uc.getRequestProperty("Yo").equals("yo"));
-		assertTrue("Wrong property returned: " + uc.getRequestProperty("No"),
-				uc.getRequestProperty("No") == null);
+		assertNull("Wrong property returned: " + uc.getRequestProperty("No"),
+				uc.getRequestProperty("No"));
 	}
 
 	/**
@@ -864,10 +864,10 @@
 			byte[] bytes = new byte[in.available()];
 			in.read(bytes, 0, bytes.length);
 			in.close();
-			assertTrue("Should have returned text/html",
-					URLConnection.guessContentTypeFromStream(
+			assertEquals("Should have returned text/html",
+					"text/html", URLConnection.guessContentTypeFromStream(
 							new ByteArrayInputStream(bytes))
-							.equals("text/html"));
+							);
 		} catch (Exception e) {
 			fail("Exception during test : " + e.getMessage());
 		}
@@ -934,9 +934,9 @@
 			cal.clear();
 			cal.set(2000, Calendar.MARCH, 5);
 			connection.setIfModifiedSince(cal.getTime().getTime());
-			assertTrue("Wrong date set", connection.getRequestProperty(
+			assertEquals("Wrong date set", "Sun, 05 Mar 2000 00:00:00 GMT", connection.getRequestProperty(
 					"If-Modified-Since")
-					.equals("Sun, 05 Mar 2000 00:00:00 GMT"));
+					);
 		} catch (MalformedURLException e) {
 			fail("MalformedURLException : " + e.getMessage());
 		} catch (IOException e) {

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/URLDecoderTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/URLDecoderTest.java?rev=397123&r1=397122&r2=397123&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/URLDecoderTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/URLDecoderTest.java Wed Apr 26 00:12:16 2006
@@ -28,7 +28,7 @@
 	public void test_Constructor() {
 		try {
 			URLDecoder ud = new URLDecoder();
-			assertTrue("Constructor failed.", ud != null);
+			assertNotNull("Constructor failed.", ud);
 		} catch (Exception e) {
 			fail("Constructor failed : " + e.getMessage());
 		}

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/URLTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/URLTest.java?rev=397123&r1=397122&r2=397123&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/URLTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/URLTest.java Wed Apr 26 00:12:16 2006
@@ -91,114 +91,114 @@
 			// basic parsing test
 			u = new URL(
 					"http://www.yahoo1.com:8080/dir1/dir2/test.cgi?point1.html#anchor1");
-			assertTrue("u returns a wrong protocol", u.getProtocol().equals(
-					"http"));
-			assertTrue("u returns a wrong host", u.getHost().equals(
-					"www.yahoo1.com"));
-			assertTrue("u returns a wrong port", u.getPort() == 8080);
-			assertTrue("u returns a wrong file", u.getFile().equals(
-					"/dir1/dir2/test.cgi?point1.html"));
-			assertTrue("u returns a wrong anchor", u.getRef().equals("anchor1"));
+			assertEquals("u returns a wrong protocol", 
+					"http", u.getProtocol());
+			assertEquals("u returns a wrong host", 
+					"www.yahoo1.com", u.getHost());
+			assertEquals("u returns a wrong port", 8080, u.getPort());
+			assertEquals("u returns a wrong file", 
+					"/dir1/dir2/test.cgi?point1.html", u.getFile());
+			assertEquals("u returns a wrong anchor", "anchor1", u.getRef());
 
 			// test for no file
 			u1 = new URL("http://www.yahoo2.com:9999");
-			assertTrue("u1 returns a wrong protocol", u1.getProtocol().equals(
-					"http"));
-			assertTrue("u1 returns a wrong host", u1.getHost().equals(
-					"www.yahoo2.com"));
-			assertTrue("u1 returns a wrong port", u1.getPort() == 9999);
+			assertEquals("u1 returns a wrong protocol", 
+					"http", u1.getProtocol());
+			assertEquals("u1 returns a wrong host", 
+					"www.yahoo2.com", u1.getHost());
+			assertEquals("u1 returns a wrong port", 9999, u1.getPort());
 			assertTrue("u1 returns a wrong file", u1.getFile().equals(""));
-			assertTrue("u1 returns a wrong anchor", u1.getRef() == null);
+			assertNull("u1 returns a wrong anchor", u1.getRef());
 
 			// test for no port
 			u2 = new URL(
 					"http://www.yahoo3.com/dir1/dir2/test.cgi?point1.html#anchor1");
-			assertTrue("u2 returns a wrong protocol", u2.getProtocol().equals(
-					"http"));
-			assertTrue("u2 returns a wrong host", u2.getHost().equals(
-					"www.yahoo3.com"));
-			assertTrue("u2 returns a wrong port", u2.getPort() == -1);
-			assertTrue("u2 returns a wrong file", u2.getFile().equals(
-					"/dir1/dir2/test.cgi?point1.html"));
-			assertTrue("u2 returns a wrong anchor", u2.getRef().equals(
-					"anchor1"));
+			assertEquals("u2 returns a wrong protocol", 
+					"http", u2.getProtocol());
+			assertEquals("u2 returns a wrong host", 
+					"www.yahoo3.com", u2.getHost());
+			assertEquals("u2 returns a wrong port", -1, u2.getPort());
+			assertEquals("u2 returns a wrong file", 
+					"/dir1/dir2/test.cgi?point1.html", u2.getFile());
+			assertEquals("u2 returns a wrong anchor", 
+					"anchor1", u2.getRef());
 
 			// test for no port
 			URL u2a = new URL(
 					"file://www.yahoo3.com/dir1/dir2/test.cgi#anchor1");
-			assertTrue("u2a returns a wrong protocol", u2a.getProtocol()
-					.equals("file"));
-			assertTrue("u2a returns a wrong host", u2a.getHost().equals(
-					"www.yahoo3.com"));
-			assertTrue("u2a returns a wrong port", u2a.getPort() == -1);
-			assertTrue("u2a returns a wrong file", u2a.getFile().equals(
-					"/dir1/dir2/test.cgi"));
-			assertTrue("u2a returns a wrong anchor", u2a.getRef().equals(
-					"anchor1"));
+			assertEquals("u2a returns a wrong protocol", "file", u2a.getProtocol()
+					);
+			assertEquals("u2a returns a wrong host", 
+					"www.yahoo3.com", u2a.getHost());
+			assertEquals("u2a returns a wrong port", -1, u2a.getPort());
+			assertEquals("u2a returns a wrong file", 
+					"/dir1/dir2/test.cgi", u2a.getFile());
+			assertEquals("u2a returns a wrong anchor", 
+					"anchor1", u2a.getRef());
 
 			// test for no file, no port
 			u3 = new URL("http://www.yahoo4.com/");
-			assertTrue("u3 returns a wrong protocol", u3.getProtocol().equals(
-					"http"));
-			assertTrue("u3 returns a wrong host", u3.getHost().equals(
-					"www.yahoo4.com"));
-			assertTrue("u3 returns a wrong port", u3.getPort() == -1);
-			assertTrue("u3 returns a wrong file", u3.getFile().equals("/"));
-			assertTrue("u3 returns a wrong anchor", u3.getRef() == null);
+			assertEquals("u3 returns a wrong protocol", 
+					"http", u3.getProtocol());
+			assertEquals("u3 returns a wrong host", 
+					"www.yahoo4.com", u3.getHost());
+			assertEquals("u3 returns a wrong port", -1, u3.getPort());
+			assertEquals("u3 returns a wrong file", "/", u3.getFile());
+			assertNull("u3 returns a wrong anchor", u3.getRef());
 
 			// test for no file, no port
 			URL u3a = new URL("file://www.yahoo4.com/");
-			assertTrue("u3a returns a wrong protocol", u3a.getProtocol()
-					.equals("file"));
-			assertTrue("u3a returns a wrong host", u3a.getHost().equals(
-					"www.yahoo4.com"));
-			assertTrue("u3a returns a wrong port", u3a.getPort() == -1);
-			assertTrue("u3a returns a wrong file", u3a.getFile().equals("/"));
-			assertTrue("u3a returns a wrong anchor", u3a.getRef() == null);
+			assertEquals("u3a returns a wrong protocol", "file", u3a.getProtocol()
+					);
+			assertEquals("u3a returns a wrong host", 
+					"www.yahoo4.com", u3a.getHost());
+			assertEquals("u3a returns a wrong port", -1, u3a.getPort());
+			assertEquals("u3a returns a wrong file", "/", u3a.getFile());
+			assertNull("u3a returns a wrong anchor", u3a.getRef());
 
 			// test for no file, no port
 			URL u3b = new URL("file://www.yahoo4.com");
-			assertTrue("u3b returns a wrong protocol", u3b.getProtocol()
-					.equals("file"));
-			assertTrue("u3b returns a wrong host", u3b.getHost().equals(
-					"www.yahoo4.com"));
-			assertTrue("u3b returns a wrong port", u3b.getPort() == -1);
+			assertEquals("u3b returns a wrong protocol", "file", u3b.getProtocol()
+					);
+			assertEquals("u3b returns a wrong host", 
+					"www.yahoo4.com", u3b.getHost());
+			assertEquals("u3b returns a wrong port", -1, u3b.getPort());
 			assertTrue("u3b returns a wrong file", u3b.getFile().equals(""));
-			assertTrue("u3b returns a wrong anchor", u3b.getRef() == null);
+			assertNull("u3b returns a wrong anchor", u3b.getRef());
 
 			// test for non-port ":" and wierd characters occurrences
 			u4 = new URL(
 					"http://www.yahoo5.com/di!@$%^&*()_+r1/di:::r2/test.cgi?point1.html#anchor1");
-			assertTrue("u4 returns a wrong protocol", u4.getProtocol().equals(
-					"http"));
-			assertTrue("u4 returns a wrong host", u4.getHost().equals(
-					"www.yahoo5.com"));
-			assertTrue("u4 returns a wrong port", u4.getPort() == -1);
-			assertTrue("u4 returns a wrong file", u4.getFile().equals(
-					"/di!@$%^&*()_+r1/di:::r2/test.cgi?point1.html"));
-			assertTrue("u4 returns a wrong anchor", u4.getRef().equals(
-					"anchor1"));
+			assertEquals("u4 returns a wrong protocol", 
+					"http", u4.getProtocol());
+			assertEquals("u4 returns a wrong host", 
+					"www.yahoo5.com", u4.getHost());
+			assertEquals("u4 returns a wrong port", -1, u4.getPort());
+			assertEquals("u4 returns a wrong file", 
+					"/di!@$%^&*()_+r1/di:::r2/test.cgi?point1.html", u4.getFile());
+			assertEquals("u4 returns a wrong anchor", 
+					"anchor1", u4.getRef());
 
 			u5 = new URL("file:/testing.tst");
-			assertTrue("u5 returns a wrong protocol", u5.getProtocol().equals(
-					"file"));
+			assertEquals("u5 returns a wrong protocol", 
+					"file", u5.getProtocol());
 			assertTrue("u5 returns a wrong host", u5.getHost().equals(""));
-			assertTrue("u5 returns a wrong port", u5.getPort() == -1);
-			assertTrue("u5 returns a wrong file", u5.getFile().equals(
-					"/testing.tst"));
-			assertTrue("u5 returns a wrong anchor", u5.getRef() == null);
+			assertEquals("u5 returns a wrong port", -1, u5.getPort());
+			assertEquals("u5 returns a wrong file", 
+					"/testing.tst", u5.getFile());
+			assertNull("u5 returns a wrong anchor", u5.getRef());
 
 			URL u5a = new URL("file:testing.tst");
-			assertTrue("u5a returns a wrong protocol", u5a.getProtocol()
-					.equals("file"));
+			assertEquals("u5a returns a wrong protocol", "file", u5a.getProtocol()
+					);
 			assertTrue("u5a returns a wrong host", u5a.getHost().equals(""));
-			assertTrue("u5a returns a wrong port", u5a.getPort() == -1);
-			assertTrue("u5a returns a wrong file", u5a.getFile().equals(
-					"testing.tst"));
-			assertTrue("u5a returns a wrong anchor", u5a.getRef() == null);
+			assertEquals("u5a returns a wrong port", -1, u5a.getPort());
+			assertEquals("u5a returns a wrong file", 
+					"testing.tst", u5a.getFile());
+			assertNull("u5a returns a wrong anchor", u5a.getRef());
 
 			URL u6 = new URL("http://host:/file");
-			assertTrue("u6 return a wrong port", u6.getPort() == -1);
+			assertEquals("u6 return a wrong port", -1, u6.getPort());
 
 			URL u7 = new URL("file:../../file.txt");
 			assertTrue("u7 returns a wrong file: " + u7.getFile(), u7.getFile()
@@ -213,8 +213,8 @@
 					u8.getPort() == 35);
 			assertTrue("u8 returns a wrong file " + u8.getFile(), u8.getFile()
 					.equals("/file.txt"));
-			assertTrue("u8 returns a wrong anchor " + u8.getRef(),
-					u8.getRef() == null);
+			assertNull("u8 returns a wrong anchor " + u8.getRef(),
+					u8.getRef());
 
 			URL u9 = new URL(
 					"file://[fec0::1:20d:60ff:fe24:7410]/file.txt#sogood");
@@ -326,217 +326,217 @@
 			URL uf = new URL("file://www.yahoo.com");
 			// basic ones
 			u1 = new URL(u, "file.java");
-			assertTrue("1 returns a wrong protocol", u1.getProtocol().equals(
-					"http"));
-			assertTrue("1 returns a wrong host", u1.getHost().equals(
-					"www.yahoo.com"));
-			assertTrue("1 returns a wrong port", u1.getPort() == -1);
-			assertTrue("1 returns a wrong file", u1.getFile().equals(
-					"/file.java"));
-			assertTrue("1 returns a wrong anchor", u1.getRef() == null);
+			assertEquals("1 returns a wrong protocol", 
+					"http", u1.getProtocol());
+			assertEquals("1 returns a wrong host", 
+					"www.yahoo.com", u1.getHost());
+			assertEquals("1 returns a wrong port", -1, u1.getPort());
+			assertEquals("1 returns a wrong file", 
+					"/file.java", u1.getFile());
+			assertNull("1 returns a wrong anchor", u1.getRef());
 
 			URL u1f = new URL(uf, "file.java");
-			assertTrue("1f returns a wrong protocol", u1f.getProtocol().equals(
-					"file"));
-			assertTrue("1f returns a wrong host", u1f.getHost().equals(
-					"www.yahoo.com"));
-			assertTrue("1f returns a wrong port", u1f.getPort() == -1);
-			assertTrue("1f returns a wrong file", u1f.getFile().equals(
-					"/file.java"));
-			assertTrue("1f returns a wrong anchor", u1f.getRef() == null);
+			assertEquals("1f returns a wrong protocol", 
+					"file", u1f.getProtocol());
+			assertEquals("1f returns a wrong host", 
+					"www.yahoo.com", u1f.getHost());
+			assertEquals("1f returns a wrong port", -1, u1f.getPort());
+			assertEquals("1f returns a wrong file", 
+					"/file.java", u1f.getFile());
+			assertNull("1f returns a wrong anchor", u1f.getRef());
 
 			u1 = new URL(u, "dir1/dir2/../file.java");
-			assertTrue("3 returns a wrong protocol", u1.getProtocol().equals(
-					"http"));
+			assertEquals("3 returns a wrong protocol", 
+					"http", u1.getProtocol());
 			assertTrue("3 returns a wrong host: " + u1.getHost(), u1.getHost()
 					.equals("www.yahoo.com"));
-			assertTrue("3 returns a wrong port", u1.getPort() == -1);
-			assertTrue("3 returns a wrong file", u1.getFile().equals(
-					"/dir1/dir2/../file.java"));
-			assertTrue("3 returns a wrong anchor", u1.getRef() == null);
+			assertEquals("3 returns a wrong port", -1, u1.getPort());
+			assertEquals("3 returns a wrong file", 
+					"/dir1/dir2/../file.java", u1.getFile());
+			assertNull("3 returns a wrong anchor", u1.getRef());
 
 			u1 = new URL(u, "http:dir1/dir2/../file.java");
-			assertTrue("3a returns a wrong protocol", u1.getProtocol().equals(
-					"http"));
+			assertEquals("3a returns a wrong protocol", 
+					"http", u1.getProtocol());
 			assertTrue("3a returns a wrong host: " + u1.getHost(), u1.getHost()
 					.equals(""));
-			assertTrue("3a returns a wrong port", u1.getPort() == -1);
-			assertTrue("3a returns a wrong file", u1.getFile().equals(
-					"dir1/dir2/../file.java"));
-			assertTrue("3a returns a wrong anchor", u1.getRef() == null);
+			assertEquals("3a returns a wrong port", -1, u1.getPort());
+			assertEquals("3a returns a wrong file", 
+					"dir1/dir2/../file.java", u1.getFile());
+			assertNull("3a returns a wrong anchor", u1.getRef());
 
 			u = new URL("http://www.apache.org/testing/");
 			u1 = new URL(u, "file.java");
-			assertTrue("4 returns a wrong protocol", u1.getProtocol().equals(
-					"http"));
-			assertTrue("4 returns a wrong host", u1.getHost().equals(
-					"www.apache.org"));
-			assertTrue("4 returns a wrong port", u1.getPort() == -1);
-			assertTrue("4 returns a wrong file", u1.getFile().equals(
-					"/testing/file.java"));
-			assertTrue("4 returns a wrong anchor", u1.getRef() == null);
+			assertEquals("4 returns a wrong protocol", 
+					"http", u1.getProtocol());
+			assertEquals("4 returns a wrong host", 
+					"www.apache.org", u1.getHost());
+			assertEquals("4 returns a wrong port", -1, u1.getPort());
+			assertEquals("4 returns a wrong file", 
+					"/testing/file.java", u1.getFile());
+			assertNull("4 returns a wrong anchor", u1.getRef());
 
 			uf = new URL("file://www.apache.org/testing/");
 			u1f = new URL(uf, "file.java");
-			assertTrue("4f returns a wrong protocol", u1f.getProtocol().equals(
-					"file"));
-			assertTrue("4f returns a wrong host", u1f.getHost().equals(
-					"www.apache.org"));
-			assertTrue("4f returns a wrong port", u1f.getPort() == -1);
-			assertTrue("4f returns a wrong file", u1f.getFile().equals(
-					"/testing/file.java"));
-			assertTrue("4f returns a wrong anchor", u1f.getRef() == null);
+			assertEquals("4f returns a wrong protocol", 
+					"file", u1f.getProtocol());
+			assertEquals("4f returns a wrong host", 
+					"www.apache.org", u1f.getHost());
+			assertEquals("4f returns a wrong port", -1, u1f.getPort());
+			assertEquals("4f returns a wrong file", 
+					"/testing/file.java", u1f.getFile());
+			assertNull("4f returns a wrong anchor", u1f.getRef());
 
 			uf = new URL("file:/testing/");
 			u1f = new URL(uf, "file.java");
-			assertTrue("4fa returns a wrong protocol", u1f.getProtocol()
-					.equals("file"));
+			assertEquals("4fa returns a wrong protocol", "file", u1f.getProtocol()
+					);
 			assertTrue("4fa returns a wrong host", u1f.getHost().equals(""));
-			assertTrue("4fa returns a wrong port", u1f.getPort() == -1);
-			assertTrue("4fa returns a wrong file", u1f.getFile().equals(
-					"/testing/file.java"));
-			assertTrue("4fa returns a wrong anchor", u1f.getRef() == null);
+			assertEquals("4fa returns a wrong port", -1, u1f.getPort());
+			assertEquals("4fa returns a wrong file", 
+					"/testing/file.java", u1f.getFile());
+			assertNull("4fa returns a wrong anchor", u1f.getRef());
 
 			uf = new URL("file:testing/");
 			u1f = new URL(uf, "file.java");
-			assertTrue("4fb returns a wrong protocol", u1f.getProtocol()
-					.equals("file"));
+			assertEquals("4fb returns a wrong protocol", "file", u1f.getProtocol()
+					);
 			assertTrue("4fb returns a wrong host", u1f.getHost().equals(""));
-			assertTrue("4fb returns a wrong port", u1f.getPort() == -1);
-			assertTrue("4fb returns a wrong file", u1f.getFile().equals(
-					"testing/file.java"));
-			assertTrue("4fb returns a wrong anchor", u1f.getRef() == null);
+			assertEquals("4fb returns a wrong port", -1, u1f.getPort());
+			assertEquals("4fb returns a wrong file", 
+					"testing/file.java", u1f.getFile());
+			assertNull("4fb returns a wrong anchor", u1f.getRef());
 
 			u1f = new URL(uf, "file:file.java");
-			assertTrue("4fc returns a wrong protocol", u1f.getProtocol()
-					.equals("file"));
+			assertEquals("4fc returns a wrong protocol", "file", u1f.getProtocol()
+					);
 			assertTrue("4fc returns a wrong host", u1f.getHost().equals(""));
-			assertTrue("4fc returns a wrong port", u1f.getPort() == -1);
-			assertTrue("4fc returns a wrong file", u1f.getFile().equals(
-					"file.java"));
-			assertTrue("4fc returns a wrong anchor", u1f.getRef() == null);
+			assertEquals("4fc returns a wrong port", -1, u1f.getPort());
+			assertEquals("4fc returns a wrong file", 
+					"file.java", u1f.getFile());
+			assertNull("4fc returns a wrong anchor", u1f.getRef());
 
 			u1f = new URL(uf, "file:");
-			assertTrue("4fd returns a wrong protocol", u1f.getProtocol()
-					.equals("file"));
+			assertEquals("4fd returns a wrong protocol", "file", u1f.getProtocol()
+					);
 			assertTrue("4fd returns a wrong host", u1f.getHost().equals(""));
-			assertTrue("4fd returns a wrong port", u1f.getPort() == -1);
+			assertEquals("4fd returns a wrong port", -1, u1f.getPort());
 			assertTrue("4fd returns a wrong file", u1f.getFile().equals(""));
-			assertTrue("4fd returns a wrong anchor", u1f.getRef() == null);
+			assertNull("4fd returns a wrong anchor", u1f.getRef());
 
 			u = new URL("http://www.apache.org/testing");
 			u1 = new URL(u, "file.java");
-			assertTrue("5 returns a wrong protocol", u1.getProtocol().equals(
-					"http"));
-			assertTrue("5 returns a wrong host", u1.getHost().equals(
-					"www.apache.org"));
-			assertTrue("5 returns a wrong port", u1.getPort() == -1);
-			assertTrue("5 returns a wrong file", u1.getFile().equals(
-					"/file.java"));
-			assertTrue("5 returns a wrong anchor", u1.getRef() == null);
+			assertEquals("5 returns a wrong protocol", 
+					"http", u1.getProtocol());
+			assertEquals("5 returns a wrong host", 
+					"www.apache.org", u1.getHost());
+			assertEquals("5 returns a wrong port", -1, u1.getPort());
+			assertEquals("5 returns a wrong file", 
+					"/file.java", u1.getFile());
+			assertNull("5 returns a wrong anchor", u1.getRef());
 
 			uf = new URL("file://www.apache.org/testing");
 			u1f = new URL(uf, "file.java");
-			assertTrue("5f returns a wrong protocol", u1f.getProtocol().equals(
-					"file"));
-			assertTrue("5f returns a wrong host", u1f.getHost().equals(
-					"www.apache.org"));
-			assertTrue("5f returns a wrong port", u1f.getPort() == -1);
-			assertTrue("5f returns a wrong file", u1f.getFile().equals(
-					"/file.java"));
-			assertTrue("5f returns a wrong anchor", u1f.getRef() == null);
+			assertEquals("5f returns a wrong protocol", 
+					"file", u1f.getProtocol());
+			assertEquals("5f returns a wrong host", 
+					"www.apache.org", u1f.getHost());
+			assertEquals("5f returns a wrong port", -1, u1f.getPort());
+			assertEquals("5f returns a wrong file", 
+					"/file.java", u1f.getFile());
+			assertNull("5f returns a wrong anchor", u1f.getRef());
 
 			uf = new URL("file:/testing");
 			u1f = new URL(uf, "file.java");
-			assertTrue("5fa returns a wrong protocol", u1f.getProtocol()
-					.equals("file"));
+			assertEquals("5fa returns a wrong protocol", "file", u1f.getProtocol()
+					);
 			assertTrue("5fa returns a wrong host", u1f.getHost().equals(""));
-			assertTrue("5fa returns a wrong port", u1f.getPort() == -1);
-			assertTrue("5fa returns a wrong file", u1f.getFile().equals(
-					"/file.java"));
-			assertTrue("5fa returns a wrong anchor", u1f.getRef() == null);
+			assertEquals("5fa returns a wrong port", -1, u1f.getPort());
+			assertEquals("5fa returns a wrong file", 
+					"/file.java", u1f.getFile());
+			assertNull("5fa returns a wrong anchor", u1f.getRef());
 
 			uf = new URL("file:testing");
 			u1f = new URL(uf, "file.java");
-			assertTrue("5fb returns a wrong protocol", u1f.getProtocol()
-					.equals("file"));
+			assertEquals("5fb returns a wrong protocol", "file", u1f.getProtocol()
+					);
 			assertTrue("5fb returns a wrong host", u1f.getHost().equals(""));
-			assertTrue("5fb returns a wrong port", u1f.getPort() == -1);
-			assertTrue("5fb returns a wrong file", u1f.getFile().equals(
-					"file.java"));
-			assertTrue("5fb returns a wrong anchor", u1f.getRef() == null);
+			assertEquals("5fb returns a wrong port", -1, u1f.getPort());
+			assertEquals("5fb returns a wrong file", 
+					"file.java", u1f.getFile());
+			assertNull("5fb returns a wrong anchor", u1f.getRef());
 
 			u = new URL("http://www.apache.org/testing/foobaz");
 			u1 = new URL(u, "/file.java");
-			assertTrue("6 returns a wrong protocol", u1.getProtocol().equals(
-					"http"));
-			assertTrue("6 returns a wrong host", u1.getHost().equals(
-					"www.apache.org"));
-			assertTrue("6 returns a wrong port", u1.getPort() == -1);
-			assertTrue("6 returns a wrong file", u1.getFile().equals(
-					"/file.java"));
-			assertTrue("6 returns a wrong anchor", u1.getRef() == null);
+			assertEquals("6 returns a wrong protocol", 
+					"http", u1.getProtocol());
+			assertEquals("6 returns a wrong host", 
+					"www.apache.org", u1.getHost());
+			assertEquals("6 returns a wrong port", -1, u1.getPort());
+			assertEquals("6 returns a wrong file", 
+					"/file.java", u1.getFile());
+			assertNull("6 returns a wrong anchor", u1.getRef());
 
 			uf = new URL("file://www.apache.org/testing/foobaz");
 			u1f = new URL(uf, "/file.java");
-			assertTrue("6f returns a wrong protocol", u1f.getProtocol().equals(
-					"file"));
-			assertTrue("6f returns a wrong host", u1f.getHost().equals(
-					"www.apache.org"));
-			assertTrue("6f returns a wrong port", u1f.getPort() == -1);
-			assertTrue("6f returns a wrong file", u1f.getFile().equals(
-					"/file.java"));
-			assertTrue("6f returns a wrong anchor", u1f.getRef() == null);
+			assertEquals("6f returns a wrong protocol", 
+					"file", u1f.getProtocol());
+			assertEquals("6f returns a wrong host", 
+					"www.apache.org", u1f.getHost());
+			assertEquals("6f returns a wrong port", -1, u1f.getPort());
+			assertEquals("6f returns a wrong file", 
+					"/file.java", u1f.getFile());
+			assertNull("6f returns a wrong anchor", u1f.getRef());
 
 			u = new URL("http://www.apache.org:8000/testing/foobaz");
 			u1 = new URL(u, "/file.java");
-			assertTrue("7 returns a wrong protocol", u1.getProtocol().equals(
-					"http"));
-			assertTrue("7 returns a wrong host", u1.getHost().equals(
-					"www.apache.org"));
-			assertTrue("7 returns a wrong port", u1.getPort() == 8000);
-			assertTrue("7 returns a wrong file", u1.getFile().equals(
-					"/file.java"));
-			assertTrue("7 returns a wrong anchor", u1.getRef() == null);
+			assertEquals("7 returns a wrong protocol", 
+					"http", u1.getProtocol());
+			assertEquals("7 returns a wrong host", 
+					"www.apache.org", u1.getHost());
+			assertEquals("7 returns a wrong port", 8000, u1.getPort());
+			assertEquals("7 returns a wrong file", 
+					"/file.java", u1.getFile());
+			assertNull("7 returns a wrong anchor", u1.getRef());
 
 			u = new URL("http://www.apache.org/index.html");
 			u1 = new URL(u, "#bar");
-			assertTrue("8 returns a wrong host", u1.getHost().equals(
-					"www.apache.org"));
-			assertTrue("8 returns a wrong file", u1.getFile().equals(
-					"/index.html"));
-			assertTrue("8 returns a wrong anchor", u1.getRef().equals("bar"));
+			assertEquals("8 returns a wrong host", 
+					"www.apache.org", u1.getHost());
+			assertEquals("8 returns a wrong file", 
+					"/index.html", u1.getFile());
+			assertEquals("8 returns a wrong anchor", "bar", u1.getRef());
 
 			u = new URL("http://www.apache.org/index.html#foo");
 			u1 = new URL(u, "http:#bar");
-			assertTrue("9 returns a wrong host", u1.getHost().equals(
-					"www.apache.org"));
-			assertTrue("9 returns a wrong file", u1.getFile().equals(
-					"/index.html"));
-			assertTrue("9 returns a wrong anchor", u1.getRef().equals("bar"));
+			assertEquals("9 returns a wrong host", 
+					"www.apache.org", u1.getHost());
+			assertEquals("9 returns a wrong file", 
+					"/index.html", u1.getFile());
+			assertEquals("9 returns a wrong anchor", "bar", u1.getRef());
 
 			u = new URL("http://www.apache.org/index.html");
 			u1 = new URL(u, "");
-			assertTrue("10 returns a wrong host", u1.getHost().equals(
-					"www.apache.org"));
-			assertTrue("10 returns a wrong file", u1.getFile().equals(
-					"/index.html"));
-			assertTrue("10 returns a wrong anchor", u1.getRef() == null);
+			assertEquals("10 returns a wrong host", 
+					"www.apache.org", u1.getHost());
+			assertEquals("10 returns a wrong file", 
+					"/index.html", u1.getFile());
+			assertNull("10 returns a wrong anchor", u1.getRef());
 
 			uf = new URL("file://www.apache.org/index.html");
 			u1f = new URL(uf, "");
-			assertTrue("10f returns a wrong host", u1.getHost().equals(
-					"www.apache.org"));
-			assertTrue("10f returns a wrong file", u1.getFile().equals(
-					"/index.html"));
-			assertTrue("10f returns a wrong anchor", u1.getRef() == null);
+			assertEquals("10f returns a wrong host", 
+					"www.apache.org", u1.getHost());
+			assertEquals("10f returns a wrong file", 
+					"/index.html", u1.getFile());
+			assertNull("10f returns a wrong anchor", u1.getRef());
 
 			u = new URL("http://www.apache.org/index.html");
 			u1 = new URL(u, "http://www.apache.org");
-			assertTrue("11 returns a wrong host", u1.getHost().equals(
-					"www.apache.org"));
+			assertEquals("11 returns a wrong host", 
+					"www.apache.org", u1.getHost());
 			assertTrue("11 returns a wrong file", u1.getFile().equals(""));
-			assertTrue("11 returns a wrong anchor", u1.getRef() == null);
+			assertNull("11 returns a wrong anchor", u1.getRef());
 
 			// test for question mark processing
 			u = new URL("http://www.foo.com/d0/d1/d2/cgi-bin?foo=bar/baz");
@@ -548,8 +548,8 @@
 
 			// test for absolute and relative file processing
 			u1 = new URL(u, "/../dir1/./dir2/../file.java");
-			assertTrue("B) returns a wrong file", u1.getFile().equals(
-					"/../dir1/./dir2/../file.java"));
+			assertEquals("B) returns a wrong file", 
+					"/../dir1/./dir2/../file.java", u1.getFile());
 		} catch (Exception e) {
 			fail("1 Exception during tests : " + e.getMessage());
 		}
@@ -578,34 +578,34 @@
 			u = new URL("http://www.yahoo.com");
 			// basic ones
 			u1 = new URL(u, "file.java", new MyHandler());
-			assertTrue("1 returns a wrong protocol", u1.getProtocol().equals(
-					"http"));
-			assertTrue("1 returns a wrong host", u1.getHost().equals(
-					"www.yahoo.com"));
-			assertTrue("1 returns a wrong port", u1.getPort() == -1);
-			assertTrue("1 returns a wrong file", u1.getFile().equals(
-					"/file.java"));
-			assertTrue("1 returns a wrong anchor", u1.getRef() == null);
+			assertEquals("1 returns a wrong protocol", 
+					"http", u1.getProtocol());
+			assertEquals("1 returns a wrong host", 
+					"www.yahoo.com", u1.getHost());
+			assertEquals("1 returns a wrong port", -1, u1.getPort());
+			assertEquals("1 returns a wrong file", 
+					"/file.java", u1.getFile());
+			assertNull("1 returns a wrong anchor", u1.getRef());
 
 			u1 = new URL(u, "systemresource:/+/FILE0/test.java",
 					new MyHandler());
-			assertTrue("2 returns a wrong protocol", u1.getProtocol().equals(
-					"systemresource"));
+			assertEquals("2 returns a wrong protocol", 
+					"systemresource", u1.getProtocol());
 			assertTrue("2 returns a wrong host", u1.getHost().equals(""));
-			assertTrue("2 returns a wrong port", u1.getPort() == -1);
-			assertTrue("2 returns a wrong file", u1.getFile().equals(
-					"/+/FILE0/test.java"));
-			assertTrue("2 returns a wrong anchor", u1.getRef() == null);
+			assertEquals("2 returns a wrong port", -1, u1.getPort());
+			assertEquals("2 returns a wrong file", 
+					"/+/FILE0/test.java", u1.getFile());
+			assertNull("2 returns a wrong anchor", u1.getRef());
 
 			u1 = new URL(u, "dir1/dir2/../file.java", null);
-			assertTrue("3 returns a wrong protocol", u1.getProtocol().equals(
-					"http"));
-			assertTrue("3 returns a wrong host", u1.getHost().equals(
-					"www.yahoo.com"));
-			assertTrue("3 returns a wrong port", u1.getPort() == -1);
-			assertTrue("3 returns a wrong file", u1.getFile().equals(
-					"/dir1/dir2/../file.java"));
-			assertTrue("3 returns a wrong anchor", u1.getRef() == null);
+			assertEquals("3 returns a wrong protocol", 
+					"http", u1.getProtocol());
+			assertEquals("3 returns a wrong host", 
+					"www.yahoo.com", u1.getHost());
+			assertEquals("3 returns a wrong port", -1, u1.getPort());
+			assertEquals("3 returns a wrong file", 
+					"/dir1/dir2/../file.java", u1.getFile());
+			assertNull("3 returns a wrong anchor", u1.getRef());
 
 			// test for question mark processing
 			u = new URL("http://www.foo.com/d0/d1/d2/cgi-bin?foo=bar/baz");
@@ -617,8 +617,8 @@
 
 			// test for absolute and relative file processing
 			u1 = new URL(u, "/../dir1/dir2/../file.java", null);
-			assertTrue("B) returns a wrong file", u1.getFile().equals(
-					"/../dir1/dir2/../file.java"));
+			assertEquals("B) returns a wrong file", 
+					"/../dir1/dir2/../file.java", u1.getFile());
 		} catch (Exception e) {
 			fail("1 Exception during tests : " + e.getMessage());
 		}
@@ -659,13 +659,13 @@
 		// java.lang.String)
 		try {
 			u = new URL("http", "www.yahoo.com:8080", "test.html#foo");
-			assertTrue("SSS returns a wrong protocol", u.getProtocol().equals(
-					"http"));
+			assertEquals("SSS returns a wrong protocol", 
+					"http", u.getProtocol());
 			assertTrue("SSS returns a wrong host: " + u.getHost(), u.getHost()
 					.equals("www.yahoo.com:8080"));
-			assertTrue("SSS returns a wrong port", u.getPort() == -1);
-			assertTrue("SSS returns a wrong file", u.getFile().equals(
-					"test.html"));
+			assertEquals("SSS returns a wrong port", -1, u.getPort());
+			assertEquals("SSS returns a wrong file", 
+					"test.html", u.getFile());
 			assertTrue("SSS returns a wrong anchor: " + u.getRef(), u.getRef()
 					.equals("foo"));
 		} catch (Exception e) {
@@ -682,13 +682,13 @@
 		// java.lang.String)
 		try {
 			u = new URL("http", "www.yahoo.com", 8080, "test.html#foo");
-			assertTrue("SSIS returns a wrong protocol", u.getProtocol().equals(
-					"http"));
-			assertTrue("SSIS returns a wrong host", u.getHost().equals(
-					"www.yahoo.com"));
-			assertTrue("SSIS returns a wrong port", u.getPort() == 8080);
-			assertTrue("SSIS returns a wrong file", u.getFile().equals(
-					"test.html"));
+			assertEquals("SSIS returns a wrong protocol", 
+					"http", u.getProtocol());
+			assertEquals("SSIS returns a wrong host", 
+					"www.yahoo.com", u.getHost());
+			assertEquals("SSIS returns a wrong port", 8080, u.getPort());
+			assertEquals("SSIS returns a wrong file", 
+					"test.html", u.getFile());
 			assertTrue("SSIS returns a wrong anchor: " + u.getRef(), u.getRef()
 					.equals("foo"));
 		} catch (Exception e) {
@@ -706,13 +706,13 @@
 		// java.lang.String, java.net.URLStreamHandler)
 		try {
 			u = new URL("http", "www.yahoo.com", 8080, "test.html#foo", null);
-			assertTrue("SSISH1 returns a wrong protocol", u.getProtocol()
-					.equals("http"));
-			assertTrue("SSISH1 returns a wrong host", u.getHost().equals(
-					"www.yahoo.com"));
-			assertTrue("SSISH1 returns a wrong port", u.getPort() == 8080);
-			assertTrue("SSISH1 returns a wrong file", u.getFile().equals(
-					"test.html"));
+			assertEquals("SSISH1 returns a wrong protocol", "http", u.getProtocol()
+					);
+			assertEquals("SSISH1 returns a wrong host", 
+					"www.yahoo.com", u.getHost());
+			assertEquals("SSISH1 returns a wrong port", 8080, u.getPort());
+			assertEquals("SSISH1 returns a wrong file", 
+					"test.html", u.getFile());
 			assertTrue("SSISH1 returns a wrong anchor: " + u.getRef(), u
 					.getRef().equals("foo"));
 		} catch (Exception e) {
@@ -722,13 +722,13 @@
 		try {
 			u = new URL("http", "www.yahoo.com", 8080, "test.html#foo",
 					new MyHandler());
-			assertTrue("SSISH2 returns a wrong protocol", u.getProtocol()
-					.equals("http"));
-			assertTrue("SSISH2 returns a wrong host", u.getHost().equals(
-					"www.yahoo.com"));
-			assertTrue("SSISH2 returns a wrong port", u.getPort() == 8080);
-			assertTrue("SSISH2 returns a wrong file", u.getFile().equals(
-					"test.html"));
+			assertEquals("SSISH2 returns a wrong protocol", "http", u.getProtocol()
+					);
+			assertEquals("SSISH2 returns a wrong host", 
+					"www.yahoo.com", u.getHost());
+			assertEquals("SSISH2 returns a wrong port", 8080, u.getPort());
+			assertEquals("SSISH2 returns a wrong file", 
+					"test.html", u.getFile());
 			assertTrue("SSISH2 returns a wrong anchor: " + u.getRef(), u
 					.getRef().equals("foo"));
 		} catch (Exception e) {
@@ -850,7 +850,7 @@
 					+ "/nettest.txt");
 			InputStream in = u.openStream();
 			byte[] buf = new byte[3];
-			assertTrue("Incompete read 2", in.read(buf) == 3);
+			assertEquals("Incompete read 2", 3, in.read(buf));
 			in.close();
 			assertTrue("Returned incorrect data 2", buf[0] == 0x54
 					&& buf[1] == 0x68 && buf[2] == 0x69);
@@ -869,7 +869,7 @@
 			int result = in.read(buf);
 			in.close();
 			test.delete();
-			assertTrue("Incompete read 3", result == 3);
+			assertEquals("Incompete read 3", 3, result);
 			assertTrue("Returned incorrect data 3", buf[0] == 0x55
 					&& buf[1] == (byte) 0xaa && buf[2] == 0x14);
 		} catch (java.io.IOException e) {
@@ -885,7 +885,7 @@
 		try {
 			u = new URL("systemresource:/FILE4/+/types.properties");
 			URLConnection uConn = u.openConnection();
-			assertTrue("u.openConnection() returns null", uConn != null);
+			assertNotNull("u.openConnection() returns null", uConn);
 		} catch (Exception e) {
 		}
 	}
@@ -899,14 +899,13 @@
 			u1 = new URL("http://www.yahoo2.com:9999");
 			u = new URL(
 					"http://www.yahoo1.com:8080/dir1/dir2/test.cgi?point1.html#anchor1");
-			assertTrue(
-					"a) Does not return the right url string",
-					u
+			assertEquals("a) Does not return the right url string",
+					
+									"http://www.yahoo1.com:8080/dir1/dir2/test.cgi?point1.html#anchor1", u
 							.toString()
-							.equals(
-									"http://www.yahoo1.com:8080/dir1/dir2/test.cgi?point1.html#anchor1"));
-			assertTrue("b) Does not return the right url string", u1.toString()
-					.equals("http://www.yahoo2.com:9999"));
+							);
+			assertEquals("b) Does not return the right url string", "http://www.yahoo2.com:9999", u1.toString()
+					);
 			assertTrue("c) Does not return the right url string", u
 					.equals(new URL(u.toString())));
 		} catch (Exception e) {
@@ -922,24 +921,23 @@
 			u1 = new URL("http://www.yahoo2.com:9999");
 			u = new URL(
 					"http://www.yahoo1.com:8080/dir1/dir2/test.cgi?point1.html#anchor1");
-			assertTrue(
-					"a) Does not return the right url string",
-					u
+			assertEquals("a) Does not return the right url string",
+					
+									"http://www.yahoo1.com:8080/dir1/dir2/test.cgi?point1.html#anchor1", u
 							.toString()
-							.equals(
-									"http://www.yahoo1.com:8080/dir1/dir2/test.cgi?point1.html#anchor1"));
-			assertTrue("b) Does not return the right url string", u1.toString()
-					.equals("http://www.yahoo2.com:9999"));
+							);
+			assertEquals("b) Does not return the right url string", "http://www.yahoo2.com:9999", u1.toString()
+					);
 			assertTrue("c) Does not return the right url string", u
 					.equals(new URL(u.toString())));
 
 			u = new URL("http:index");
-			assertTrue("2 wrong external form", u.toExternalForm().equals(
-					"http:index"));
+			assertEquals("2 wrong external form", 
+					"http:index", u.toExternalForm());
 
 			u = new URL("http", null, "index");
-			assertTrue("2 wrong external form", u.toExternalForm().equals(
-					"http:index"));
+			assertEquals("2 wrong external form", 
+					"http:index", u.toExternalForm());
 		} catch (Exception e) {
 		}
 	}
@@ -952,8 +950,8 @@
 		try {
 			u = new URL("http", "www.yahoo.com:8080", 1233,
 					"test/!@$%^&*/test.html#foo");
-			assertTrue("returns a wrong file", u.getFile().equals(
-					"test/!@$%^&*/test.html"));
+			assertEquals("returns a wrong file", 
+					"test/!@$%^&*/test.html", u.getFile());
 			u = new URL("http", "www.yahoo.com:8080", 1233, "");
 			assertTrue("returns a wrong file", u.getFile().equals(""));
 		} catch (Exception e) {
@@ -979,7 +977,7 @@
 			assertTrue("return wrong port number " + u.getPort(),
 					u.getPort() == 9999);
 			u = new URL("http://member12.c++.com:9999/");
-			assertTrue("return wrong port number", u.getPort() == 9999);
+			assertEquals("return wrong port number", 9999, u.getPort());
 		} catch (Exception e) {
 			fail("Threw exception : " + e.getMessage());
 		}
@@ -1009,13 +1007,13 @@
 			u1 = new URL("http://www.yahoo2.com:9999");
 			u = new URL(
 					"http://www.yahoo1.com:8080/dir1/dir2/test.cgi?point1.html#anchor1");
-			assertTrue("returns a wrong anchor1", u.getRef().equals("anchor1"));
-			assertTrue("returns a wrong anchor2", u1.getRef() == null);
+			assertEquals("returns a wrong anchor1", "anchor1", u.getRef());
+			assertNull("returns a wrong anchor2", u1.getRef());
 			u1 = new URL("http://www.yahoo2.com#ref");
-			assertTrue("returns a wrong anchor3", u1.getRef().equals("ref"));
+			assertEquals("returns a wrong anchor3", "ref", u1.getRef());
 			u1 = new URL("http://www.yahoo2.com/file#ref1#ref2");
-			assertTrue("returns a wrong anchor4", u1.getRef().equals(
-					"ref1#ref2"));
+			assertEquals("returns a wrong anchor4", 
+					"ref1#ref2", u1.getRef());
 		} catch (MalformedURLException e) {
 			fail("Incorrect URL format : " + e.getMessage());
 		}
@@ -1029,21 +1027,21 @@
 			URL url = new URL("http", "u:p@home", 80, "/java?q1#ref");
 			assertTrue("wrong authority: " + url.getAuthority(), url
 					.getAuthority().equals("u:p@home:80"));
-			assertTrue("wrong userInfo", url.getUserInfo().equals("u:p"));
-			assertTrue("wrong host", url.getHost().equals("home"));
-			assertTrue("wrong file", url.getFile().equals("/java?q1"));
-			assertTrue("wrong path", url.getPath().equals("/java"));
-			assertTrue("wrong query", url.getQuery().equals("q1"));
-			assertTrue("wrong ref", url.getRef().equals("ref"));
+			assertEquals("wrong userInfo", "u:p", url.getUserInfo());
+			assertEquals("wrong host", "home", url.getHost());
+			assertEquals("wrong file", "/java?q1", url.getFile());
+			assertEquals("wrong path", "/java", url.getPath());
+			assertEquals("wrong query", "q1", url.getQuery());
+			assertEquals("wrong ref", "ref", url.getRef());
 
 			url = new URL("http", "home", -1, "/java");
-			assertTrue("wrong authority2", url.getAuthority().equals("home"));
-			assertTrue("wrong userInfo2", url.getUserInfo() == null);
-			assertTrue("wrong host2", url.getHost().equals("home"));
-			assertTrue("wrong file2", url.getFile().equals("/java"));
-			assertTrue("wrong path2", url.getPath().equals("/java"));
-			assertTrue("wrong query2", url.getQuery() == null);
-			assertTrue("wrong ref2", url.getRef() == null);
+			assertEquals("wrong authority2", "home", url.getAuthority());
+			assertNull("wrong userInfo2", url.getUserInfo());
+			assertEquals("wrong host2", "home", url.getHost());
+			assertEquals("wrong file2", "/java", url.getFile());
+			assertEquals("wrong path2", "/java", url.getPath());
+			assertNull("wrong query2", url.getQuery());
+			assertNull("wrong ref2", url.getRef());
 		} catch (MalformedURLException e) {
 			fail("Unexpected MalformedURLException : " + e.getMessage());
 		}

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/AbstractCollectionTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/AbstractCollectionTest.java?rev=397123&r1=397122&r2=397123&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/AbstractCollectionTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/AbstractCollectionTest.java Wed Apr 26 00:12:16 2006
@@ -145,7 +145,7 @@
 					.contains(intArray[i]));
 			duplicates.add(intArray[i]);
 		}
-		assertTrue("End of list should be null", intArray[100] == null);
+		assertNull("End of list should be null", intArray[100]);
 
 		intArray = new Integer[1];
 		intArray = (Integer[]) org.toArray(intArray);

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/ArrayListTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/ArrayListTest.java?rev=397123&r1=397122&r2=397123&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/ArrayListTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/ArrayListTest.java Wed Apr 26 00:12:16 2006
@@ -53,7 +53,7 @@
 	public void test_ConstructorI() {
 		// Test for method java.util.ArrayList(int)
 		ArrayList al = new ArrayList(5);
-		assertTrue("Incorrect arrayList created", al.size() == 0);
+		assertEquals("Incorrect arrayList created", 0, al.size());
 	}
 
 	/**
@@ -84,7 +84,7 @@
 						&& (alist.get(52) == objArray[51]));
 		Object oldItem = alist.get(25);
 		alist.add(25, null);
-		assertTrue("Should have returned null", alist.get(25) == null);
+		assertNull("Should have returned null", alist.get(25));
 		assertTrue("Should have returned the old item from slot 25", alist
 				.get(26) == oldItem);
 	}
@@ -98,7 +98,7 @@
 		alist.add(o);
 		assertTrue("Failed to add Object", alist.get(alist.size() - 1) == o);
 		alist.add(null);
-		assertTrue("Failed to add null", alist.get(alist.size() - 1) == null);
+		assertNull("Failed to add null", alist.get(alist.size() - 1));
 	}
 
 	/**
@@ -108,8 +108,8 @@
 		// Test for method boolean java.util.ArrayList.addAll(int,
 		// java.util.Collection)
 		alist.addAll(50, alist);
-		assertTrue("Returned incorrect size after adding to existing list",
-				alist.size() == 200);
+		assertEquals("Returned incorrect size after adding to existing list",
+				200, alist.size());
 		for (int i = 0; i < 50; i++)
 			assertTrue("Manipulated elements < index",
 					alist.get(i) == objArray[i]);
@@ -127,13 +127,13 @@
 		listWithNulls.add(null);
 		alist.addAll(100, listWithNulls);
 		assertTrue("Incorrect size: " + alist.size(), alist.size() == 205);
-		assertTrue("Item at slot 100 should be null", alist.get(100) == null);
-		assertTrue("Item at slot 101 should be null", alist.get(101) == null);
-		assertTrue("Item at slot 102 should be 'yoink'", alist.get(102).equals(
-				"yoink"));
-		assertTrue("Item at slot 103 should be 'kazoo'", alist.get(103).equals(
-				"kazoo"));
-		assertTrue("Item at slot 104 should be null", alist.get(104) == null);
+		assertNull("Item at slot 100 should be null", alist.get(100));
+		assertNull("Item at slot 101 should be null", alist.get(101));
+		assertEquals("Item at slot 102 should be 'yoink'", 
+				"yoink", alist.get(102));
+		assertEquals("Item at slot 103 should be 'kazoo'", 
+				"kazoo", alist.get(103));
+		assertNull("Item at slot 104 should be null", alist.get(104));
 		alist.addAll(205, listWithNulls);
 		assertTrue("Incorrect size2: " + alist.size(), alist.size() == 210);
 	}
@@ -150,8 +150,8 @@
 			assertTrue("Failed to add elements properly", l.get(i).equals(
 					alist.get(i)));
 		alist.addAll(alist);
-		assertTrue("Returned incorrect size after adding to existing list",
-				alist.size() == 200);
+		assertEquals("Returned incorrect size after adding to existing list",
+				200, alist.size());
 		for (int i = 0; i < 100; i++) {
 			assertTrue("Added to list in incorrect order", alist.get(i)
 					.equals(l.get(i)));
@@ -181,16 +181,16 @@
 	public void test_clear() {
 		// Test for method void java.util.ArrayList.clear()
 		alist.clear();
-		assertTrue("List did not clear", alist.size() == 0);
+		assertEquals("List did not clear", 0, alist.size());
 		alist.add(null);
 		alist.add(null);
 		alist.add(null);
 		alist.add("bam");
 		alist.clear();
-		assertTrue("List with nulls did not clear", alist.size() == 0);
+		assertEquals("List with nulls did not clear", 0, alist.size());
 		/*
-		 * for (int i = 0; i < alist.size(); i++) assertTrue("Failed to clear
-		 * list", alist.get(i) == null);
+		 * for (int i = 0; i < alist.size(); i++) assertNull("Failed to clear
+		 * list", alist.get(i));
 		 */
 
 	}
@@ -289,10 +289,10 @@
 	 */
 	public void test_indexOfLjava_lang_Object() {
 		// Test for method int java.util.ArrayList.indexOf(java.lang.Object)
-		assertTrue("Returned incorrect index",
-				alist.indexOf(objArray[87]) == 87);
-		assertTrue("Returned index for invalid Object", alist
-				.indexOf(new Object()) == -1);
+		assertEquals("Returned incorrect index",
+				87, alist.indexOf(objArray[87]));
+		assertEquals("Returned index for invalid Object", -1, alist
+				.indexOf(new Object()));
 		alist.add(25, null);
 		alist.add(50, null);
 		assertTrue("Wrong indexOf for null.  Wanted 25 got: "
@@ -316,10 +316,10 @@
 	public void test_lastIndexOfLjava_lang_Object() {
 		// Test for method int java.util.ArrayList.lastIndexOf(java.lang.Object)
 		alist.add(new Integer(99));
-		assertTrue("Returned incorrect index",
-				alist.lastIndexOf(objArray[99]) == 100);
-		assertTrue("Returned index for invalid Object", alist
-				.lastIndexOf(new Object()) == -1);
+		assertEquals("Returned incorrect index",
+				100, alist.lastIndexOf(objArray[99]));
+		assertEquals("Returned index for invalid Object", -1, alist
+				.lastIndexOf(new Object()));
 		alist.add(25, null);
 		alist.add(50, null);
 		assertTrue("Wrong lastIndexOf for null.  Wanted 50 got: "
@@ -332,8 +332,8 @@
 	public void test_removeI() {
 		// Test for method java.lang.Object java.util.ArrayList.remove(int)
 		alist.remove(10);
-		assertTrue("Failed to remove element",
-				alist.indexOf(objArray[10]) == -1);
+		assertEquals("Failed to remove element",
+				-1, alist.indexOf(objArray[10]));
 		boolean exception = false;
 		try {
 			alist.remove(999);
@@ -387,7 +387,7 @@
 		alist.set(65, obj = new Object());
 		assertTrue("Failed to set object", alist.get(65) == obj);
 		alist.set(50, null);
-		assertTrue("Setting to null did not work", alist.get(50) == null);
+		assertNull("Setting to null did not work", alist.get(50));
 		assertTrue("Setting increased the list's size to: " + alist.size(),
 				alist.size() == 100);
 	}
@@ -397,10 +397,10 @@
 	 */
 	public void test_size() {
 		// Test for method int java.util.ArrayList.size()
-		assertTrue("Returned incorrect size for exiting list",
-				alist.size() == 100);
-		assertTrue("Returned incorrect size for new list", new ArrayList()
-				.size() == 0);
+		assertEquals("Returned incorrect size for exiting list",
+				100, alist.size());
+		assertEquals("Returned incorrect size for new list", 0, new ArrayList()
+				.size());
 	}
 
 	/**
@@ -416,8 +416,8 @@
 
 		for (int i = 0; i < obj.length; i++) {
 			if ((i == 25) || (i == 75))
-				assertTrue("Should be null at: " + i + " but instead got: "
-						+ obj[i], obj[i] == null);
+				assertNull("Should be null at: " + i + " but instead got: "
+						+ obj[i], obj[i]);
 			else
 				assertTrue("Returned incorrect array: " + i,
 						obj[i] == objArray[i]);
@@ -439,11 +439,11 @@
 		assertTrue("Returned different array than passed", retArray == argArray);
 		argArray = new Integer[1000];
 		retArray = alist.toArray(argArray);
-		assertTrue("Failed to set first extra element to null", argArray[alist
-				.size()] == null);
+		assertNull("Failed to set first extra element to null", argArray[alist
+				.size()]);
 		for (int i = 0; i < 100; i++) {
 			if ((i == 25) || (i == 75))
-				assertTrue("Should be null: " + i, retArray[i] == null);
+				assertNull("Should be null: " + i, retArray[i]);
 			else
 				assertTrue("Returned incorrect array: " + i,
 						retArray[i] == objArray[i]);
@@ -458,7 +458,7 @@
 		for (int i = 99; i > 24; i--)
 			alist.remove(i);
 		((ArrayList) alist).trimToSize();
-		assertTrue("Returned incorrect size after trim", alist.size() == 25);
+		assertEquals("Returned incorrect size after trim", 25, alist.size());
 		for (int i = 0; i < alist.size(); i++)
 			assertTrue("Trimmed list contained incorrect elements", alist
 					.get(i) == objArray[i]);

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/ArraysTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/ArraysTest.java?rev=397123&r1=397122&r2=397123&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/ArraysTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/ArraysTest.java Wed Apr 26 00:12:16 2006
@@ -103,8 +103,8 @@
 		for (byte counter = 0; counter < arraySize; counter++)
 			assertTrue("Binary search on byte[] answered incorrect position",
 					Arrays.binarySearch(byteArray, counter) == counter);
-		assertTrue("Binary search succeeded for value not present in array 1",
-				Arrays.binarySearch(intArray, (byte) -1) == -1);
+		assertEquals("Binary search succeeded for value not present in array 1",
+				-1, Arrays.binarySearch(intArray, (byte) -1));
 		assertTrue(
 				"Binary search succeeded for value not present in array 2",
 				Arrays.binarySearch(intArray, (byte) arraySize) == -(arraySize + 1));
@@ -125,8 +125,8 @@
 			assertTrue(
 					"Binary search on char[] answered incorrect position",
 					Arrays.binarySearch(charArray, (char) (counter + 1)) == counter);
-		assertTrue("Binary search succeeded for value not present in array 1",
-				Arrays.binarySearch(charArray, '\u0000') == -1);
+		assertEquals("Binary search succeeded for value not present in array 1",
+				-1, Arrays.binarySearch(charArray, '\u0000'));
 		assertTrue(
 				"Binary search succeeded for value not present in array 2",
 				Arrays.binarySearch(charArray, (char) (arraySize + 1)) == -(arraySize + 1));
@@ -141,8 +141,8 @@
 			assertTrue(
 					"Binary search on double[] answered incorrect position",
 					Arrays.binarySearch(doubleArray, (double) counter) == (double) counter);
-		assertTrue("Binary search succeeded for value not present in array 1",
-				Arrays.binarySearch(doubleArray, (double) -1) == -1);
+		assertEquals("Binary search succeeded for value not present in array 1",
+				-1, Arrays.binarySearch(doubleArray, (double) -1));
 		assertTrue(
 				"Binary search succeeded for value not present in array 2",
 				Arrays.binarySearch(doubleArray, (double) arraySize) == -(arraySize + 1));
@@ -161,8 +161,8 @@
 			int result = Arrays.binarySearch(specials, specials[i]);
 			assertTrue(specials[i] + " invalid: " + result, result == i);
 		}
-		assertTrue("-1d", Arrays.binarySearch(specials, -1d) == -4);
-		assertTrue("1d", Arrays.binarySearch(specials, 1d) == -8);
+		assertEquals("-1d", -4, Arrays.binarySearch(specials, -1d));
+		assertEquals("1d", -8, Arrays.binarySearch(specials, 1d));
 
 	}
 
@@ -175,8 +175,8 @@
 			assertTrue(
 					"Binary search on float[] answered incorrect position",
 					Arrays.binarySearch(floatArray, (float) counter) == (float) counter);
-		assertTrue("Binary search succeeded for value not present in array 1",
-				Arrays.binarySearch(floatArray, (float) -1) == -1);
+		assertEquals("Binary search succeeded for value not present in array 1",
+				-1, Arrays.binarySearch(floatArray, (float) -1));
 		assertTrue(
 				"Binary search succeeded for value not present in array 2",
 				Arrays.binarySearch(floatArray, (float) arraySize) == -(arraySize + 1));
@@ -195,8 +195,8 @@
 			int result = Arrays.binarySearch(specials, specials[i]);
 			assertTrue(specials[i] + " invalid: " + result, result == i);
 		}
-		assertTrue("-1f", Arrays.binarySearch(specials, -1f) == -4);
-		assertTrue("1f", Arrays.binarySearch(specials, 1f) == -8);
+		assertEquals("-1f", -4, Arrays.binarySearch(specials, -1f));
+		assertEquals("1f", -8, Arrays.binarySearch(specials, 1f));
 	}
 
 	/**
@@ -207,8 +207,8 @@
 		for (int counter = 0; counter < arraySize; counter++)
 			assertTrue("Binary search on int[] answered incorrect position",
 					Arrays.binarySearch(intArray, counter) == counter);
-		assertTrue("Binary search succeeded for value not present in array 1",
-				Arrays.binarySearch(intArray, -1) == -1);
+		assertEquals("Binary search succeeded for value not present in array 1",
+				-1, Arrays.binarySearch(intArray, -1));
 		assertTrue("Binary search succeeded for value not present in array 2",
 				Arrays.binarySearch(intArray, arraySize) == -(arraySize + 1));
 		for (int counter = 0; counter < arraySize; counter++)
@@ -227,8 +227,8 @@
 		for (long counter = 0; counter < arraySize; counter++)
 			assertTrue("Binary search on long[] answered incorrect position",
 					Arrays.binarySearch(longArray, counter) == counter);
-		assertTrue("Binary search succeeded for value not present in array 1",
-				Arrays.binarySearch(longArray, (long) -1) == -1);
+		assertEquals("Binary search succeeded for value not present in array 1",
+				-1, Arrays.binarySearch(longArray, (long) -1));
 		assertTrue(
 				"Binary search succeeded for value not present in array 2",
 				Arrays.binarySearch(longArray, (long) arraySize) == -(arraySize + 1));
@@ -251,8 +251,8 @@
 			assertTrue(
 					"Binary search on Object[] answered incorrect position",
 					Arrays.binarySearch(objectArray, objArray[counter]) == counter);
-		assertTrue("Binary search succeeded for value not present in array 1",
-				Arrays.binarySearch(objectArray, new Integer(-1)) == -1);
+		assertEquals("Binary search succeeded for value not present in array 1",
+				-1, Arrays.binarySearch(objectArray, new Integer(-1)));
 		assertTrue(
 				"Binary search succeeded for value not present in array 2",
 				Arrays.binarySearch(objectArray, new Integer(arraySize)) == -(arraySize + 1));
@@ -271,9 +271,8 @@
 		assertTrue(
 				"Binary search succeeded for value not present in array 1",
 				Arrays.binarySearch(objectArray, new Integer(-1), comp) == -(arraySize + 1));
-		assertTrue(
-				"Binary search succeeded for value not present in array 2",
-				Arrays.binarySearch(objectArray, new Integer(arraySize), comp) == -1);
+		assertEquals("Binary search succeeded for value not present in array 2",
+				-1, Arrays.binarySearch(objectArray, new Integer(arraySize), comp));
 		for (int counter = 0; counter < arraySize; counter++)
 			assertTrue(
 					"Binary search on Object[] with custom comparator answered incorrect position",
@@ -289,8 +288,8 @@
 		for (short counter = 0; counter < arraySize; counter++)
 			assertTrue("Binary search on short[] answered incorrect position",
 					Arrays.binarySearch(shortArray, counter) == counter);
-		assertTrue("Binary search succeeded for value not present in array 1",
-				Arrays.binarySearch(intArray, (short) -1) == -1);
+		assertEquals("Binary search succeeded for value not present in array 1",
+				-1, Arrays.binarySearch(intArray, (short) -1));
 		assertTrue(
 				"Binary search succeeded for value not present in array 2",
 				Arrays.binarySearch(intArray, (short) arraySize) == -(arraySize + 1));
@@ -337,7 +336,7 @@
 		} catch (IllegalArgumentException e) {
 			result = 2;
 		}
-		assertTrue("Wrong exception1", result == 2);
+		assertEquals("Wrong exception1", 2, result);
 		try {
 			Arrays.fill(new byte[2], -1, 1, (byte) 27);
 			result = 0;
@@ -346,7 +345,7 @@
 		} catch (IllegalArgumentException e) {
 			result = 2;
 		}
-		assertTrue("Wrong exception2", result == 1);
+		assertEquals("Wrong exception2", 1, result);
 		try {
 			Arrays.fill(new byte[2], 1, 4, (byte) 27);
 			result = 0;
@@ -355,7 +354,7 @@
 		} catch (IllegalArgumentException e) {
 			result = 2;
 		}
-		assertTrue("Wrong exception", result == 1);
+		assertEquals("Wrong exception", 1, result);
 	}
 
 	/**
@@ -394,7 +393,7 @@
 		char d[] = new char[1000];
 		Arrays.fill(d, 'V');
 		for (int i = 0; i < d.length; i++)
-			assertTrue("Failed to fill char array correctly", d[i] == 'V');
+			assertEquals("Failed to fill char array correctly", 'V', d[i]);
 	}
 
 	/**
@@ -576,8 +575,8 @@
 
 		Arrays.fill(d, 400, d.length, null);
 		for (int i = 400; i < d.length; i++)
-			assertTrue("Failed to fill Object array correctly with nulls",
-					d[i] == null);
+			assertNull("Failed to fill Object array correctly with nulls",
+					d[i]);
 	}
 
 	/**

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/BitSetTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/BitSetTest.java?rev=397123&r1=397122&r2=397123&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/BitSetTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/BitSetTest.java Wed Apr 26 00:12:16 2006
@@ -29,9 +29,9 @@
 		BitSet bs = new BitSet();
 		// Default size for a BitSet should be 64 elements;
 
-		assertTrue("Created BitSet of incorrect size", bs.size() == 64);
-		assertTrue("New BitSet had invalid string representation", bs
-				.toString().equals("{}"));
+		assertEquals("Created BitSet of incorrect size", 64, bs.size());
+		assertEquals("New BitSet had invalid string representation", "{}", bs
+				.toString());
 	}
 
 	/**
@@ -42,14 +42,14 @@
 		BitSet bs = new BitSet(128);
 		// Default size for a BitSet should be 64 elements;
 
-		assertTrue("Created BitSet of incorrect size", bs.size() == 128);
+		assertEquals("Created BitSet of incorrect size", 128, bs.size());
 		assertTrue("New BitSet had invalid string representation: "
 				+ bs.toString(), bs.toString().equals("{}"));
 
 		// All BitSets are created with elements of multiples of 64
 
 		bs = new BitSet(89);
-		assertTrue("Failed to round BitSet element size", bs.size() == 128);
+		assertEquals("Failed to round BitSet element size", 128, bs.size());
 
 		try {
 			bs = new BitSet(-9);
@@ -196,7 +196,7 @@
 		initialSize = bs.size();
 		bs.set(0, initialSize);
 		bs.clear(7, 64);
-		assertTrue("Failed to grow BitSet", bs.size() == 128);
+		assertEquals("Failed to grow BitSet", 128, bs.size());
 		for (int i = 0; i < 7; i++)
 			assertTrue("Shouldn't have cleared bit " + i, bs.get(i));
 		for (int i = 7; i < 64; i++)
@@ -449,7 +449,7 @@
 
 		// Try setting a bit on a 64 boundary
 		bs.set(128);
-		assertTrue("Failed to grow BitSet", bs.size() == 192);
+		assertEquals("Failed to grow BitSet", 192, bs.size());
 		assertTrue("Failed to set bit", bs.get(128));
 
 		bs = new BitSet(64);
@@ -510,7 +510,7 @@
 		// pos1 and pos2 is in the same bitset element, boundary testing
 		bs = new BitSet(16);
 		bs.set(7, 64);
-		assertTrue("Failed to grow BitSet", bs.size() == 128);
+		assertEquals("Failed to grow BitSet", 128, bs.size());
 		for (int i = 0; i < 7; i++)
 			assertTrue("Shouldn't have set bit " + i, !bs.get(i));
 		for (int i = 7; i < 64; i++)
@@ -641,7 +641,7 @@
 
 		// Try setting a bit on a 64 boundary
 		bs.flip(128);
-		assertTrue("Failed to grow BitSet", bs.size() == 192);
+		assertEquals("Failed to grow BitSet", 192, bs.size());
 		assertTrue("Failed to flip bit", bs.get(128));
 
 		bs = new BitSet(64);
@@ -657,16 +657,16 @@
 		}
 
 		BitSet bs0 = new BitSet(0);
-		assertTrue("Test1: Wrong size", bs0.size() == 0);
-		assertTrue("Test1: Wrong length", bs0.length() == 0);
+		assertEquals("Test1: Wrong size", 0, bs0.size());
+		assertEquals("Test1: Wrong length", 0, bs0.length());
 
 		bs0.flip(0);
-		assertTrue("Test2: Wrong size", bs0.size() == 64);
-		assertTrue("Test2: Wrong length", bs0.length() == 1);
+		assertEquals("Test2: Wrong size", 64, bs0.size());
+		assertEquals("Test2: Wrong length", 1, bs0.length());
 
 		bs0.flip(63);
-		assertTrue("Test3: Wrong size", bs0.size() == 64);
-		assertTrue("Test3: Wrong length", bs0.length() == 64);
+		assertEquals("Test3: Wrong size", 64, bs0.size());
+		assertEquals("Test3: Wrong length", 64, bs0.length());
 
 		eightbs.flip(7);
 		assertTrue("Failed to flip bit 7", !eightbs.get(7));
@@ -706,7 +706,7 @@
 		bs.set(7);
 		bs.set(10);
 		bs.flip(7, 64);
-		assertTrue("Failed to grow BitSet", bs.size() == 128);
+		assertEquals("Failed to grow BitSet", 128, bs.size());
 		for (int i = 0; i < 7; i++)
 			assertTrue("Shouldn't have flipped bit " + i, !bs.get(i));
 		assertTrue("Failed to flip bit 7", !bs.get(7));
@@ -825,8 +825,8 @@
 			assertTrue("Bit got flipped incorrectly ", eightbs.get(0));
 
 			BitSet bsnew = eightbs.get(2, 2);
-			assertTrue("BitSet retrieved incorrectly ",
-					bsnew.cardinality() == 0);
+			assertEquals("BitSet retrieved incorrectly ",
+					0, bsnew.cardinality());
 
 			eightbs.set(10, 10);
 			assertTrue("Bit got set incorrectly ", !eightbs.get(10));
@@ -946,12 +946,12 @@
 		bs2.set(2);
 		bs2.set(3);
 		bs.andNot(bs2);
-		assertTrue("Incorrect bitset after andNot", bs.toString().equals(
-				"{0, 1, 4, 6, 7}"));
+		assertEquals("Incorrect bitset after andNot", 
+				"{0, 1, 4, 6, 7}", bs.toString());
 
 		bs = new BitSet(0);
 		bs.andNot(bs2);
-		assertTrue("Incorrect size", bs.size() == 0);
+		assertEquals("Incorrect size", 0, bs.size());
 	}
 
 	/**
@@ -997,7 +997,7 @@
 
 		bs = new BitSet();
 		bs.set(63);
-		assertTrue("Test highest bit", bs.toString().equals("{63}"));
+		assertEquals("Test highest bit", "{63}", bs.toString());
 	}
 
 	/**
@@ -1005,7 +1005,7 @@
 	 */
 	public void test_size() {
 		// Test for method int java.util.BitSet.size()
-		assertTrue("Returned incorrect size", eightbs.size() == 64);
+		assertEquals("Returned incorrect size", 64, eightbs.size());
 		eightbs.set(129);
 		assertTrue("Returned incorrect size", eightbs.size() >= 129);
 
@@ -1016,11 +1016,11 @@
 	 */
 	public void test_toString() {
 		// Test for method java.lang.String java.util.BitSet.toString()
-		assertTrue("Returned incorrect string representation", eightbs
-				.toString().equals("{0, 1, 2, 3, 4, 5, 6, 7}"));
+		assertEquals("Returned incorrect string representation", "{0, 1, 2, 3, 4, 5, 6, 7}", eightbs
+				.toString());
 		eightbs.clear(2);
-		assertTrue("Returned incorrect string representation", eightbs
-				.toString().equals("{0, 1, 3, 4, 5, 6, 7}"));
+		assertEquals("Returned incorrect string representation", "{0, 1, 3, 4, 5, 6, 7}", eightbs
+				.toString());
 	}
 
 	/**

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/CalendarTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/CalendarTest.java?rev=397123&r1=397122&r2=397123&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/CalendarTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/CalendarTest.java Wed Apr 26 00:12:16 2006
@@ -370,7 +370,7 @@
 		Calendar cal = Calendar.getInstance();
 		// Use millisecond time for testing in Core
 		cal.setTime(new Date(884581200000L)); // (98, Calendar.JANUARY, 12)
-		assertTrue("incorrect millis", cal.getTime().getTime() == 884581200000L);
+		assertEquals("incorrect millis", 884581200000L, cal.getTime().getTime());
 		cal.setTimeZone(TimeZone.getTimeZone("EST"));
 		cal.setTime(new Date(943506000000L)); // (99, Calendar.NOVEMBER, 25)
 		assertTrue("incorrect fields", cal.get(Calendar.YEAR) == 1999



Mime
View raw message