Index: modules/archive/src/test/java/tests/api/java/util/jar/AttributesTest.java =================================================================== --- modules/archive/src/test/java/tests/api/java/util/jar/AttributesTest.java.orig 2006-04-16 11:47:21.000000000 +0100 +++ modules/archive/src/test/java/tests/api/java/util/jar/AttributesTest.java 2006-04-16 13:59:11.000000000 +0100 @@ -124,7 +124,7 @@ public void test_getLjava_lang_Object() { // Test for method java.lang.Object // java.util.jar.Attributes.get(java.lang.Object) - assertTrue("a) Incorrect value returned", a.getValue("1").equals("one")); + assertEquals("a) Incorrect value returned", "one", a.getValue("1")); assertNull("b) Incorrect value returned", a.getValue("0")); } @@ -177,10 +177,10 @@ b.putValue("5", "go"); b.putValue("6", "roku"); a.putAll(b); - assertTrue("Should not have been replaced", a.getValue("1").equals( - "one")); - assertTrue("Should have been replaced", a.getValue("3").equals("san")); - assertTrue("Should have been added", a.getValue("5").equals("go")); + assertEquals("Should not have been replaced", + "one", a.getValue("1")); + assertEquals("Should have been replaced", "san", a.getValue("3")); + assertEquals("Should have been added", "go", a.getValue("5")); } @@ -193,8 +193,8 @@ a.remove(new Attributes.Name("1")); a.remove(new Attributes.Name("3")); assertNull("Should have been removed", a.getValue("1")); - assertTrue("Should not have been removed", a.getValue("4").equals( - "four")); + assertEquals("Should not have been removed", + "four", a.getValue("4")); } /** Index: modules/archive/src/test/java/tests/api/java/util/jar/ManifestTest.java =================================================================== --- modules/archive/src/test/java/tests/api/java/util/jar/ManifestTest.java.orig 2006-04-16 11:47:21.000000000 +0100 +++ modules/archive/src/test/java/tests/api/java/util/jar/ManifestTest.java 2006-04-16 14:00:48.000000000 +0100 @@ -71,45 +71,40 @@ fail("IOException"); } Attributes main = manifest.getMainAttributes(); - assertTrue("Bundle-Name not correct", main.getValue("Bundle-Name") - .equals("ClientSupport")); - assertTrue( - "Bundle-Description not correct", - main + assertEquals("Bundle-Name not correct", "ClientSupport", main.getValue("Bundle-Name") + ); + assertEquals("Bundle-Description not correct", + + "Provides SessionService, AuthenticationService. Extends RegistryService.", main .getValue("Bundle-Description") - .equals( - "Provides SessionService, AuthenticationService. Extends RegistryService.")); - assertTrue("Bundle-Activator not correct", main.getValue( - "Bundle-Activator").equals( - "com.ibm.ive.eccomm.client.support.ClientSupportActivator")); - assertTrue( - "Import-Package not correct", - main + ); + assertEquals("Bundle-Activator not correct", + "com.ibm.ive.eccomm.client.support.ClientSupportActivator", main.getValue( + "Bundle-Activator")); + assertEquals("Import-Package not correct", + + "com.ibm.ive.eccomm.client.services.log,com.ibm.ive.eccomm.client.services.registry,com.ibm.ive.eccomm.service.registry; specification-version=1.0.0,com.ibm.ive.eccomm.service.session; specification-version=1.0.0,com.ibm.ive.eccomm.service.framework; specification-version=1.2.0,org.osgi.framework; specification-version=1.0.0,org.osgi.service.log; specification-version=1.0.0,com.ibm.ive.eccomm.flash; specification-version=1.2.0,com.ibm.ive.eccomm.client.xml,com.ibm.ive.eccomm.client.http.common,com.ibm.ive.eccomm.client.http.client", main .getValue("Import-Package") - .equals( - "com.ibm.ive.eccomm.client.services.log,com.ibm.ive.eccomm.client.services.registry,com.ibm.ive.eccomm.service.registry; specification-version=1.0.0,com.ibm.ive.eccomm.service.session; specification-version=1.0.0,com.ibm.ive.eccomm.service.framework; specification-version=1.2.0,org.osgi.framework; specification-version=1.0.0,org.osgi.service.log; specification-version=1.0.0,com.ibm.ive.eccomm.flash; specification-version=1.2.0,com.ibm.ive.eccomm.client.xml,com.ibm.ive.eccomm.client.http.common,com.ibm.ive.eccomm.client.http.client")); - assertTrue( - "Import-Service not correct", - main + ); + assertEquals("Import-Service not correct", + + "org.osgi.service.log.LogReaderServiceorg.osgi.service.log.LogService,com.ibm.ive.eccomm.service.registry.RegistryService", main .getValue("Import-Service") - .equals( - "org.osgi.service.log.LogReaderServiceorg.osgi.service.log.LogService,com.ibm.ive.eccomm.service.registry.RegistryService")); - assertTrue( - "Export-Package not correct", - main + ); + assertEquals("Export-Package not correct", + + "com.ibm.ive.eccomm.client.services.authentication; specification-version=1.0.0,com.ibm.ive.eccomm.service.authentication; specification-version=1.0.0,com.ibm.ive.eccomm.common; specification-version=1.0.0,com.ibm.ive.eccomm.client.services.registry.store; specification-version=1.0.0", main .getValue("Export-Package") - .equals( - "com.ibm.ive.eccomm.client.services.authentication; specification-version=1.0.0,com.ibm.ive.eccomm.service.authentication; specification-version=1.0.0,com.ibm.ive.eccomm.common; specification-version=1.0.0,com.ibm.ive.eccomm.client.services.registry.store; specification-version=1.0.0")); - assertTrue( - "Export-Service not correct", - main + ); + assertEquals("Export-Service not correct", + + "com.ibm.ive.eccomm.service.authentication.AuthenticationService,com.ibm.ive.eccomm.service.session.SessionService", main .getValue("Export-Service") - .equals( - "com.ibm.ive.eccomm.service.authentication.AuthenticationService,com.ibm.ive.eccomm.service.session.SessionService")); - assertTrue("Bundle-Vendor not correct", main.getValue("Bundle-Vendor") - .equals("IBM")); - assertTrue("Bundle-Version not correct", main - .getValue("Bundle-Version").equals("1.2.0")); + ); + assertEquals("Bundle-Vendor not correct", "IBM", main.getValue("Bundle-Vendor") + ); + assertEquals("Bundle-Version not correct", "1.2.0", main + .getValue("Bundle-Version")); } /** @@ -131,8 +126,8 @@ // java.util.jar.Manifest.getAttributes(java.lang.String) assertNull("Should not exist", m2.getAttributes("Doesn't Exist")); - assertTrue("Should exist", m2.getAttributes("HasAttributes.txt").get( - new Attributes.Name("MyAttribute")).equals("OK")); + assertEquals("Should exist", "OK", m2.getAttributes("HasAttributes.txt").get( + new Attributes.Name("MyAttribute"))); } /** @@ -142,9 +137,9 @@ // Test for method java.util.Map java.util.jar.Manifest.getEntries() Map myMap = m2.getEntries(); assertNull("Shouldn't exist", myMap.get("Doesn't exist")); - assertTrue("Should exist", - ((Attributes) myMap.get("HasAttributes.txt")).get( - new Attributes.Name("MyAttribute")).equals("OK")); + assertEquals("Should exist", + "OK", ((Attributes) myMap.get("HasAttributes.txt")).get( + new Attributes.Name("MyAttribute"))); } @@ -155,8 +150,8 @@ // Test for method java.util.jar.Attributes // java.util.jar.Manifest.getMainAttributes() Attributes a = m.getMainAttributes(); - assertTrue("Manifest_Version should return 1.0", a.get( - Attributes.Name.MANIFEST_VERSION).equals("1.0")); + assertEquals("Manifest_Version should return 1.0", "1.0", a.get( + Attributes.Name.MANIFEST_VERSION)); } /** Index: modules/archive/src/test/java/tests/api/java/util/zip/ZipEntryTest.java =================================================================== --- modules/archive/src/test/java/tests/api/java/util/zip/ZipEntryTest.java.orig 2006-04-16 11:47:21.000000000 +0100 +++ modules/archive/src/test/java/tests/api/java/util/zip/ZipEntryTest.java 2006-04-16 14:00:48.000000000 +0100 @@ -83,8 +83,8 @@ ZipEntry zipEntry = new ZipEntry("zippy.zip"); assertNull("Incorrect Comment Returned.", zipEntry.getComment()); zipEntry.setComment("This Is A Comment"); - assertTrue("Incorrect Comment Returned.", zipEntry.getComment().equals( - "This Is A Comment")); + assertEquals("Incorrect Comment Returned.", + "This Is A Comment", zipEntry.getComment()); } /** @@ -138,9 +138,8 @@ */ public void test_getName() { // Test for method java.lang.String java.util.zip.ZipEntry.getName() - assertTrue( - "Incorrect name returned - Note return result somewhat ambiguous in spec", - zentry.getName().equals("File1.txt")); + assertEquals("Incorrect name returned - Note return result somewhat ambiguous in spec", + "File1.txt", zentry.getName()); } /** @@ -179,8 +178,8 @@ // java.util.zip.ZipEntry.setComment(java.lang.String) zentry = zfile.getEntry("File1.txt"); zentry.setComment("Set comment using api"); - assertTrue("Comment not correctly set", zentry.getComment().equals( - "Set comment using api")); + assertEquals("Comment not correctly set", + "Set comment using api", zentry.getComment()); String n = null; zentry.setComment(n); assertNull("Comment not correctly set", zentry.getComment()); @@ -252,9 +251,9 @@ // Test for method void java.util.zip.ZipEntry.setExtra(byte []) zentry = zfile.getEntry("File1.txt"); zentry.setExtra("Test setting extra information".getBytes()); - assertTrue("Extra information not written properly", new String(zentry + assertEquals("Extra information not written properly", "Test setting extra information", new String(zentry .getExtra(), 0, zentry.getExtra().length) - .equals("Test setting extra information")); + ); zentry = new ZipEntry("test.tst"); byte[] ba = new byte[0xFFFF]; try { @@ -390,8 +389,8 @@ zentry2.getSize() == 2); assertTrue("ZipEntry Created With Incorrect Compressed Size.", zentry2 .getCompressedSize() == 4); - assertTrue("ZipEntry Created With Incorrect Comment.", zentry2 - .getComment().equals("Testing")); + assertEquals("ZipEntry Created With Incorrect Comment.", "Testing", zentry2 + .getComment()); assertTrue("ZipEntry Created With Incorrect Crc.", zentry2.getCrc() == orgCrc); assertTrue("ZipEntry Created With Incorrect Time.", Index: modules/archive/src/test/java/tests/api/java/util/zip/ZipFileTest.java =================================================================== --- modules/archive/src/test/java/tests/api/java/util/zip/ZipFileTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/archive/src/test/java/tests/api/java/util/zip/ZipFileTest.java 2006-04-16 13:59:11.000000000 +0100 @@ -198,8 +198,8 @@ byte[] buf = new byte[256]; r = in.read(buf); in.close(); - assertTrue("incorrect contents", new String(buf, 0, r) - .equals("This is also text")); + assertEquals("incorrect contents", "This is also text", new String(buf, 0, r) + ); } catch (IOException e) { fail("Unexpected: " + e); } @@ -218,8 +218,8 @@ byte[] rbuf = new byte[1000]; int r; is.read(rbuf, 0, r = (int) zentry.getSize()); - assertTrue("getInputStream read incorrect data", new String(rbuf, - 0, r).equals("This is text")); + assertEquals("getInputStream read incorrect data", "This is text", new String(rbuf, + 0, r)); } catch (java.io.IOException e) { fail("IOException during getInputStream"); } finally { Index: modules/luni/src/test/java/tests/api/java/io/BufferedReaderTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/io/BufferedReaderTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/io/BufferedReaderTest.java 2006-04-16 13:59:11.000000000 +0100 @@ -268,8 +268,8 @@ try { br = new BufferedReader(new Support_StringReader(testString)); String r = br.readLine(); - assertTrue("readLine returned incorrect string", r - .equals("Test_All_Tests")); + assertEquals("readLine returned incorrect string", "Test_All_Tests", r + ); } catch (java.io.IOException e) { fail("Exception during readLine test"); } Index: modules/luni/src/test/java/tests/api/java/io/BufferedWriterTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/io/BufferedWriterTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/io/BufferedWriterTest.java 2006-04-16 11:47:22.000000000 +0100 @@ -37,7 +37,7 @@ sw = new Support_StringWriter(); bw = new BufferedWriter(sw); sw.write("Hi"); - assertTrue("Constructor failed", sw.toString().equals("Hi")); + assertEquals("Constructor failed", "Hi", sw.toString()); } @@ -71,8 +71,8 @@ bw.write("This should not cause a flush"); assertTrue("Bytes written without flush", sw.toString().equals("")); bw.flush(); - assertTrue("Bytes not flushed", sw.toString().equals( - "This should not cause a flush")); + assertEquals("Bytes not flushed", + "This should not cause a flush", sw.toString()); } catch (Exception e) { fail("Exception during flush test"); } @@ -120,7 +120,7 @@ bw.write('T'); assertTrue("Char written without flush", sw.toString().equals("")); bw.flush(); - assertTrue("Incorrect char written", sw.toString().equals("T")); + assertEquals("Incorrect char written", "T", sw.toString()); } catch (Exception e) { fail("Exception during write test"); } Index: modules/luni/src/test/java/tests/api/java/io/ByteArrayOutputStreamTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/io/ByteArrayOutputStreamTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/io/ByteArrayOutputStreamTest.java 2006-04-16 13:59:11.000000000 +0100 @@ -187,8 +187,8 @@ bos = new java.io.ByteArrayOutputStream(); bos.write('t'); byte[] result = bos.toByteArray(); - assertTrue("Wrote incorrect bytes", - new String(result, 0, result.length).equals("t")); + assertEquals("Wrote incorrect bytes", + "t", new String(result, 0, result.length)); } /** Index: modules/luni/src/test/java/tests/api/java/io/DataOutputStreamTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/io/DataOutputStreamTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/io/DataOutputStreamTest.java 2006-04-16 13:59:11.000000000 +0100 @@ -199,8 +199,8 @@ int i, a = dis.available() / 2; for (i = 0; i < a; i++) chars[i] = dis.readChar(); - assertTrue("Incorrect chars written", new String(chars, 0, i) - .equals("Test String")); + assertEquals("Incorrect chars written", "Test String", new String(chars, 0, i) + ); } catch (IOException e) { fail("Exception during writeChars test : " + e.getMessage()); } Index: modules/luni/src/test/java/tests/api/java/io/FilePermissionTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/io/FilePermissionTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/io/FilePermissionTest.java 2006-04-16 14:00:48.000000000 +0100 @@ -43,9 +43,8 @@ assertTrue("Used to test", true); FilePermission constructFile = new FilePermission("test constructor", "write"); - assertTrue( - "action given to the constructor did not correspond - constructor failed", - constructFile.getActions().equals("write")); + assertEquals("action given to the constructor did not correspond - constructor failed", + "write", constructFile.getActions()); assertTrue( "name given to the construcotr did not correspond - construcotr failed", constructFile.getName() == "test constructor"); @@ -57,10 +56,10 @@ */ public void test_getActions() { // Test for method java.lang.String java.io.FilePermission.getActions() - assertTrue("getActions should have returned only read", readAllFiles - .getActions().equals("read")); - assertTrue("getActions should have returned all actions", allInCurrent - .getActions().equals("read,write,execute,delete")); + assertEquals("getActions should have returned only read", "read", readAllFiles + .getActions()); + assertEquals("getActions should have returned all actions", "read,write,execute,delete", allInCurrent + .getActions()); } /** Index: modules/luni/src/test/java/tests/api/java/io/FileReaderTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/io/FileReaderTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/io/FileReaderTest.java 2006-04-16 11:47:22.000000000 +0100 @@ -44,8 +44,8 @@ char[] buf = new char[100]; int r = br.read(buf); br.close(); - assertTrue("Failed to read correct chars", new String(buf, 0, r) - .equals(" After test string")); + assertEquals("Failed to read correct chars", " After test string", new String(buf, 0, r) + ); } catch (Exception e) { fail("Exception during Constructor test " + e.toString()); } @@ -66,8 +66,8 @@ int r = br.read(buf); br.close(); fis.close(); - assertTrue("Failed to read correct chars", new String(buf, 0, r) - .equals(" After test string")); + assertEquals("Failed to read correct chars", " After test string", new String(buf, 0, r) + ); } catch (Exception e) { fail("Exception during Constructor test " + e.toString()); } @@ -86,8 +86,8 @@ char[] buf = new char[100]; int r = br.read(buf); br.close(); - assertTrue("Failed to read correct chars", new String(buf, 0, r) - .equals(" After test string")); + assertEquals("Failed to read correct chars", " After test string", new String(buf, 0, r) + ); } catch (Exception e) { fail("Exception during Constructor test " + e.toString()); } Index: modules/luni/src/test/java/tests/api/java/io/FileTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/io/FileTest.java.orig 2006-04-16 11:47:21.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/io/FileTest.java 2006-04-16 13:59:11.000000000 +0100 @@ -397,8 +397,8 @@ assertTrue("File Saved To Wrong Directory.", dirName.equals(dir .getPath() + slash)); - assertTrue("File Saved With Incorrect Name.", f1.getName() - .equals("tempfile.tst")); + assertEquals("File Saved With Incorrect Name.", "tempfile.tst", f1.getName() + ); // Test for creating a file that already exists. assertTrue( @@ -932,8 +932,8 @@ public void test_getName() { // Test for method java.lang.String java.io.File.getName() File f = new File("name.tst"); - assertTrue("Test 1: Returned incorrect name", f.getName().equals( - "name.tst")); + assertEquals("Test 1: Returned incorrect name", + "name.tst", f.getName()); f = new File(""); assertTrue("Test 2: Returned incorrect name", f.getName().equals("")); @@ -963,7 +963,7 @@ assertTrue("Wrong parent test 2", f1.getParent().equals( slash + "directory")); f1 = new File("directory/file"); - assertTrue("Wrong parent test 3", f1.getParent().equals("directory")); + assertEquals("Wrong parent test 3", "directory", f1.getParent()); f1 = new File("/"); assertNull("Wrong parent test 4", f1.getParent()); f1 = new File("directory"); @@ -977,12 +977,12 @@ assertTrue("Wrong parent test 2a", f1.getParent().equals( "d:" + slash + "directory")); f1 = new File("d:directory/file"); - assertTrue("Wrong parent test 3a", f1.getParent().equals( - "d:directory")); + assertEquals("Wrong parent test 3a", + "d:directory", f1.getParent()); f1 = new File("d:/"); assertNull("Wrong parent test 4a", f1.getParent()); f1 = new File("d:directory"); - assertTrue("Wrong parent test 5a", f1.getParent().equals("d:")); + assertEquals("Wrong parent test 5a", "d:", f1.getParent()); } } Index: modules/luni/src/test/java/tests/api/java/io/FileWriterTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/io/FileWriterTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/io/FileWriterTest.java 2006-04-16 11:47:22.000000000 +0100 @@ -53,8 +53,8 @@ char[] buf = new char[100]; int r = br.read(buf); br.close(); - assertTrue("Failed to write correct chars", new String(buf, 0, r) - .equals(" After test string")); + assertEquals("Failed to write correct chars", " After test string", new String(buf, 0, r) + ); } catch (Exception e) { fail("Exception during Constructor test " + e.toString()); } @@ -99,8 +99,8 @@ char[] buf = new char[100]; int r = br.read(buf); br.close(); - assertTrue("Failed to write correct chars", new String(buf, 0, r) - .equals(" After test string")); + assertEquals("Failed to write correct chars", " After test string", new String(buf, 0, r) + ); } catch (Exception e) { fail("Exception during Constructor test " + e.toString()); } @@ -123,8 +123,8 @@ char[] buf = new char[100]; int r = br.read(buf); br.close(); - assertTrue("Failed to append to file", new String(buf, 0, r) - .equals("Test String After test string")); + assertEquals("Failed to append to file", "Test String After test string", new String(buf, 0, r) + ); fos = new FileOutputStream(f.getPath()); fos.write("Test String".getBytes()); @@ -136,8 +136,8 @@ buf = new char[100]; r = br.read(buf); br.close(); - assertTrue("Failed to overwrite file", new String(buf, 0, r) - .equals(" After test string")); + assertEquals("Failed to overwrite file", " After test string", new String(buf, 0, r) + ); } catch (Exception e) { fail("Exception during Constructor test " + e.toString()); } Index: modules/luni/src/test/java/tests/api/java/io/ObjectInputStreamTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/io/ObjectInputStreamTest.java.orig 2006-04-16 11:47:21.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/io/ObjectInputStreamTest.java 2006-04-16 13:59:11.000000000 +0100 @@ -305,8 +305,8 @@ .toByteArray())); ois.read(buf, 0, 10); ois.close(); - assertTrue("Read incorrect bytes", new String(buf, 0, 10) - .equals("HelloWorld")); + assertEquals("Read incorrect bytes", "HelloWorld", new String(buf, 0, 10) + ); } catch (IOException e) { fail("Exception serializing data : " + e.getMessage()); } @@ -403,8 +403,8 @@ ois = new ObjectInputStream(new ByteArrayInputStream(bao .toByteArray())); sth = (SerializableTestHelper) (ois.readObject()); - assertTrue("readFields / writeFields failed--first field not set", - sth.getText1().equals("Gabba")); + assertEquals("readFields / writeFields failed--first field not set", + "Gabba", sth.getText1()); assertNull( "readFields / writeFields failed--second field should not have been set", sth.getText2()); @@ -444,8 +444,8 @@ .toByteArray())); ois.readFully(buf); ois.close(); - assertTrue("Read incorrect bytes", new String(buf, 0, 10) - .equals("HelloWorld")); + assertEquals("Read incorrect bytes", "HelloWorld", new String(buf, 0, 10) + ); } catch (IOException e) { fail("Exception serializing data : " + e.getMessage()); } @@ -465,8 +465,8 @@ .toByteArray())); ois.readFully(buf, 0, 10); ois.close(); - assertTrue("Read incorrect bytes", new String(buf, 0, 10) - .equals("HelloWorld")); + assertEquals("Read incorrect bytes", "HelloWorld", new String(buf, 0, 10) + ); } catch (IOException e) { fail("Exception serializing data : " + e.getMessage()); } @@ -501,8 +501,8 @@ ois = new ObjectInputStream(new ByteArrayInputStream(bao .toByteArray())); ois.readLine(); - assertTrue("Read incorrect string value", ois.readLine().equals( - "SecondLine")); + assertEquals("Read incorrect string value", + "SecondLine", ois.readLine()); ois.close(); } catch (IOException e) { fail("Exception serializing data : " + e.getMessage()); @@ -635,8 +635,8 @@ oos.close(); ois = new ObjectInputStream(new ByteArrayInputStream(bao .toByteArray())); - assertTrue("Read incorrect utf value", ois.readUTF().equals( - "HelloWorld")); + assertEquals("Read incorrect utf value", + "HelloWorld", ois.readUTF()); ois.close(); } catch (IOException e) { fail("Exception serializing data : " + e.getMessage()); @@ -657,8 +657,8 @@ ois.skipBytes(5); ois.read(buf, 0, 5); ois.close(); - assertTrue("Skipped incorrect bytes", new String(buf, 0, 5) - .equals("World")); + assertEquals("Skipped incorrect bytes", "World", new String(buf, 0, 5) + ); } catch (IOException e) { fail("Exception serializing data : " + e.getMessage()); } Index: modules/luni/src/test/java/tests/api/java/io/ObjectOutputStreamTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/io/ObjectOutputStreamTest.java.orig 2006-04-16 11:47:21.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/io/ObjectOutputStreamTest.java 2006-04-16 13:59:11.000000000 +0100 @@ -628,8 +628,8 @@ ois = new ObjectInputStream(new ByteArrayInputStream(bao .toByteArray())); sth = (SerializableTestHelper) (ois.readObject()); - assertTrue("readFields / writeFields failed--first field not set", - sth.getText1().equals("Gabba")); + assertEquals("readFields / writeFields failed--first field not set", + "Gabba", sth.getText1()); assertNull( "readFields / writeFields failed--second field should not have been set", sth.getText2()); @@ -728,8 +728,8 @@ .toByteArray())); ois.read(buf, 0, 10); ois.close(); - assertTrue("Read incorrect bytes", new String(buf, 0, 10) - .equals("HelloWorld")); + assertEquals("Read incorrect bytes", "HelloWorld", new String(buf, 0, 10) + ); } catch (IOException e) { fail("Exception serializing data : " + e.getMessage()); } @@ -749,8 +749,8 @@ .toByteArray())); ois.read(buf, 0, 10); ois.close(); - assertTrue("Read incorrect bytes", new String(buf, 0, 10) - .equals("HelloWorld")); + assertEquals("Read incorrect bytes", "HelloWorld", new String(buf, 0, 10) + ); } catch (IOException e) { fail("Exception serializing data : " + e.getMessage()); } @@ -819,8 +819,8 @@ .toByteArray())); ois.readFully(buf); ois.close(); - assertTrue("Wrote incorrect bytes value", new String(buf, 0, 10) - .equals("HelloWorld")); + assertEquals("Wrote incorrect bytes value", "HelloWorld", new String(buf, 0, 10) + ); } catch (IOException e) { fail("Exception serializing data : " + e.getMessage()); } @@ -860,8 +860,8 @@ for (int i = 0; i < avail; ++i) buf[i] = ois.readChar(); ois.close(); - assertTrue("Wrote incorrect chars", new String(buf, 0, 10) - .equals("HelloWorld")); + assertEquals("Wrote incorrect chars", "HelloWorld", new String(buf, 0, 10) + ); } catch (IOException e) { fail("Exception serializing data : " + e.getMessage()); } @@ -1027,8 +1027,8 @@ oos.close(); ois = new ObjectInputStream(new ByteArrayInputStream(bao .toByteArray())); - assertTrue("Wrote incorrect UTF value", ois.readUTF().equals( - "HelloWorld")); + assertEquals("Wrote incorrect UTF value", + "HelloWorld", ois.readUTF()); } catch (IOException e) { fail("Exception serializing data : " + e.getMessage()); } Index: modules/luni/src/test/java/tests/api/java/io/ObjectStreamFieldTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/io/ObjectStreamFieldTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/io/ObjectStreamFieldTest.java 2006-04-16 13:59:11.000000000 +0100 @@ -76,8 +76,8 @@ */ public void test_getName() { // Test for method java.lang.String java.io.ObjectStreamField.getName() - assertTrue("Field did not return correct name", holaField.getName() - .equals("hola")); + assertEquals("Field did not return correct name", "hola", holaField.getName() + ); } /** Index: modules/luni/src/test/java/tests/api/java/io/OutputStreamWriterTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/io/OutputStreamWriterTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/io/OutputStreamWriterTest.java 2006-04-16 11:47:22.000000000 +0100 @@ -525,8 +525,8 @@ writer.write(new char[] { '\u3048' }); writer.close(); // there should not be a mode switch between writes - assertTrue("invalid conversion 4", new String(bout.toByteArray(), - "ISO8859_1").equals("\u001b$B$($(\u001b(B")); + assertEquals("invalid conversion 4", "\u001b$B$($(\u001b(B", new String(bout.toByteArray(), + "ISO8859_1")); } catch (UnsupportedEncodingException e) { // Can't test missing converter System.out.println(e); @@ -562,8 +562,8 @@ try { osw = new OutputStreamWriter(fos, "8859_1"); } catch (UnsupportedEncodingException e) { - assertTrue("Returned incorrect encoding", osw.getEncoding().equals( - "8859_1")); + assertEquals("Returned incorrect encoding", + "8859_1", osw.getEncoding()); } } Index: modules/luni/src/test/java/tests/api/java/io/PipedOutputStreamTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/io/PipedOutputStreamTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/io/PipedOutputStreamTest.java 2006-04-16 11:47:22.000000000 +0100 @@ -141,8 +141,8 @@ out.write("HelloWorld".getBytes(), 0, 10); assertTrue("Bytes written before flush", reader.available() != 0); out.flush(); - assertTrue("Wrote incorrect bytes", reader.read(10).equals( - "HelloWorld")); + assertEquals("Wrote incorrect bytes", + "HelloWorld", reader.read(10)); } catch (IOException e) { fail("IOException during write test : " + e.getMessage()); } @@ -160,8 +160,8 @@ rt.start(); out.write("HelloWorld".getBytes(), 0, 10); out.flush(); - assertTrue("Wrote incorrect bytes", reader.read(10).equals( - "HelloWorld")); + assertEquals("Wrote incorrect bytes", + "HelloWorld", reader.read(10)); } catch (IOException e) { fail("IOException during write test : " + e.getMessage()); } @@ -178,7 +178,7 @@ rt.start(); out.write('c'); out.flush(); - assertTrue("Wrote incorrect byte", reader.read(1).equals("c")); + assertEquals("Wrote incorrect byte", "c", reader.read(1)); } catch (IOException e) { fail("IOException during write test : " + e.getMessage()); } Index: modules/luni/src/test/java/tests/api/java/io/PipedReaderTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/io/PipedReaderTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/io/PipedReaderTest.java 2006-04-16 11:47:22.000000000 +0100 @@ -92,7 +92,7 @@ } catch (Exception e) { fail("Exception during close test : " + e.getMessage()); } - assertTrue("Read incorrect chars", new String(c).equals("Hello World")); + assertEquals("Read incorrect chars", "Hello World", new String(c)); } /** @@ -112,7 +112,7 @@ } catch (Exception e) { fail("Exception during connect test : " + e.getMessage()); } - assertTrue("Read incorrect chars", new String(c).equals("Hello World")); + assertEquals("Read incorrect chars", "Hello World", new String(c)); try { preader.connect(pwriter.pw); } catch (Exception e) { Index: modules/luni/src/test/java/tests/api/java/io/PrintStreamTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/io/PrintStreamTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/io/PrintStreamTest.java 2006-04-16 13:59:11.000000000 +0100 @@ -184,8 +184,8 @@ os.print(2345.76834720202); bis = new java.io.ByteArrayInputStream(bos.toByteArray()); bis.read(rbuf, 0, 16); - assertTrue("Incorrect double written", new String(rbuf, 0, 16) - .equals("2345.76834720202")); + assertEquals("Incorrect double written", "2345.76834720202", new String(rbuf, 0, 16) + ); } /** @@ -199,8 +199,8 @@ os.flush(); bis = new java.io.ByteArrayInputStream(bos.toByteArray()); bis.read(rbuf, 0, 8); - assertTrue("Incorrect float written", new String(rbuf, 0, 8) - .equals("29.08764")); + assertEquals("Incorrect float written", "29.08764", new String(rbuf, 0, 8) + ); } @@ -214,8 +214,8 @@ byte[] rbuf = new byte[18]; bis = new java.io.ByteArrayInputStream(bos.toByteArray()); bis.read(rbuf, 0, 9); - assertTrue("Incorrect int written", new String(rbuf, 0, 9) - .equals("768347202")); + assertEquals("Incorrect int written", "768347202", new String(rbuf, 0, 9) + ); } /** @@ -229,8 +229,8 @@ os.close(); bis = new java.io.ByteArrayInputStream(bos.toByteArray()); bis.read(rbuf, 0, 13); - assertTrue("Incorrect long written", new String(rbuf, 0, 13) - .equals("9875645283333")); + assertEquals("Incorrect long written", "9875645283333", new String(rbuf, 0, 13) + ); } /** @@ -244,8 +244,8 @@ bis = new java.io.ByteArrayInputStream(bos.toByteArray()); byte[] nullbytes = new byte[4]; bis.read(nullbytes, 0, 4); - assertTrue("null should be written", new String(nullbytes, 0, 4) - .equals("null")); + assertEquals("null should be written", "null", new String(nullbytes, 0, 4) + ); try { bis.close(); bos.close(); @@ -259,8 +259,8 @@ bis = new java.io.ByteArrayInputStream(bos1.toByteArray()); byte[] rbytes = new byte[2]; bis.read(rbytes, 0, 2); - assertTrue("Incorrect Object written", new String(rbytes, 0, 2) - .equals("[]")); + assertEquals("Incorrect Object written", "[]", new String(rbytes, 0, 2) + ); } /** @@ -273,8 +273,8 @@ bis = new java.io.ByteArrayInputStream(bos.toByteArray()); byte[] nullbytes = new byte[4]; bis.read(nullbytes, 0, 4); - assertTrue("null should be written", new String(nullbytes, 0, 4) - .equals("null")); + assertEquals("null should be written", "null", new String(nullbytes, 0, 4) + ); try { bis.close(); bos.close(); @@ -288,8 +288,8 @@ bis = new java.io.ByteArrayInputStream(bos1.toByteArray()); byte rbytes[] = new byte[100]; bis.read(rbytes, 0, 11); - assertTrue("Incorrect string written", new String(rbytes, 0, 11) - .equals("Hello World")); + assertEquals("Incorrect string written", "Hello World", new String(rbytes, 0, 11) + ); } /** @@ -374,8 +374,8 @@ bis = new java.io.ByteArrayInputStream(bos.toByteArray()); byte[] rbuf = new byte[100]; bis.read(rbuf, 0, 16); - assertTrue("Incorrect double written", new String(rbuf, 0, 16) - .equals("2345.76834720202")); + assertEquals("Incorrect double written", "2345.76834720202", new String(rbuf, 0, 16) + ); assertTrue("Newline not written", (c = bis.read()) == '\r' || c == '\n'); } @@ -390,8 +390,8 @@ os.println(29.08764f); bis = new java.io.ByteArrayInputStream(bos.toByteArray()); bis.read(rbuf, 0, 8); - assertTrue("Incorrect float written", new String(rbuf, 0, 8) - .equals("29.08764")); + assertEquals("Incorrect float written", "29.08764", new String(rbuf, 0, 8) + ); assertTrue("Newline not written", (c = bis.read()) == '\r' || c == '\n'); } @@ -406,8 +406,8 @@ byte[] rbuf = new byte[100]; bis = new java.io.ByteArrayInputStream(bos.toByteArray()); bis.read(rbuf, 0, 9); - assertTrue("Incorrect int written", new String(rbuf, 0, 9) - .equals("768347202")); + assertEquals("Incorrect int written", "768347202", new String(rbuf, 0, 9) + ); assertTrue("Newline not written", (c = bis.read()) == '\r' || c == '\n'); } @@ -422,8 +422,8 @@ bis = new java.io.ByteArrayInputStream(bos.toByteArray()); byte[] rbuf = new byte[100]; bis.read(rbuf, 0, 13); - assertTrue("Incorrect long written", new String(rbuf, 0, 13) - .equals("9875645283333")); + assertEquals("Incorrect long written", "9875645283333", new String(rbuf, 0, 13) + ); assertTrue("Newline not written", (c = bis.read()) == '\r' || c == '\n'); } @@ -438,8 +438,8 @@ bis = new java.io.ByteArrayInputStream(bos.toByteArray()); byte[] rbytes = new byte[2]; bis.read(rbytes, 0, 2); - assertTrue("Incorrect Vector written", new String(rbytes, 0, 2) - .equals("[]")); + assertEquals("Incorrect Vector written", "[]", new String(rbytes, 0, 2) + ); assertTrue("Newline not written", (c = (char) bis.read()) == '\r' || c == '\n'); } @@ -455,8 +455,8 @@ bis = new java.io.ByteArrayInputStream(bos.toByteArray()); byte rbytes[] = new byte[100]; bis.read(rbytes, 0, 11); - assertTrue("Incorrect string written", new String(rbytes, 0, 11) - .equals("Hello World")); + assertEquals("Incorrect string written", "Hello World", new String(rbytes, 0, 11) + ); assertTrue("Newline not written", (c = (char) bis.read()) == '\r' || c == '\n'); } @@ -472,8 +472,8 @@ bis = new java.io.ByteArrayInputStream(bos.toByteArray()); byte[] rbuf = new byte[100]; bis.read(rbuf, 0, 4); - assertTrue("Incorrect boolean written", new String(rbuf, 0, 4) - .equals("true")); + assertEquals("Incorrect boolean written", "true", new String(rbuf, 0, 4) + ); assertTrue("Newline not written", (c = bis.read()) == '\r' || c == '\n'); } Index: modules/luni/src/test/java/tests/api/java/io/PrintWriterTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/io/PrintWriterTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/io/PrintWriterTest.java 2006-04-16 13:59:11.000000000 +0100 @@ -98,8 +98,8 @@ pw = new PrintWriter(sw = new Support_StringWriter()); pw.print("Hello"); pw.flush(); - assertTrue("Failed to construct proper writer", sw.toString().equals( - "Hello")); + assertEquals("Failed to construct proper writer", + "Hello", sw.toString()); } /** @@ -111,8 +111,8 @@ pw = new PrintWriter(sw = new Support_StringWriter(), true); pw.print("Hello"); // Auto-flush should have happened - assertTrue("Failed to construct proper writer", sw.toString().equals( - "Hello")); + assertEquals("Failed to construct proper writer", + "Hello", sw.toString()); } /** @@ -184,8 +184,8 @@ // Test for method void java.io.PrintWriter.print(char) pw.print('c'); pw.flush(); - assertTrue("Wrote incorrect char string", new String(bao.toByteArray()) - .equals("c")); + assertEquals("Wrote incorrect char string", "c", new String(bao.toByteArray()) + ); } /** @@ -219,8 +219,8 @@ // Test for method void java.io.PrintWriter.print(int) pw.print(4908765); pw.flush(); - assertTrue("Wrote incorrect int string", new String(bao.toByteArray()) - .equals("4908765")); + assertEquals("Wrote incorrect int string", "4908765", new String(bao.toByteArray()) + ); } /** @@ -230,8 +230,8 @@ // Test for method void java.io.PrintWriter.print(long) pw.print(49087650000L); pw.flush(); - assertTrue("Wrote incorrect long string", new String(bao.toByteArray()) - .equals("49087650000")); + assertEquals("Wrote incorrect long string", "49087650000", new String(bao.toByteArray()) + ); } /** @@ -241,14 +241,14 @@ // Test for method void java.io.PrintWriter.print(java.lang.Object) pw.print((Object) null); pw.flush(); - assertTrue("Did not write null", new String(bao.toByteArray()) - .equals("null")); + assertEquals("Did not write null", "null", new String(bao.toByteArray()) + ); bao.reset(); pw.print(new Bogus()); pw.flush(); - assertTrue("Wrote in incorrect Object string", new String(bao - .toByteArray()).equals("Bogus")); + assertEquals("Wrote in incorrect Object string", "Bogus", new String(bao + .toByteArray())); } /** @@ -258,14 +258,14 @@ // Test for method void java.io.PrintWriter.print(java.lang.String) pw.print((String) null); pw.flush(); - assertTrue("did not write null", new String(bao.toByteArray()) - .equals("null")); + assertEquals("did not write null", "null", new String(bao.toByteArray()) + ); bao.reset(); pw.print("Hello World"); pw.flush(); - assertTrue("Wrote incorrect string", new String(bao.toByteArray()) - .equals("Hello World")); + assertEquals("Wrote incorrect string", "Hello World", new String(bao.toByteArray()) + ); } /** @@ -275,8 +275,8 @@ // Test for method void java.io.PrintWriter.print(boolean) pw.print(true); pw.flush(); - assertTrue("Wrote in incorrect boolean string", new String(bao - .toByteArray()).equals("true")); + assertEquals("Wrote in incorrect boolean string", "true", new String(bao + .toByteArray())); } /** Index: modules/luni/src/test/java/tests/api/java/io/SerializationStressTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/io/SerializationStressTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/io/SerializationStressTest.java 2006-04-16 14:00:48.000000000 +0100 @@ -414,8 +414,8 @@ ois = new ObjectInputStream(loadStream()); ois.read(buf, 0, 10); ois.close(); - assertTrue("Read incorrect bytes", new String(buf, 0, 10) - .equals("HelloWorld")); + assertEquals("Read incorrect bytes", "HelloWorld", new String(buf, 0, 10) + ); } catch (IOException e) { fail("IOException serializing data : " + e.getMessage()); } @@ -455,8 +455,8 @@ ois = new ObjectInputStream(loadStream()); ois.readFully(buf); ois.close(); - assertTrue("Wrote incorrect bytes value", new String(buf, 0, 10) - .equals("HelloWorld")); + assertEquals("Wrote incorrect bytes value", "HelloWorld", new String(buf, 0, 10) + ); } catch (IOException e) { fail("IOException serializing data : " + e.getMessage()); } @@ -488,8 +488,8 @@ for (int i = 0; i < avail; ++i) buf[i] = ois.readChar(); ois.close(); - assertTrue("Wrote incorrect chars", new String(buf, 0, 10) - .equals("HelloWorld")); + assertEquals("Wrote incorrect chars", "HelloWorld", new String(buf, 0, 10) + ); } catch (IOException e) { fail("IOException serializing data : " + e.getMessage()); } @@ -569,8 +569,8 @@ oos.writeUTF("HelloWorld"); oos.close(); ois = new ObjectInputStream(loadStream()); - assertTrue("Wrote incorrect UTF value", ois.readUTF().equals( - "HelloWorld")); + assertEquals("Wrote incorrect UTF value", + "HelloWorld", ois.readUTF()); } catch (IOException e) { fail("IOException serializing data : " + e.getMessage()); } @@ -679,8 +679,8 @@ assertTrue("incorrect output", Arrays.equals(input, result)); ois = new ObjectInputStreamSubclass(loadStream()); - assertTrue("Wrong result from readObject()", ois.readObject() - .equals("R")); + assertEquals("Wrong result from readObject()", "R", ois.readObject() + ); assertTrue("Wrong result from readByte()", ois.readByte() == 24); ois.close(); } catch (IOException e1) { @@ -770,7 +770,7 @@ } catch (ClassNotFoundException e) { fail(e.toString()); } - assertTrue("String not resolved", "ABC".equals(result.field1)); + assertEquals("String not resolved", "ABC", result.field1); assertTrue("Second reference not resolved", result.field1 == result.field2); } catch (IOException e) { Index: modules/luni/src/test/java/tests/api/java/io/StreamTokenizerTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/io/StreamTokenizerTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/io/StreamTokenizerTest.java 2006-04-16 13:59:11.000000000 +0100 @@ -156,8 +156,8 @@ st.lowerCaseMode(true); try { st.nextToken(); - assertTrue("sval not converted to lowercase.", st.sval - .equals("helloworld")); + assertEquals("sval not converted to lowercase.", "helloworld", st.sval + ); } catch (Exception e) { fail("Exception during test : " + e.getMessage()); } @@ -306,11 +306,11 @@ st.quoteChar('<'); try { assertTrue("QuoteChar failed.", st.nextToken() == '<'); - assertTrue("QuoteChar failed.", st.sval.equals("Hello World")); + assertEquals("QuoteChar failed.", "Hello World", st.sval); st.quoteChar('H'); st.nextToken(); - assertTrue("QuoteChar failed for word.", st.sval - .equals("elloWorld")); + assertEquals("QuoteChar failed for word.", "elloWorld", st.sval + ); } catch (Exception e) { fail("Exception during test : " + e.getMessage()); } @@ -405,17 +405,17 @@ try { assertTrue("WordChar failed1.", st.nextToken() == StreamTokenizer.TT_WORD); - assertTrue("WordChar failed2.", st.sval.equals("A893")); + assertEquals("WordChar failed2.", "A893", st.sval); assertTrue("WordChar failed3.", st.nextToken() == StreamTokenizer.TT_NUMBER); st.nextToken(); - assertTrue("WordChar failed4.", st.sval.equals("B87")); + assertEquals("WordChar failed4.", "B87", st.sval); setTest(" Hello World"); st.wordChars(' ', ' '); st.nextToken(); - assertTrue("WordChars failed for whitespace.", st.sval - .equals("Hello World")); + assertEquals("WordChars failed for whitespace.", "Hello World", st.sval + ); setTest(" Hello World\r\n \'Hello World\' Hello\' World"); st.wordChars(' ', ' '); Index: modules/luni/src/test/java/tests/api/java/io/StringBufferInputStreamTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/io/StringBufferInputStreamTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/io/StringBufferInputStreamTest.java 2006-04-16 13:59:11.000000000 +0100 @@ -45,7 +45,7 @@ byte[] buf = new byte[5]; sbis.skip(6); sbis.read(buf, 0, 5); - assertTrue("Returned incorrect chars", new String(buf).equals("World")); + assertEquals("Returned incorrect chars", "World", new String(buf)); } /** Index: modules/luni/src/test/java/tests/api/java/io/StringWriterTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/io/StringWriterTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/io/StringWriterTest.java 2006-04-16 11:47:22.000000000 +0100 @@ -49,7 +49,7 @@ // Test for method void java.io.StringWriter.flush() sw.flush(); sw.write('c'); - assertTrue("Failed to flush char", sw.toString().equals("c")); + assertEquals("Failed to flush char", "c", sw.toString()); } /** @@ -61,8 +61,8 @@ sw.write("This is a test string"); StringBuffer sb = sw.getBuffer(); - assertTrue("Incorrect buffer returned", sb.toString().equals( - "This is a test string")); + assertEquals("Incorrect buffer returned", + "This is a test string", sb.toString()); } /** @@ -71,8 +71,8 @@ public void test_toString() { // Test for method java.lang.String java.io.StringWriter.toString() sw.write("This is a test string"); - assertTrue("Incorrect string returned", sw.toString().equals( - "This is a test string")); + assertEquals("Incorrect string returned", + "This is a test string", sw.toString()); } /** @@ -83,8 +83,8 @@ char[] c = new char[1000]; "This is a test string".getChars(0, 21, c, 0); sw.write(c, 0, 21); - assertTrue("Chars not written properly", sw.toString().equals( - "This is a test string")); + assertEquals("Chars not written properly", + "This is a test string", sw.toString()); } /** @@ -93,7 +93,7 @@ public void test_writeI() { // Test for method void java.io.StringWriter.write(int) sw.write('c'); - assertTrue("Char not written properly", sw.toString().equals("c")); + assertEquals("Char not written properly", "c", sw.toString()); } /** @@ -102,8 +102,8 @@ public void test_writeLjava_lang_String() { // Test for method void java.io.StringWriter.write(java.lang.String) sw.write("This is a test string"); - assertTrue("String not written properly", sw.toString().equals( - "This is a test string")); + assertEquals("String not written properly", + "This is a test string", sw.toString()); } /** @@ -113,7 +113,7 @@ // Test for method void java.io.StringWriter.write(java.lang.String, // int, int) sw.write("This is a test string", 2, 2); - assertTrue("String not written properly", sw.toString().equals("is")); + assertEquals("String not written properly", "is", sw.toString()); } /** Index: modules/luni/src/test/java/tests/api/java/lang/ByteTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/lang/ByteTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/lang/ByteTest.java 2006-04-16 13:59:11.000000000 +0100 @@ -328,12 +328,12 @@ */ public void test_toString() { // Test for method java.lang.String java.lang.Byte.toString() - assertTrue("Returned incorrect String", new Byte((byte) 127).toString() - .equals("127")); - assertTrue("Returned incorrect String", new Byte((byte) -127) - .toString().equals("-127")); - assertTrue("Returned incorrect String", new Byte((byte) -128) - .toString().equals("-128")); + assertEquals("Returned incorrect String", "127", new Byte((byte) 127).toString() + ); + assertEquals("Returned incorrect String", "-127", new Byte((byte) -127) + .toString()); + assertEquals("Returned incorrect String", "-128", new Byte((byte) -128) + .toString()); } /** @@ -341,12 +341,12 @@ */ public void test_toStringB() { // Test for method java.lang.String java.lang.Byte.toString(byte) - assertTrue("Returned incorrect String", Byte.toString((byte) 127) - .equals("127")); - assertTrue("Returned incorrect String", Byte.toString((byte) -127) - .equals("-127")); - assertTrue("Returned incorrect String", Byte.toString((byte) -128) - .equals("-128")); + assertEquals("Returned incorrect String", "127", Byte.toString((byte) 127) + ); + assertEquals("Returned incorrect String", "-127", Byte.toString((byte) -127) + ); + assertEquals("Returned incorrect String", "-128", Byte.toString((byte) -128) + ); } /** Index: modules/luni/src/test/java/tests/api/java/lang/CharacterTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/lang/CharacterTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/lang/CharacterTest.java 2006-04-16 13:59:11.000000000 +0100 @@ -431,8 +431,8 @@ */ public void test_toString() { // Test for method java.lang.String java.lang.Character.toString() - assertTrue("Incorrect String returned", new Character('T').toString() - .equals("T")); + assertEquals("Incorrect String returned", "T", new Character('T').toString() + ); } /** Index: modules/luni/src/test/java/tests/api/java/lang/ErrorTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/lang/ErrorTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/lang/ErrorTest.java 2006-04-16 11:47:22.000000000 +0100 @@ -40,8 +40,8 @@ if (true) throw new Error("Throw an Error"); } catch (Error e) { - assertTrue("Incorrect message string generated", e.getMessage() - .equals("Throw an Error")); + assertEquals("Incorrect message string generated", "Throw an Error", e.getMessage() + ); return; } fail("Failed to generate Error"); Index: modules/luni/src/test/java/tests/api/java/lang/ExceptionTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/lang/ExceptionTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/lang/ExceptionTest.java 2006-04-16 11:47:22.000000000 +0100 @@ -40,8 +40,8 @@ if (true) throw new Exception("Throw an Error"); } catch (Exception e) { - assertTrue("Incorrect message string generated", e.getMessage() - .equals("Throw an Error")); + assertEquals("Incorrect message string generated", "Throw an Error", e.getMessage() + ); return; } fail("Failed to generate Error"); Index: modules/luni/src/test/java/tests/api/java/lang/IntegerTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/lang/IntegerTest.java.orig 2006-04-16 11:47:21.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/lang/IntegerTest.java 2006-04-16 13:59:11.000000000 +0100 @@ -415,10 +415,10 @@ public void test_toBinaryStringI() { // Test for method java.lang.String // java.lang.Integer.toBinaryString(int) - assertTrue("Incorrect string returned", Integer.toBinaryString( - Integer.MAX_VALUE).equals("1111111111111111111111111111111")); - assertTrue("Incorrect string returned", Integer.toBinaryString( - Integer.MIN_VALUE).equals("10000000000000000000000000000000")); + assertEquals("Incorrect string returned", "1111111111111111111111111111111", Integer.toBinaryString( + Integer.MAX_VALUE)); + assertEquals("Incorrect string returned", "10000000000000000000000000000000", Integer.toBinaryString( + Integer.MIN_VALUE)); } /** @@ -448,10 +448,10 @@ public void test_toOctalStringI() { // Test for method java.lang.String java.lang.Integer.toOctalString(int) // Spec states that the int arg is treated as unsigned - assertTrue("Returned incorrect octal string", Integer.toOctalString( - Integer.MAX_VALUE).equals("17777777777")); - assertTrue("Returned incorrect octal string", Integer.toOctalString( - Integer.MIN_VALUE).equals("20000000000")); + assertEquals("Returned incorrect octal string", "17777777777", Integer.toOctalString( + Integer.MAX_VALUE)); + assertEquals("Returned incorrect octal string", "20000000000", Integer.toOctalString( + Integer.MIN_VALUE)); } /** @@ -462,7 +462,7 @@ Integer i = new Integer(-80001); - assertTrue("Returned incorrect String", i.toString().equals("-80001")); + assertEquals("Returned incorrect String", "-80001", i.toString()); } /** @@ -471,14 +471,14 @@ public void test_toStringI() { // Test for method java.lang.String java.lang.Integer.toString(int) - assertTrue("Returned incorrect String", Integer.toString(-80765) - .equals("-80765")); - assertTrue("Returned incorrect octal string", Integer.toString( - Integer.MAX_VALUE).equals("2147483647")); - assertTrue("Returned incorrect octal string", Integer.toString( - -Integer.MAX_VALUE).equals("-2147483647")); - assertTrue("Returned incorrect octal string", Integer.toString( - Integer.MIN_VALUE).equals("-2147483648")); + assertEquals("Returned incorrect String", "-80765", Integer.toString(-80765) + ); + assertEquals("Returned incorrect octal string", "2147483647", Integer.toString( + Integer.MAX_VALUE)); + assertEquals("Returned incorrect octal string", "-2147483647", Integer.toString( + -Integer.MAX_VALUE)); + assertEquals("Returned incorrect octal string", "-2147483648", Integer.toString( + Integer.MIN_VALUE)); } /** @@ -486,37 +486,37 @@ */ public void test_toStringII() { // Test for method java.lang.String java.lang.Integer.toString(int, int) - assertTrue("Returned incorrect octal string", Integer.toString( - 2147483647, 8).equals("17777777777")); + assertEquals("Returned incorrect octal string", "17777777777", Integer.toString( + 2147483647, 8)); assertTrue("Returned incorrect hex string--wanted 7fffffff but got: " + Integer.toString(2147483647, 16), Integer.toString( 2147483647, 16).equals("7fffffff")); - assertTrue("Incorrect string returned", Integer.toString(2147483647, 2) - .equals("1111111111111111111111111111111")); - assertTrue("Incorrect string returned", Integer - .toString(2147483647, 10).equals("2147483647")); + assertEquals("Incorrect string returned", "1111111111111111111111111111111", Integer.toString(2147483647, 2) + ); + assertEquals("Incorrect string returned", "2147483647", Integer + .toString(2147483647, 10)); - assertTrue("Returned incorrect octal string", Integer.toString( - -2147483647, 8).equals("-17777777777")); + assertEquals("Returned incorrect octal string", "-17777777777", Integer.toString( + -2147483647, 8)); assertTrue("Returned incorrect hex string--wanted -7fffffff but got: " + Integer.toString(-2147483647, 16), Integer.toString( -2147483647, 16).equals("-7fffffff")); - assertTrue("Incorrect string returned", Integer - .toString(-2147483647, 2).equals( - "-1111111111111111111111111111111")); - assertTrue("Incorrect string returned", Integer.toString(-2147483647, - 10).equals("-2147483647")); + assertEquals("Incorrect string returned", + "-1111111111111111111111111111111", Integer + .toString(-2147483647, 2)); + assertEquals("Incorrect string returned", "-2147483647", Integer.toString(-2147483647, + 10)); - assertTrue("Returned incorrect octal string", Integer.toString( - -2147483648, 8).equals("-20000000000")); + assertEquals("Returned incorrect octal string", "-20000000000", Integer.toString( + -2147483648, 8)); assertTrue("Returned incorrect hex string--wanted -80000000 but got: " + Integer.toString(-2147483648, 16), Integer.toString( -2147483648, 16).equals("-80000000")); - assertTrue("Incorrect string returned", Integer - .toString(-2147483648, 2).equals( - "-10000000000000000000000000000000")); - assertTrue("Incorrect string returned", Integer.toString(-2147483648, - 10).equals("-2147483648")); + assertEquals("Incorrect string returned", + "-10000000000000000000000000000000", Integer + .toString(-2147483648, 2)); + assertEquals("Incorrect string returned", "-2147483648", Integer.toString(-2147483648, + 10)); } /** Index: modules/luni/src/test/java/tests/api/java/lang/LongTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/lang/LongTest.java.orig 2006-04-16 11:47:21.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/lang/LongTest.java 2006-04-16 14:00:48.000000000 +0100 @@ -418,20 +418,18 @@ */ public void test_toBinaryStringJ() { // Test for method java.lang.String java.lang.Long.toBinaryString(long) - assertTrue("Incorrect binary string returned", Long.toBinaryString( - 890000L).equals("11011001010010010000")); - assertTrue( - "Incorrect binary string returned", - Long + assertEquals("Incorrect binary string returned", "11011001010010010000", Long.toBinaryString( + 890000L)); + assertEquals("Incorrect binary string returned", + + "1000000000000000000000000000000000000000000000000000000000000000", Long .toBinaryString(Long.MIN_VALUE) - .equals( - "1000000000000000000000000000000000000000000000000000000000000000")); - assertTrue( - "Incorrect binary string returned", - Long + ); + assertEquals("Incorrect binary string returned", + + "111111111111111111111111111111111111111111111111111111111111111", Long .toBinaryString(Long.MAX_VALUE) - .equals( - "111111111111111111111111111111111111111111111111111111111111111")); + ); } /** @@ -439,12 +437,12 @@ */ public void test_toHexStringJ() { // Test for method java.lang.String java.lang.Long.toHexString(long) - assertTrue("Incorrect hex string returned", Long.toHexString(89000005L) - .equals("54e0845")); - assertTrue("Incorrect hex string returned", Long.toHexString( - Long.MIN_VALUE).equals("8000000000000000")); - assertTrue("Incorrect hex string returned", Long.toHexString( - Long.MAX_VALUE).equals("7fffffffffffffff")); + assertEquals("Incorrect hex string returned", "54e0845", Long.toHexString(89000005L) + ); + assertEquals("Incorrect hex string returned", "8000000000000000", Long.toHexString( + Long.MIN_VALUE)); + assertEquals("Incorrect hex string returned", "7fffffffffffffff", Long.toHexString( + Long.MAX_VALUE)); } /** @@ -452,12 +450,12 @@ */ public void test_toOctalStringJ() { // Test for method java.lang.String java.lang.Long.toOctalString(long) - assertTrue("Returned incorrect oct string", Long.toOctalString( - 8589934591L).equals("77777777777")); - assertTrue("Returned incorrect oct string", Long.toOctalString( - Long.MIN_VALUE).equals("1000000000000000000000")); - assertTrue("Returned incorrect oct string", Long.toOctalString( - Long.MAX_VALUE).equals("777777777777777777777")); + assertEquals("Returned incorrect oct string", "77777777777", Long.toOctalString( + 8589934591L)); + assertEquals("Returned incorrect oct string", "1000000000000000000000", Long.toOctalString( + Long.MIN_VALUE)); + assertEquals("Returned incorrect oct string", "777777777777777777777", Long.toOctalString( + Long.MAX_VALUE)); } /** @@ -466,12 +464,12 @@ public void test_toString() { // Test for method java.lang.String java.lang.Long.toString() Long l = new Long(89000000005L); - assertTrue("Returned incorrect String", l.toString().equals( - "89000000005")); - assertTrue("Returned incorrect String", new Long(Long.MIN_VALUE) - .toString().equals("-9223372036854775808")); - assertTrue("Returned incorrect String", new Long(Long.MAX_VALUE) - .toString().equals("9223372036854775807")); + assertEquals("Returned incorrect String", + "89000000005", l.toString()); + assertEquals("Returned incorrect String", "-9223372036854775808", new Long(Long.MIN_VALUE) + .toString()); + assertEquals("Returned incorrect String", "9223372036854775807", new Long(Long.MAX_VALUE) + .toString()); } /** @@ -480,12 +478,12 @@ public void test_toStringJ() { // Test for method java.lang.String java.lang.Long.toString(long) - assertTrue("Returned incorrect String", Long.toString(89000000005L) - .equals("89000000005")); - assertTrue("Returned incorrect String", Long.toString(Long.MIN_VALUE) - .equals("-9223372036854775808")); - assertTrue("Returned incorrect String", Long.toString(Long.MAX_VALUE) - .equals("9223372036854775807")); + assertEquals("Returned incorrect String", "89000000005", Long.toString(89000000005L) + ); + assertEquals("Returned incorrect String", "-9223372036854775808", Long.toString(Long.MIN_VALUE) + ); + assertEquals("Returned incorrect String", "9223372036854775807", Long.toString(Long.MAX_VALUE) + ); } /** @@ -493,23 +491,23 @@ */ public void test_toStringJI() { // Test for method java.lang.String java.lang.Long.toString(long, int) - assertTrue("Returned incorrect dec string", Long.toString(100000000L, - 10).equals("100000000")); - assertTrue("Returned incorrect hex string", Long.toString(68719476735L, - 16).equals("fffffffff")); - assertTrue("Returned incorrect oct string", Long.toString(8589934591L, - 8).equals("77777777777")); - assertTrue("Returned incorrect bin string", Long.toString( - 8796093022207L, 2).equals( - "1111111111111111111111111111111111111111111")); - assertTrue("Returned incorrect min string", Long.toString( - 0x8000000000000000L, 10).equals("-9223372036854775808")); - assertTrue("Returned incorrect max string", Long.toString( - 0x7fffffffffffffffL, 10).equals("9223372036854775807")); - assertTrue("Returned incorrect min string", Long.toString( - 0x8000000000000000L, 16).equals("-8000000000000000")); - assertTrue("Returned incorrect max string", Long.toString( - 0x7fffffffffffffffL, 16).equals("7fffffffffffffff")); + assertEquals("Returned incorrect dec string", "100000000", Long.toString(100000000L, + 10)); + assertEquals("Returned incorrect hex string", "fffffffff", Long.toString(68719476735L, + 16)); + assertEquals("Returned incorrect oct string", "77777777777", Long.toString(8589934591L, + 8)); + assertEquals("Returned incorrect bin string", + "1111111111111111111111111111111111111111111", Long.toString( + 8796093022207L, 2)); + assertEquals("Returned incorrect min string", "-9223372036854775808", Long.toString( + 0x8000000000000000L, 10)); + assertEquals("Returned incorrect max string", "9223372036854775807", Long.toString( + 0x7fffffffffffffffL, 10)); + assertEquals("Returned incorrect min string", "-8000000000000000", Long.toString( + 0x8000000000000000L, 16)); + assertEquals("Returned incorrect max string", "7fffffffffffffff", Long.toString( + 0x7fffffffffffffffL, 16)); } /** Index: modules/luni/src/test/java/tests/api/java/lang/PackageTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/lang/PackageTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/lang/PackageTest.java 2006-04-16 14:00:48.000000000 +0100 @@ -54,28 +54,22 @@ urls[0] = resourceURL; ucl = new java.net.URLClassLoader(urls, null); c = Class.forName("p.C", true, ucl); - assertTrue( - "Package getImplementationTitle returns a wrong string (1)", - c.getPackage().getImplementationTitle().equals( - "p Implementation-Title")); - assertTrue( - "Package getImplementationVendor returns a wrong string (1)", - c.getPackage().getImplementationVendor().equals( - "p Implementation-Vendor")); - assertTrue( - "Package getImplementationVersion returns a wrong string (1)", - c.getPackage().getImplementationVersion().equals("2.2.2")); - assertTrue( - "Package getSpecificationTitle returns a wrong string (1)", - c.getPackage().getSpecificationTitle().equals( - "p Specification-Title")); - assertTrue( - "Package getSpecificationVendor returns a wrong string (1)", - c.getPackage().getSpecificationVendor().equals( - "p Specification-Vendor")); - assertTrue( - "Package getSpecificationVersion returns a wrong string (1)", - c.getPackage().getSpecificationVersion().equals("2.2.2")); + assertEquals("Package getImplementationTitle returns a wrong string (1)", + + "p Implementation-Title", c.getPackage().getImplementationTitle()); + assertEquals("Package getImplementationVendor returns a wrong string (1)", + + "p Implementation-Vendor", c.getPackage().getImplementationVendor()); + assertEquals("Package getImplementationVersion returns a wrong string (1)", + "2.2.2", c.getPackage().getImplementationVersion()); + assertEquals("Package getSpecificationTitle returns a wrong string (1)", + + "p Specification-Title", c.getPackage().getSpecificationTitle()); + assertEquals("Package getSpecificationVendor returns a wrong string (1)", + + "p Specification-Vendor", c.getPackage().getSpecificationVendor()); + assertEquals("Package getSpecificationVersion returns a wrong string (1)", + "2.2.2", c.getPackage().getSpecificationVersion()); } catch (Exception e) { fail("Exception during helperAttributes test : " + e.getMessage()); } @@ -88,28 +82,22 @@ urls[0] = resourceURL; ucl = new java.net.URLClassLoader(urls, null); c = Class.forName("p.C", true, ucl); - assertTrue( - "Package getImplementationTitle returns a wrong string (2)", - c.getPackage().getImplementationTitle().equals( - "MF Implementation-Title")); - assertTrue( - "Package getImplementationVendor returns a wrong string (2)", - c.getPackage().getImplementationVendor().equals( - "MF Implementation-Vendor")); - assertTrue( - "Package getImplementationVersion returns a wrong string (2)", - c.getPackage().getImplementationVersion().equals("5.3.b1")); - assertTrue( - "Package getSpecificationTitle returns a wrong string (2)", - c.getPackage().getSpecificationTitle().equals( - "MF Specification-Title")); - assertTrue( - "Package getSpecificationVendor returns a wrong string (2)", - c.getPackage().getSpecificationVendor().equals( - "MF Specification-Vendor")); - assertTrue( - "Package getSpecificationVersion returns a wrong string (2)", - c.getPackage().getSpecificationVersion().equals("1.2.3")); + assertEquals("Package getImplementationTitle returns a wrong string (2)", + + "MF Implementation-Title", c.getPackage().getImplementationTitle()); + assertEquals("Package getImplementationVendor returns a wrong string (2)", + + "MF Implementation-Vendor", c.getPackage().getImplementationVendor()); + assertEquals("Package getImplementationVersion returns a wrong string (2)", + "5.3.b1", c.getPackage().getImplementationVersion()); + assertEquals("Package getSpecificationTitle returns a wrong string (2)", + + "MF Specification-Title", c.getPackage().getSpecificationTitle()); + assertEquals("Package getSpecificationVendor returns a wrong string (2)", + + "MF Specification-Vendor", c.getPackage().getSpecificationVendor()); + assertEquals("Package getSpecificationVersion returns a wrong string (2)", + "1.2.3", c.getPackage().getSpecificationVersion()); } catch (Exception e) { fail("Exception in helperAttributes test : " + e.getMessage()); } @@ -123,28 +111,22 @@ urls[0] = resourceURL; ucl = new java.net.URLClassLoader(urls, null); c = Class.forName("p.C", true, ucl); - assertTrue( - "Package getImplementationTitle returns a wrong string (3)", - c.getPackage().getImplementationTitle().equals( - "MF Implementation-Title")); - assertTrue( - "Package getImplementationVendor returns a wrong string (3)", - c.getPackage().getImplementationVendor().equals( - "MF Implementation-Vendor")); - assertTrue( - "Package getImplementationVersion returns a wrong string (3)", - c.getPackage().getImplementationVersion().equals("5.3.b1")); - assertTrue( - "Package getSpecificationTitle returns a wrong string (3)", - c.getPackage().getSpecificationTitle().equals( - "MF Specification-Title")); - assertTrue( - "Package getSpecificationVendor returns a wrong string (3)", - c.getPackage().getSpecificationVendor().equals( - "MF Specification-Vendor")); - assertTrue( - "Package getSpecificationVersion returns a wrong string (3)", - c.getPackage().getSpecificationVersion().equals("1.2.3")); + assertEquals("Package getImplementationTitle returns a wrong string (3)", + + "MF Implementation-Title", c.getPackage().getImplementationTitle()); + assertEquals("Package getImplementationVendor returns a wrong string (3)", + + "MF Implementation-Vendor", c.getPackage().getImplementationVendor()); + assertEquals("Package getImplementationVersion returns a wrong string (3)", + "5.3.b1", c.getPackage().getImplementationVersion()); + assertEquals("Package getSpecificationTitle returns a wrong string (3)", + + "MF Specification-Title", c.getPackage().getSpecificationTitle()); + assertEquals("Package getSpecificationVendor returns a wrong string (3)", + + "MF Specification-Vendor", c.getPackage().getSpecificationVendor()); + assertEquals("Package getSpecificationVersion returns a wrong string (3)", + "1.2.3", c.getPackage().getSpecificationVersion()); } catch (Exception e) { fail("Exception during helperAttributes test : " + e.getMessage()); } @@ -158,28 +140,22 @@ urls[0] = resourceURL; ucl = new java.net.URLClassLoader(urls, null); c = Class.forName("p.C", true, ucl); - assertTrue( - "Package getImplementationTitle returns a wrong string (4)", - c.getPackage().getImplementationTitle().equals( - "p Implementation-Title")); - assertTrue( - "Package getImplementationVendor returns a wrong string (4)", - c.getPackage().getImplementationVendor().equals( - "MF Implementation-Vendor")); - assertTrue( - "Package getImplementationVersion returns a wrong string (4)", - c.getPackage().getImplementationVersion().equals("2.2.2")); - assertTrue( - "Package getSpecificationTitle returns a wrong string (4)", - c.getPackage().getSpecificationTitle().equals( - "MF Specification-Title")); - assertTrue( - "Package getSpecificationVendor returns a wrong string (4)", - c.getPackage().getSpecificationVendor().equals( - "p Specification-Vendor")); - assertTrue( - "Package getSpecificationVersion returns a wrong string (4)", - c.getPackage().getSpecificationVersion().equals("2.2.2")); + assertEquals("Package getImplementationTitle returns a wrong string (4)", + + "p Implementation-Title", c.getPackage().getImplementationTitle()); + assertEquals("Package getImplementationVendor returns a wrong string (4)", + + "MF Implementation-Vendor", c.getPackage().getImplementationVendor()); + assertEquals("Package getImplementationVersion returns a wrong string (4)", + "2.2.2", c.getPackage().getImplementationVersion()); + assertEquals("Package getSpecificationTitle returns a wrong string (4)", + + "MF Specification-Title", c.getPackage().getSpecificationTitle()); + assertEquals("Package getSpecificationVendor returns a wrong string (4)", + + "p Specification-Vendor", c.getPackage().getSpecificationVendor()); + assertEquals("Package getSpecificationVersion returns a wrong string (4)", + "2.2.2", c.getPackage().getSpecificationVersion()); } catch (Exception e) { fail("Exception during helperAttributes test : " + e.getMessage()); } @@ -192,29 +168,23 @@ urls[0] = resourceURL; ucl = new java.net.URLClassLoader(urls, null); c = Class.forName("p.q.C", true, ucl); - assertTrue( - "Package getImplementationTitle returns a wrong string (5)", - c.getPackage().getImplementationTitle().equals( - "p Implementation-Title")); - assertTrue( - "Package getImplementationVendor returns a wrong string (5)", - c.getPackage().getImplementationVendor().equals( - "p Implementation-Vendor")); - assertTrue( - "Package getImplementationVersion returns a wrong string (5)", - c.getPackage().getImplementationVersion().equals("1.1.3")); - assertTrue( - "Package getSpecificationTitle returns a wrong string (5)", - c.getPackage().getSpecificationTitle().equals( - "p Specification-Title")); - assertTrue( - "Package getSpecificationVendor returns a wrong string (5)", - c.getPackage().getSpecificationVendor().equals( - "p Specification-Vendor")); - assertTrue( - "Package getSpecificationVersion returns a wrong string (5)", - c.getPackage().getSpecificationVersion().equals( - "2.2.0.0.0.0.0.0.0.0.0")); + assertEquals("Package getImplementationTitle returns a wrong string (5)", + + "p Implementation-Title", c.getPackage().getImplementationTitle()); + assertEquals("Package getImplementationVendor returns a wrong string (5)", + + "p Implementation-Vendor", c.getPackage().getImplementationVendor()); + assertEquals("Package getImplementationVersion returns a wrong string (5)", + "1.1.3", c.getPackage().getImplementationVersion()); + assertEquals("Package getSpecificationTitle returns a wrong string (5)", + + "p Specification-Title", c.getPackage().getSpecificationTitle()); + assertEquals("Package getSpecificationVendor returns a wrong string (5)", + + "p Specification-Vendor", c.getPackage().getSpecificationVendor()); + assertEquals("Package getSpecificationVersion returns a wrong string (5)", + + "2.2.0.0.0.0.0.0.0.0.0", c.getPackage().getSpecificationVersion()); } catch (Exception e) { fail("Exception during helperAttributes test : " + e.getMessage()); @@ -261,8 +231,8 @@ urls[0] = resourceURL; ucl = new java.net.URLClassLoader(urls, null); c = Class.forName("p.q.C", true, ucl); - assertTrue("Package getName returns a wrong string", c.getPackage() - .getName().equals("p.q")); + assertEquals("Package getName returns a wrong string", "p.q", c.getPackage() + .getName()); } catch (Exception e) { fail("Exception during getName test : " + e.getMessage()); Index: modules/luni/src/test/java/tests/api/java/lang/ShortTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/lang/ShortTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/lang/ShortTest.java 2006-04-16 13:59:11.000000000 +0100 @@ -379,12 +379,12 @@ // Test for method java.lang.String java.lang.Short.toString() assertTrue("Invalid string returned", sp.toString().equals("18000") && (sn.toString().equals("-19000"))); - assertTrue("Returned incorrect string", new Short((short) 32767) - .toString().equals("32767")); - assertTrue("Returned incorrect string", new Short((short) -32767) - .toString().equals("-32767")); - assertTrue("Returned incorrect string", new Short((short) -32768) - .toString().equals("-32768")); + assertEquals("Returned incorrect string", "32767", new Short((short) 32767) + .toString()); + assertEquals("Returned incorrect string", "-32767", new Short((short) -32767) + .toString()); + assertEquals("Returned incorrect string", "-32768", new Short((short) -32768) + .toString()); } /** @@ -392,12 +392,12 @@ */ public void test_toStringS() { // Test for method java.lang.String java.lang.Short.toString(short) - assertTrue("Returned incorrect string", Short.toString((short) 32767) - .equals("32767")); - assertTrue("Returned incorrect string", Short.toString((short) -32767) - .equals("-32767")); - assertTrue("Returned incorrect string", Short.toString((short) -32768) - .equals("-32768")); + assertEquals("Returned incorrect string", "32767", Short.toString((short) 32767) + ); + assertEquals("Returned incorrect string", "-32767", Short.toString((short) -32767) + ); + assertEquals("Returned incorrect string", "-32768", Short.toString((short) -32768) + ); } /** Index: modules/luni/src/test/java/tests/api/java/lang/StringBufferTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/lang/StringBufferTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/lang/StringBufferTest.java 2006-04-16 13:59:11.000000000 +0100 @@ -67,8 +67,8 @@ char buf[] = new char[4]; "char".getChars(0, 4, buf, 0); testBuffer.append(buf); - assertTrue("Append of char[] failed", testBuffer.toString().equals( - "This is a test bufferchar")); + assertEquals("Append of char[] failed", + "This is a test bufferchar", testBuffer.toString()); } /** @@ -114,8 +114,8 @@ StringBuffer sb = new StringBuffer(); sb.append(Double.MAX_VALUE); assertTrue("Buffer is invalid length after append", sb.length() == 22); - assertTrue("Buffer contains invalid characters", sb.toString().equals( - "1.7976931348623157E308")); + assertEquals("Buffer contains invalid characters", + "1.7976931348623157E308", sb.toString()); } /** @@ -144,8 +144,8 @@ assertTrue("Buffer is invalid length after append", sb.length() == 4); sb.append(1000); assertTrue("Buffer is invalid length after append", sb.length() == 8); - assertTrue("Buffer contains invalid characters", sb.toString().equals( - "90001000")); + assertEquals("Buffer contains invalid characters", + "90001000", sb.toString()); } /** @@ -159,8 +159,8 @@ long t = 927654321098L; sb.append(t); assertTrue("Buffer is of invlaid length", sb.length() == 12); - assertTrue("Buffer contains invalid characters", sb.toString().equals( - "927654321098")); + assertEquals("Buffer contains invalid characters", + "927654321098", sb.toString()); } /** @@ -246,28 +246,28 @@ // Test for method java.lang.StringBuffer // java.lang.StringBuffer.delete(int, int) testBuffer.delete(7, 7); - assertTrue("Deleted chars when start == end", testBuffer.toString() - .equals("This is a test buffer")); + assertEquals("Deleted chars when start == end", "This is a test buffer", testBuffer.toString() + ); testBuffer.delete(4, 14); - assertTrue("Deleted incorrect chars", testBuffer.toString().equals( - "This buffer")); + assertEquals("Deleted incorrect chars", + "This buffer", testBuffer.toString()); testBuffer = new StringBuffer("This is a test buffer"); String sharedStr = testBuffer.toString(); testBuffer.delete(0, testBuffer.length()); - assertTrue("Didn't clone shared buffer", sharedStr - .equals("This is a test buffer")); + assertEquals("Didn't clone shared buffer", "This is a test buffer", sharedStr + ); assertTrue("Deleted incorrect chars", testBuffer.toString().equals("")); testBuffer.append("more stuff"); - assertTrue("Didn't clone shared buffer 2", sharedStr - .equals("This is a test buffer")); - assertTrue("Wrong contents", testBuffer.toString().equals("more stuff")); + assertEquals("Didn't clone shared buffer 2", "This is a test buffer", sharedStr + ); + assertEquals("Wrong contents", "more stuff", testBuffer.toString()); try { testBuffer.delete(-5, 2); } catch (IndexOutOfBoundsException e) { } - assertTrue("Wrong contents 2", testBuffer.toString().equals( - "more stuff")); + assertEquals("Wrong contents 2", + "more stuff", testBuffer.toString()); } /** @@ -277,8 +277,8 @@ // Test for method java.lang.StringBuffer // java.lang.StringBuffer.deleteCharAt(int) testBuffer.deleteCharAt(3); - assertTrue("Deleted incorrect char", testBuffer.toString().equals( - "Thi is a test buffer")); + assertEquals("Deleted incorrect char", + "Thi is a test buffer", testBuffer.toString()); } /** @@ -323,8 +323,8 @@ char buf[] = new char[4]; "char".getChars(0, 4, buf, 0); testBuffer.insert(15, buf); - assertTrue("Insert test failed", testBuffer.toString().equals( - "This is a test charbuffer")); + assertEquals("Insert test failed", + "This is a test charbuffer", testBuffer.toString()); boolean exception = false; StringBuffer buf1 = new StringBuffer("abcd"); @@ -366,8 +366,8 @@ // Test for method java.lang.StringBuffer // java.lang.StringBuffer.insert(int, char) testBuffer.insert(15, 'T'); - assertTrue("Insert test failed", testBuffer.toString().equals( - "This is a test Tbuffer")); + assertEquals("Insert test failed", + "This is a test Tbuffer", testBuffer.toString()); } /** @@ -403,8 +403,8 @@ // Test for method java.lang.StringBuffer // java.lang.StringBuffer.insert(int, int) testBuffer.insert(15, 100); - assertTrue("Insert test failed", testBuffer.toString().equals( - "This is a test 100buffer")); + assertEquals("Insert test failed", + "This is a test 100buffer", testBuffer.toString()); } /** @@ -414,8 +414,8 @@ // Test for method java.lang.StringBuffer // java.lang.StringBuffer.insert(int, long) testBuffer.insert(15, 88888888888888888L); - assertTrue("Insert test failed", testBuffer.toString().equals( - "This is a test 88888888888888888buffer")); + assertEquals("Insert test failed", + "This is a test 88888888888888888buffer", testBuffer.toString()); } /** @@ -438,8 +438,8 @@ // java.lang.StringBuffer.insert(int, java.lang.String) testBuffer.insert(15, "STRING "); - assertTrue("Insert test failed", testBuffer.toString().equals( - "This is a test STRING buffer")); + assertEquals("Insert test failed", + "This is a test STRING buffer", testBuffer.toString()); } /** @@ -449,8 +449,8 @@ // Test for method java.lang.StringBuffer // java.lang.StringBuffer.insert(int, boolean) testBuffer.insert(15, true); - assertTrue("Insert test failed", testBuffer.toString().equals( - "This is a test truebuffer")); + assertEquals("Insert test failed", + "This is a test truebuffer", testBuffer.toString()); } /** @@ -472,12 +472,12 @@ + "This is a replaced test buffer" + "\'" + " but got: " + "\'" + testBuffer.toString() + "\'", testBuffer.toString().equals( "This is a replaced test buffer")); - assertTrue("insert1", new StringBuffer().replace(0, 0, "text") - .toString().equals("text")); - assertTrue("insert2", new StringBuffer("123").replace(3, 3, "text") - .toString().equals("123text")); - assertTrue("insert2", new StringBuffer("123").replace(1, 1, "text") - .toString().equals("1text23")); + assertEquals("insert1", "text", new StringBuffer().replace(0, 0, "text") + .toString()); + assertEquals("insert2", "123text", new StringBuffer("123").replace(3, 3, "text") + .toString()); + assertEquals("insert2", "1text23", new StringBuffer("123").replace(1, 1, "text") + .toString()); } private String writeString(String in) { @@ -564,8 +564,8 @@ .startsWith("This is a test buffer")); testBuffer.setLength(2); assertTrue("Failed to decrease length", testBuffer.length() == 2); - assertTrue("Decrease in length failed", testBuffer.toString().equals( - "Th")); + assertEquals("Decrease in length failed", + "Th", testBuffer.toString()); } /** @@ -574,8 +574,8 @@ public void test_substringI() { // Test for method java.lang.String // java.lang.StringBuffer.substring(int) - assertTrue("Returned incorrect substring", testBuffer.substring(5) - .equals("is a test buffer")); + assertEquals("Returned incorrect substring", "is a test buffer", testBuffer.substring(5) + ); } /** @@ -584,8 +584,8 @@ public void test_substringII() { // Test for method java.lang.String // java.lang.StringBuffer.substring(int, int) - assertTrue("Returned incorrect substring", testBuffer.substring(5, 7) - .equals("is")); + assertEquals("Returned incorrect substring", "is", testBuffer.substring(5, 7) + ); } /** @@ -593,8 +593,8 @@ */ public void test_toString() { // Test for method java.lang.String java.lang.StringBuffer.toString() - assertTrue("Incorrect string value returned", testBuffer.toString() - .equals("This is a test buffer")); + assertEquals("Incorrect string value returned", "This is a test buffer", testBuffer.toString() + ); } /** Index: modules/luni/src/test/java/tests/api/java/lang/StringTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/lang/StringTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/lang/StringTest.java 2006-04-16 14:00:48.000000000 +0100 @@ -129,7 +129,7 @@ */ public void test_Constructor$C() { // Test for method java.lang.String(char []) - assertTrue("Failed Constructor test", new String(buf).equals("World")); + assertEquals("Failed Constructor test", "World", new String(buf)); } /** @@ -156,8 +156,8 @@ public void test_ConstructorLjava_lang_String() { // Test for method java.lang.String(java.lang.String) String s = new String("Hello World"); - assertTrue("Failed to construct correct string", s - .equals("Hello World")); + assertEquals("Failed to construct correct string", "Hello World", s + ); } /** @@ -167,8 +167,8 @@ // Test for method java.lang.String(java.lang.StringBuffer) StringBuffer sb = new StringBuffer(); sb.append("HelloWorld"); - assertTrue("Created incorrect string", new String(sb) - .equals("HelloWorld")); + assertEquals("Created incorrect string", "HelloWorld", new String(sb) + ); } /** @@ -286,8 +286,8 @@ // Test for method java.lang.String java.lang.String.copyValueOf(char // []) char[] t = { 'H', 'e', 'l', 'l', 'o', 'W', 'o', 'r', 'l', 'd' }; - assertTrue("copyValueOf returned incorrect String", String.copyValueOf( - t).equals("HelloWorld")); + assertEquals("copyValueOf returned incorrect String", "HelloWorld", String.copyValueOf( + t)); } /** @@ -297,8 +297,8 @@ // Test for method java.lang.String java.lang.String.copyValueOf(char // [], int, int) char[] t = { 'H', 'e', 'l', 'l', 'o', 'W', 'o', 'r', 'l', 'd' }; - assertTrue("copyValueOf returned incorrect String", String.copyValueOf( - t, 5, 5).equals("World")); + assertEquals("copyValueOf returned incorrect String", "World", String.copyValueOf( + t, 5, 5)); } /** @@ -432,7 +432,7 @@ // int) byte[] buf = new byte[5]; "Hello World".getBytes(6, 11, buf, 0); - assertTrue("Returned incorrect bytes", new String(buf).equals("World")); + assertEquals("Returned incorrect bytes", "World", new String(buf)); Exception exception = null; try { @@ -450,8 +450,8 @@ public void test_getBytesLjava_lang_String() { // Test for method byte [] java.lang.String.getBytes(java.lang.String) byte[] buf = "Hello World".getBytes(); - assertTrue("Returned incorrect bytes", new String(buf) - .equals("Hello World")); + assertEquals("Returned incorrect bytes", "Hello World", new String(buf) + ); boolean exception = false; try { @@ -649,7 +649,7 @@ */ public void test_replaceCC() { // Test for method java.lang.String java.lang.String.replace(char, char) - assertTrue("Failed replace", hw1.replace('l', 'z').equals("HezzoWorzd")); + assertEquals("Failed replace", "HezzoWorzd", hw1.replace('l', 'z')); } /** @@ -676,8 +676,8 @@ */ public void test_substringI() { // Test for method java.lang.String java.lang.String.substring(int) - assertTrue("Incorrect substring returned", hw1.substring(5).equals( - "World")); + assertEquals("Incorrect substring returned", + "World", hw1.substring(5)); assertTrue("not identical", hw1.substring(0) == hw1); } @@ -712,12 +712,10 @@ assertTrue("toLowerCase case conversion did not succeed", hwuc .toLowerCase().equals(hwlc)); - assertTrue( - "a) Sigma has same lower case value at end of word with Unicode 3.0", - "\u03a3\u03a3".toLowerCase().equals("\u03c3\u03c3")); - assertTrue( - "b) Sigma has same lower case value at end of word with Unicode 3.0", - "a\u03a3".toLowerCase().equals("a\u03c3")); + assertEquals("a) Sigma has same lower case value at end of word with Unicode 3.0", + "\u03c3\u03c3", "\u03a3\u03a3".toLowerCase()); + assertEquals("b) Sigma has same lower case value at end of word with Unicode 3.0", + "a\u03c3", "a\u03a3".toLowerCase()); } /** @@ -728,10 +726,10 @@ // java.lang.String.toLowerCase(java.util.Locale) assertTrue("toLowerCase case conversion did not succeed", hwuc .toLowerCase(java.util.Locale.getDefault()).equals(hwlc)); - assertTrue("Invalid \\u0049 for English", "\u0049".toLowerCase( - Locale.ENGLISH).equals("\u0069")); - assertTrue("Invalid \\u0049 for Turkish", "\u0049".toLowerCase( - new Locale("tr", "")).equals("\u0131")); + assertEquals("Invalid \\u0049 for English", "\u0069", "\u0049".toLowerCase( + Locale.ENGLISH)); + assertEquals("Invalid \\u0049 for Turkish", "\u0131", "\u0049".toLowerCase( + new Locale("tr", ""))); } private static String writeString(String in) { @@ -768,7 +766,7 @@ assertTrue("Returned string is not UpperCase", hwlc.toUpperCase() .equals(hwuc)); - assertTrue("Wrong conversion", "\u00df".toUpperCase().equals("SS")); + assertEquals("Wrong conversion", "SS", "\u00df".toUpperCase()); String s = "a\u00df\u1f56"; assertTrue("Invalid conversion", !s.toUpperCase().equals(s)); @@ -783,10 +781,10 @@ // java.lang.String.toUpperCase(java.util.Locale) assertTrue("Returned string is not UpperCase", hwlc.toUpperCase() .equals(hwuc)); - assertTrue("Invalid \\u0069 for English", "\u0069".toUpperCase( - Locale.ENGLISH).equals("\u0049")); - assertTrue("Invalid \\u0069 for Turkish", "\u0069".toUpperCase( - new Locale("tr", "")).equals("\u0130")); + assertEquals("Invalid \\u0069 for English", "\u0049", "\u0069".toUpperCase( + Locale.ENGLISH)); + assertEquals("Invalid \\u0069 for Turkish", "\u0130", "\u0069".toUpperCase( + new Locale("tr", ""))); } /** @@ -811,8 +809,8 @@ */ public void test_valueOf$C() { // Test for method java.lang.String java.lang.String.valueOf(char []) - assertTrue("Returned incorrect String", String.valueOf(buf).equals( - "World")); + assertEquals("Returned incorrect String", + "World", String.valueOf(buf)); } /** @@ -822,8 +820,8 @@ // Test for method java.lang.String java.lang.String.valueOf(char [], // int, int) char[] t = { 'H', 'e', 'l', 'l', 'o', 'W', 'o', 'r', 'l', 'd' }; - assertTrue("copyValueOf returned incorrect String", String.valueOf(t, - 5, 5).equals("World")); + assertEquals("copyValueOf returned incorrect String", "World", String.valueOf(t, + 5, 5)); } /** @@ -841,8 +839,8 @@ */ public void test_valueOfD() { // Test for method java.lang.String java.lang.String.valueOf(double) - assertTrue("Incorrect double string returned", String.valueOf( - Double.MAX_VALUE).equals("1.7976931348623157E308")); + assertEquals("Incorrect double string returned", "1.7976931348623157E308", String.valueOf( + Double.MAX_VALUE)); } /** @@ -866,7 +864,7 @@ */ public void test_valueOfI() { // Test for method java.lang.String java.lang.String.valueOf(int) - assertTrue("returned invalid int string", String.valueOf(1).equals("1")); + assertEquals("returned invalid int string", "1", String.valueOf(1)); } /** @@ -874,8 +872,8 @@ */ public void test_valueOfJ() { // Test for method java.lang.String java.lang.String.valueOf(long) - assertTrue("returned incorrect long string", String.valueOf( - 927654321098L).equals("927654321098")); + assertEquals("returned incorrect long string", "927654321098", String.valueOf( + 927654321098L)); } /** Index: modules/luni/src/test/java/tests/api/java/lang/SystemTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/lang/SystemTest.java.orig 2006-04-16 11:47:21.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/lang/SystemTest.java 2006-04-16 13:59:11.000000000 +0100 @@ -193,8 +193,8 @@ assertTrue("Failed to return correct property value: " + System.getProperty("java.version", "99999"), System .getProperty("java.version", "99999").indexOf("1.", 0) >= 0); - assertTrue("Failed to return correct property value", System - .getProperty("bogus.prop", "bogus").equals("bogus")); + assertEquals("Failed to return correct property value", "bogus", System + .getProperty("bogus.prop", "bogus")); } /** @@ -291,8 +291,8 @@ tProps.put("bogus.prop", "bogus"); System.setProperties(tProps); try { - assertTrue("Failed to set properties", System.getProperties() - .getProperty("test.prop").equals("this is a test property")); + assertEquals("Failed to set properties", "this is a test property", System.getProperties() + .getProperty("test.prop")); } finally { // restore the original properties System.setProperties(orgProps); Index: modules/luni/src/test/java/tests/api/java/lang/ThreadTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/lang/ThreadTest.java.orig 2006-04-16 11:47:21.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/lang/ThreadTest.java 2006-04-16 13:59:11.000000000 +0100 @@ -159,8 +159,8 @@ // Test for method java.lang.Thread(java.lang.Runnable, // java.lang.String) Thread st1 = new Thread(new SimpleThread(1), "SimpleThread1"); - assertTrue("Constructed thread with incorrect thread name", st1 - .getName().equals("SimpleThread1")); + assertEquals("Constructed thread with incorrect thread name", "SimpleThread1", st1 + .getName()); st1.start(); } @@ -170,8 +170,8 @@ public void test_ConstructorLjava_lang_String() { // Test for method java.lang.Thread(java.lang.String) Thread t = new Thread("Testing"); - assertTrue("Created tread with incorrect name", t.getName().equals( - "Testing")); + assertEquals("Created tread with incorrect name", + "Testing", t.getName()); t.start(); } @@ -234,8 +234,8 @@ // Test for method java.lang.Thread(java.lang.ThreadGroup, // java.lang.String) st = new Thread(new SimpleThread(1), "SimpleThread4"); - assertTrue("Returned incorrect thread name", st.getName().equals( - "SimpleThread4")); + assertEquals("Returned incorrect thread name", + "SimpleThread4", st.getName()); st.start(); } @@ -373,8 +373,8 @@ public void test_getName() { // Test for method java.lang.String java.lang.Thread.getName() st = new Thread(new SimpleThread(1), "SimpleThread6"); - assertTrue("Returned incorrect thread name", st.getName().equals( - "SimpleThread6")); + assertEquals("Returned incorrect thread name", + "SimpleThread6", st.getName()); st.start(); } @@ -806,8 +806,8 @@ // Test for method void java.lang.Thread.setName(java.lang.String) st = new Thread(new SimpleThread(1), "SimpleThread15"); st.setName("Bogus Name"); - assertTrue("Failed to set thread name", st.getName().equals( - "Bogus Name")); + assertEquals("Failed to set thread name", + "Bogus Name", st.getName()); try { st.setName(null); fail("Null should not be accepted as a valid name"); Index: modules/luni/src/test/java/tests/api/java/lang/ThrowableTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/lang/ThrowableTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/lang/ThrowableTest.java 2006-04-16 11:47:22.000000000 +0100 @@ -43,8 +43,8 @@ if (true) throw new Throwable("Throw"); } catch (Throwable e) { - assertTrue("Threw Throwable with incorrect message", e.getMessage() - .equals("Throw")); + assertEquals("Threw Throwable with incorrect message", "Throw", e.getMessage() + ); return; } fail("Failed to throw Throwable"); @@ -135,8 +135,8 @@ // Test for method java.lang.String java.lang.Throwable.getMessage() Throwable x = new ClassNotFoundException("A Message"); - assertTrue("Returned incorrect messasge string", x.getMessage().equals( - "A Message")); + assertEquals("Returned incorrect messasge string", + "A Message", x.getMessage()); } /** @@ -199,8 +199,8 @@ if (true) throw new Throwable("Throw"); } catch (Throwable e) { - assertTrue("Threw Throwable with incorrect string", e.toString() - .equals("java.lang.Throwable: Throw")); + assertEquals("Threw Throwable with incorrect string", "java.lang.Throwable: Throw", e.toString() + ); return; } fail("Failed to throw Throwable"); Index: modules/luni/src/test/java/tests/api/java/net/DatagramPacketTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/net/DatagramPacketTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/net/DatagramPacketTest.java 2006-04-16 13:59:11.000000000 +0100 @@ -39,8 +39,8 @@ // Test for method java.net.DatagramPacket(byte [], int) try { dp = new DatagramPacket("Hello".getBytes(), 5); - assertTrue("Created incorrect packet", new String(dp.getData(), 0, - dp.getData().length).equals("Hello")); + assertEquals("Created incorrect packet", "Hello", new String(dp.getData(), 0, + dp.getData().length)); assertTrue("Wrong length", dp.getLength() == 5); } catch (Exception e) { fail("Exception during Constructor test: " + e.toString()); @@ -53,8 +53,8 @@ public void test_Constructor$BII() { try { dp = new DatagramPacket("Hello".getBytes(), 2, 3); - assertTrue("Created incorrect packet", new String(dp.getData(), 0, - dp.getData().length).equals("Hello")); + assertEquals("Created incorrect packet", "Hello", new String(dp.getData(), 0, + dp.getData().length)); assertTrue("Wrong length", dp.getLength() == 3); assertTrue("Wrong offset", dp.getOffset() == 2); } catch (Exception e) { @@ -122,8 +122,8 @@ // Test for method byte [] java.net.DatagramPacket.getData() dp = new DatagramPacket("Hello".getBytes(), 5); - assertTrue("Incorrect length returned", new String(dp.getData(), 0, dp - .getData().length).equals("Hello")); + assertEquals("Incorrect length returned", "Hello", new String(dp.getData(), 0, dp + .getData().length)); } /** @@ -243,8 +243,8 @@ public void test_setData$BII() { dp = new DatagramPacket("Hello".getBytes(), 5); dp.setData("Wagga Wagga".getBytes(), 2, 3); - assertTrue("Incorrect data set", new String(dp.getData()) - .equals("Wagga Wagga")); + assertEquals("Incorrect data set", "Wagga Wagga", new String(dp.getData()) + ); } /** @@ -254,8 +254,8 @@ // Test for method void java.net.DatagramPacket.setData(byte []) dp = new DatagramPacket("Hello".getBytes(), 5); dp.setData("Ralph".getBytes()); - assertTrue("Incorrect data set", new String(dp.getData(), 0, dp - .getData().length).equals("Ralph")); + assertEquals("Incorrect data set", "Ralph", new String(dp.getData(), 0, dp + .getData().length)); } /** Index: modules/luni/src/test/java/tests/api/java/net/JarURLConnectionTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/net/JarURLConnectionTest.java.orig 2006-04-16 11:47:21.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/net/JarURLConnectionTest.java 2006-04-16 13:59:11.000000000 +0100 @@ -40,9 +40,9 @@ + Support_Resources.getResourceURL("/JUC/lf.jar!/swt.dll")); juc = (JarURLConnection) u.openConnection(); java.util.jar.Attributes a = juc.getJarEntry().getAttributes(); - assertTrue("Returned incorrect Attributes", a.get( + assertEquals("Returned incorrect Attributes", "SHA MD5", a.get( new java.util.jar.Attributes.Name("Digest-Algorithms")) - .equals("SHA MD5")); + ); } catch (java.io.IOException e) { fail("Exception during test : " + e.getMessage()); } @@ -56,8 +56,8 @@ URL u = new URL("jar:" + Support_Resources.getResourceURL("/JUC/lf.jar!/plus.bmp")); juc = (JarURLConnection) u.openConnection(); - assertTrue("Returned incorrect entryName", juc.getEntryName() - .equals("plus.bmp")); + assertEquals("Returned incorrect entryName", "plus.bmp", juc.getEntryName() + ); u = new URL("jar:" + Support_Resources.getResourceURL("/JUC/lf.jar!/")); juc = (JarURLConnection) u.openConnection(); @@ -76,8 +76,8 @@ URL u = new URL("jar:" + Support_Resources.getResourceURL("/JUC/lf.jar!/plus.bmp")); juc = (JarURLConnection) u.openConnection(); - assertTrue("Returned incorrect JarEntry", juc.getJarEntry() - .getName().equals("plus.bmp")); + assertEquals("Returned incorrect JarEntry", "plus.bmp", juc.getJarEntry() + .getName()); u = new URL("jar:" + Support_Resources.getResourceURL("/JUC/lf.jar!/")); juc = (JarURLConnection) u.openConnection(); @@ -171,9 +171,9 @@ + Support_Resources.getResourceURL("/JUC/lf.jar!/swt.dll")); juc = (JarURLConnection) u.openConnection(); java.util.jar.Attributes a = juc.getMainAttributes(); - assertTrue("Returned incorrect Attributes", a.get( - java.util.jar.Attributes.Name.MANIFEST_VERSION).equals( - "1.0")); + assertEquals("Returned incorrect Attributes", + "1.0", a.get( + java.util.jar.Attributes.Name.MANIFEST_VERSION)); } catch (java.io.IOException e) { fail("IOException during test : " + e.getMessage()); } Index: modules/luni/src/test/java/tests/api/java/net/NoRouteToHostExceptionTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/net/NoRouteToHostExceptionTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/net/NoRouteToHostExceptionTest.java 2006-04-16 11:47:22.000000000 +0100 @@ -45,8 +45,8 @@ if (true) throw new NoRouteToHostException("test"); } catch (NoRouteToHostException e) { - assertTrue("Threw exception with incorrect message", e.getMessage() - .equals("test")); + assertEquals("Threw exception with incorrect message", "test", e.getMessage() + ); return; } fail("Failed to generate expected exception"); Index: modules/luni/src/test/java/tests/api/java/net/SocketPermissionTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/net/SocketPermissionTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/net/SocketPermissionTest.java 2006-04-16 11:47:22.000000000 +0100 @@ -47,13 +47,13 @@ // Test for method java.net.SocketPermission(java.lang.String, // java.lang.String) assertTrue("Incorrect name", star_Resolve.getName().equals(starName)); - assertTrue("Incorrect actions", star_Resolve.getActions().equals( - "resolve")); + assertEquals("Incorrect actions", + "resolve", star_Resolve.getActions()); SocketPermission sp1 = new SocketPermission("", "connect"); - assertTrue("Wrong name1", sp1.getName().equals("localhost")); + assertEquals("Wrong name1", "localhost", sp1.getName()); SocketPermission sp2 = new SocketPermission(":80", "connect"); - assertTrue("Wrong name2", sp2.getName().equals(":80")); + assertEquals("Wrong name2", ":80", sp2.getName()); } /** @@ -95,10 +95,10 @@ public void test_getActions() { // Test for method java.lang.String // java.net.SocketPermission.getActions() - assertTrue("Incorrect actions", star_Resolve.getActions().equals( - "resolve")); - assertTrue("Incorrect actions/not in canonical form", star_All - .getActions().equals("connect,listen,accept,resolve")); + assertEquals("Incorrect actions", + "resolve", star_Resolve.getActions()); + assertEquals("Incorrect actions/not in canonical form", "connect,listen,accept,resolve", star_All + .getActions()); } /** Index: modules/luni/src/test/java/tests/api/java/net/URITest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/net/URITest.java.orig 2006-04-16 11:47:21.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/net/URITest.java 2006-04-16 14:00:48.000000000 +0100 @@ -260,8 +260,8 @@ assertNull("wrong path", uri.getPath()); assertNull("wrong query", uri.getQuery()); assertNull("wrong fragment", uri.getFragment()); - assertTrue("wrong SchemeSpecificPart", uri.getSchemeSpecificPart() - .equals("mduerst@ifi.unizh.ch")); + 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")); + assertEquals("wrong userinfo", "us:e@r", uri.getUserInfo()); + assertEquals("wrong hostname", "hostname", uri.getHost()); 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 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")); + assertEquals("wrong scheme", "ht12-3+tp", uri.getScheme()); assertNull("wrong authority", uri.getUserInfo()); assertNull("wrong userinfo", uri.getUserInfo()); assertNull("wrong hostname", uri.getHost()); 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 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")); + ); } /** Index: modules/luni/src/test/java/tests/api/java/net/URLClassLoaderTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/net/URLClassLoaderTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/net/URLClassLoaderTest.java 2006-04-16 11:47:22.000000000 +0100 @@ -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() + ); } /** @@ -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() + ); } /** Index: modules/luni/src/test/java/tests/api/java/net/URLConnectionTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/net/URLConnectionTest.java.orig 2006-04-16 11:47:21.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/net/URLConnectionTest.java 2006-04-16 13:59:11.000000000 +0100 @@ -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) { @@ -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); @@ -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) { Index: modules/luni/src/test/java/tests/api/java/net/URLTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/net/URLTest.java.orig 2006-04-16 11:47:21.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/net/URLTest.java 2006-04-16 14:00:48.000000000 +0100 @@ -91,21 +91,21 @@ // 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")); + assertEquals("u returns a wrong protocol", + "http", u.getProtocol()); + assertEquals("u returns a wrong host", + "www.yahoo1.com", u.getHost()); 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 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")); + assertEquals("u1 returns a wrong protocol", + "http", u1.getProtocol()); + assertEquals("u1 returns a wrong host", + "www.yahoo2.com", u1.getHost()); assertTrue("u1 returns a wrong port", u1.getPort() == 9999); assertTrue("u1 returns a wrong file", u1.getFile().equals("")); assertNull("u1 returns a wrong anchor", u1.getRef()); @@ -113,55 +113,55 @@ // 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")); + assertEquals("u2 returns a wrong protocol", + "http", u2.getProtocol()); + assertEquals("u2 returns a wrong host", + "www.yahoo3.com", u2.getHost()); 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 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")); + assertEquals("u2a returns a wrong protocol", "file", u2a.getProtocol() + ); + assertEquals("u2a returns a wrong host", + "www.yahoo3.com", u2a.getHost()); 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 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")); + assertEquals("u3 returns a wrong protocol", + "http", u3.getProtocol()); + assertEquals("u3 returns a wrong host", + "www.yahoo4.com", u3.getHost()); assertTrue("u3 returns a wrong port", u3.getPort() == -1); - assertTrue("u3 returns a wrong file", u3.getFile().equals("/")); + 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")); + assertEquals("u3a returns a wrong protocol", "file", u3a.getProtocol() + ); + assertEquals("u3a returns a wrong host", + "www.yahoo4.com", u3a.getHost()); assertTrue("u3a returns a wrong port", u3a.getPort() == -1); - assertTrue("u3a returns a wrong file", u3a.getFile().equals("/")); + 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")); + assertEquals("u3b returns a wrong protocol", "file", u3b.getProtocol() + ); + assertEquals("u3b returns a wrong host", + "www.yahoo4.com", u3b.getHost()); assertTrue("u3b returns a wrong port", u3b.getPort() == -1); assertTrue("u3b returns a wrong file", u3b.getFile().equals("")); assertNull("u3b returns a wrong anchor", u3b.getRef()); @@ -169,32 +169,32 @@ // 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")); + assertEquals("u4 returns a wrong protocol", + "http", u4.getProtocol()); + assertEquals("u4 returns a wrong host", + "www.yahoo5.com", u4.getHost()); 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 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")); + 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")); + 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"); @@ -326,99 +326,99 @@ 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")); + assertEquals("1 returns a wrong protocol", + "http", u1.getProtocol()); + assertEquals("1 returns a wrong host", + "www.yahoo.com", u1.getHost()); assertTrue("1 returns a wrong port", u1.getPort() == -1); - assertTrue("1 returns a wrong file", u1.getFile().equals( - "/file.java")); + 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")); + assertEquals("1f returns a wrong protocol", + "file", u1f.getProtocol()); + assertEquals("1f returns a wrong host", + "www.yahoo.com", u1f.getHost()); assertTrue("1f returns a wrong port", u1f.getPort() == -1); - assertTrue("1f returns a wrong file", u1f.getFile().equals( - "/file.java")); + 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")); + 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")); + 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")); + assertEquals("4 returns a wrong protocol", + "http", u1.getProtocol()); + assertEquals("4 returns a wrong host", + "www.apache.org", u1.getHost()); assertTrue("4 returns a wrong port", u1.getPort() == -1); - assertTrue("4 returns a wrong file", u1.getFile().equals( - "/testing/file.java")); + 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")); + assertEquals("4f returns a wrong protocol", + "file", u1f.getProtocol()); + assertEquals("4f returns a wrong host", + "www.apache.org", u1f.getHost()); assertTrue("4f returns a wrong port", u1f.getPort() == -1); - assertTrue("4f returns a wrong file", u1f.getFile().equals( - "/testing/file.java")); + 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")); + 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")); + 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")); + 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); assertTrue("4fd returns a wrong file", u1f.getFile().equals("")); @@ -426,115 +426,115 @@ 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")); + assertEquals("5 returns a wrong protocol", + "http", u1.getProtocol()); + assertEquals("5 returns a wrong host", + "www.apache.org", u1.getHost()); assertTrue("5 returns a wrong port", u1.getPort() == -1); - assertTrue("5 returns a wrong file", u1.getFile().equals( - "/file.java")); + 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")); + assertEquals("5f returns a wrong protocol", + "file", u1f.getProtocol()); + assertEquals("5f returns a wrong host", + "www.apache.org", u1f.getHost()); assertTrue("5f returns a wrong port", u1f.getPort() == -1); - assertTrue("5f returns a wrong file", u1f.getFile().equals( - "/file.java")); + 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")); + 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")); + 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")); + assertEquals("6 returns a wrong protocol", + "http", u1.getProtocol()); + assertEquals("6 returns a wrong host", + "www.apache.org", u1.getHost()); assertTrue("6 returns a wrong port", u1.getPort() == -1); - assertTrue("6 returns a wrong file", u1.getFile().equals( - "/file.java")); + 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")); + assertEquals("6f returns a wrong protocol", + "file", u1f.getProtocol()); + assertEquals("6f returns a wrong host", + "www.apache.org", u1f.getHost()); assertTrue("6f returns a wrong port", u1f.getPort() == -1); - assertTrue("6f returns a wrong file", u1f.getFile().equals( - "/file.java")); + 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")); + assertEquals("7 returns a wrong protocol", + "http", u1.getProtocol()); + assertEquals("7 returns a wrong host", + "www.apache.org", u1.getHost()); assertTrue("7 returns a wrong port", u1.getPort() == 8000); - assertTrue("7 returns a wrong file", u1.getFile().equals( - "/file.java")); + 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")); + 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")); + 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("")); assertNull("11 returns a wrong anchor", u1.getRef()); @@ -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,33 +578,33 @@ 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")); + assertEquals("1 returns a wrong protocol", + "http", u1.getProtocol()); + assertEquals("1 returns a wrong host", + "www.yahoo.com", u1.getHost()); assertTrue("1 returns a wrong port", u1.getPort() == -1); - assertTrue("1 returns a wrong file", u1.getFile().equals( - "/file.java")); + 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")); + 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")); + assertEquals("3 returns a wrong protocol", + "http", u1.getProtocol()); + assertEquals("3 returns a wrong host", + "www.yahoo.com", u1.getHost()); assertTrue("3 returns a wrong port", u1.getPort() == -1); - assertTrue("3 returns a wrong file", u1.getFile().equals( - "/dir1/dir2/../file.java")); + 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 @@ -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 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")); + assertEquals("SSIS returns a wrong protocol", + "http", u.getProtocol()); + assertEquals("SSIS returns a wrong host", + "www.yahoo.com", u.getHost()); 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 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")); + assertEquals("SSISH1 returns a wrong protocol", "http", u.getProtocol() + ); + assertEquals("SSISH1 returns a wrong host", + "www.yahoo.com", u.getHost()); 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 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")); + assertEquals("SSISH2 returns a wrong protocol", "http", u.getProtocol() + ); + assertEquals("SSISH2 returns a wrong host", + "www.yahoo.com", u.getHost()); 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 file", + "test.html", u.getFile()); assertTrue("SSISH2 returns a wrong anchor: " + u.getRef(), u .getRef().equals("foo")); } 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) { @@ -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")); + 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,19 +1027,19 @@ 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")); + assertEquals("wrong authority2", "home", url.getAuthority()); assertNull("wrong userInfo2", url.getUserInfo()); - assertTrue("wrong host2", url.getHost().equals("home")); - assertTrue("wrong file2", url.getFile().equals("/java")); - assertTrue("wrong path2", url.getPath().equals("/java")); + 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) { Index: modules/luni/src/test/java/tests/api/java/util/BitSetTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/util/BitSetTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/util/BitSetTest.java 2006-04-16 13:59:11.000000000 +0100 @@ -30,8 +30,8 @@ // 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("New BitSet had invalid string representation", "{}", bs + .toString()); } /** @@ -946,8 +946,8 @@ 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); @@ -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()); } /** @@ -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()); } /** Index: modules/luni/src/test/java/tests/api/java/util/CollectionsTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/util/CollectionsTest.java.orig 2006-04-16 11:47:21.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/util/CollectionsTest.java 2006-04-16 13:59:11.000000000 +0100 @@ -403,7 +403,7 @@ assertTrue("Fill modified list size", size == ll.size()); Iterator i = ll.iterator(); while (i.hasNext()) - assertTrue("Failed to fill elements", i.next().equals("k")); + assertEquals("Failed to fill elements", "k", i.next()); Collections.fill(ll, null); assertTrue("Fill with nulls modified list size", size == ll.size()); Index: modules/luni/src/test/java/tests/api/java/util/DateTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/util/DateTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/util/DateTest.java 2006-04-16 13:59:11.000000000 +0100 @@ -421,11 +421,11 @@ */ public void test_toGMTString() { // Test for method java.lang.String java.util.Date.toGMTString() - assertTrue("Did not convert epoch to GMT string correctly", new Date(0) - .toGMTString().equals("1 Jan 1970 00:00:00 GMT")); - assertTrue("Did not convert epoch + 1yr to GMT string correctly", - new Date((long) 365 * 24 * 60 * 60 * 1000).toGMTString() - .equals("1 Jan 1971 00:00:00 GMT")); + assertEquals("Did not convert epoch to GMT string correctly", "1 Jan 1970 00:00:00 GMT", new Date(0) + .toGMTString()); + assertEquals("Did not convert epoch + 1yr to GMT string correctly", + "1 Jan 1971 00:00:00 GMT", new Date((long) 365 * 24 * 60 * 60 * 1000).toGMTString() + ); } /** Index: modules/luni/src/test/java/tests/api/java/util/HashMapTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/util/HashMapTest.java.orig 2006-04-16 11:47:21.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/util/HashMapTest.java 2006-04-16 13:59:11.000000000 +0100 @@ -142,23 +142,23 @@ // get the keySet() and values() on the original Map Set keys = map.keySet(); Collection values = map.values(); - assertTrue("values() does not work", values.iterator().next().equals( - "value")); - assertTrue("keySet() does not work", keys.iterator().next().equals( - "key")); + assertEquals("values() does not work", + "value", values.iterator().next()); + assertEquals("keySet() does not work", + "key", keys.iterator().next()); AbstractMap map2 = (AbstractMap) map.clone(); map2.put("key", "value2"); Collection values2 = map2.values(); assertTrue("values() is identical", values2 != values); // values() and keySet() on the cloned() map should be different - assertTrue("values() was not cloned", values2.iterator().next().equals( - "value2")); + assertEquals("values() was not cloned", + "value2", values2.iterator().next()); map2.clear(); map2.put("key2", "value3"); Set key2 = map2.keySet(); assertTrue("keySet() is identical", key2 != keys); - assertTrue("keySet() was not cloned", key2.iterator().next().equals( - "key2")); + assertEquals("keySet() was not cloned", + "key2", key2.iterator().next()); } /** @@ -215,12 +215,12 @@ assertNull("Get returned non-null for non existent key", hm.get("T")); hm.put("T", "HELLO"); - assertTrue("Get returned incorecct value for existing key", hm.get("T") - .equals("HELLO")); + assertEquals("Get returned incorecct value for existing key", "HELLO", hm.get("T") + ); HashMap m = new HashMap(); m.put(null, "test"); - assertTrue("Failed with null key", m.get(null).equals("test")); + assertEquals("Failed with null key", "test", m.get(null)); assertNull("Failed with missing key matching null hash", m .get(new Integer(0))); @@ -306,17 +306,17 @@ // Test for method java.lang.Object // java.util.HashMap.put(java.lang.Object, java.lang.Object) hm.put("KEY", "VALUE"); - assertTrue("Failed to install key/value pair", hm.get("KEY").equals( - "VALUE")); + assertEquals("Failed to install key/value pair", + "VALUE", hm.get("KEY")); HashMap m = new HashMap(); m.put(new Short((short) 0), "short"); m.put(null, "test"); m.put(new Integer(0), "int"); - assertTrue("Failed adding to bucket containing null", m.get( - new Short((short) 0)).equals("short")); - assertTrue("Failed adding to bucket containing null2", m.get( - new Integer(0)).equals("int")); + assertEquals("Failed adding to bucket containing null", "short", m.get( + new Short((short) 0))); + assertEquals("Failed adding to bucket containing null2", "int", m.get( + new Integer(0))); } /** @@ -350,7 +350,7 @@ m.put(null, "test"); assertNull("Failed with same hash as null", m.remove(new Integer(0))); - assertTrue("Failed with null key", m.remove(null).equals("test")); + assertEquals("Failed with null key", "test", m.remove(null)); } /** Index: modules/luni/src/test/java/tests/api/java/util/HashtableTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/util/HashtableTest.java.orig 2006-04-16 11:47:21.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/util/HashtableTest.java 2006-04-16 13:59:11.000000000 +0100 @@ -243,8 +243,8 @@ assertTrue("Returned incorrect entry set", s2.contains(e .nextElement())); - assertTrue("Not synchronized", s.getClass().getName().equals( - "java.util.Collections$SynchronizedSet")); + assertEquals("Not synchronized", + "java.util.Collections$SynchronizedSet", s.getClass().getName()); boolean exception = false; try { @@ -274,8 +274,8 @@ // Test for method java.lang.Object // java.util.Hashtable.get(java.lang.Object) Hashtable h = hashtableClone(htfull); - assertTrue("Could not retrieve element", ((String) h.get("FKey 2")) - .equals("FVal 2")); + assertEquals("Could not retrieve element", "FVal 2", ((String) h.get("FKey 2")) + ); // Regression for HARMONY-262 @@ -391,8 +391,8 @@ assertTrue("Returned incorrect key set", s .contains(e.nextElement())); - assertTrue("Not synchronized", s.getClass().getName().equals( - "java.util.Collections$SynchronizedSet")); + assertEquals("Not synchronized", + "java.util.Collections$SynchronizedSet", s.getClass().getName()); Map map = new Hashtable(101); map.put(new Integer(1), "1"); @@ -595,8 +595,8 @@ public void test_toString() { // Test for method java.lang.String java.util.Hashtable.toString() Hashtable h = new Hashtable(); - assertTrue("Incorrect toString for Empty table", h.toString().equals( - "{}")); + assertEquals("Incorrect toString for Empty table", + "{}", h.toString()); h.put("one", "1"); h.put("two", h); @@ -616,8 +616,8 @@ while (e.hasMoreElements()) assertTrue("Returned incorrect values", c.contains(e.nextElement())); - assertTrue("Not synchronized", c.getClass().getName().equals( - "java.util.Collections$SynchronizedCollection")); + assertEquals("Not synchronized", + "java.util.Collections$SynchronizedCollection", c.getClass().getName()); Hashtable myHashtable = new Hashtable(); for (int i = 0; i < 100; i++) Index: modules/luni/src/test/java/tests/api/java/util/IdentityHashMapTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/util/IdentityHashMapTest.java.orig 2006-04-16 11:47:21.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/util/IdentityHashMapTest.java 2006-04-16 13:59:11.000000000 +0100 @@ -126,23 +126,23 @@ // get the keySet() and values() on the original Map Set keys = map.keySet(); Collection values = map.values(); - assertTrue("values() does not work", values.iterator().next().equals( - "value")); - assertTrue("keySet() does not work", keys.iterator().next().equals( - "key")); + assertEquals("values() does not work", + "value", values.iterator().next()); + assertEquals("keySet() does not work", + "key", keys.iterator().next()); AbstractMap map2 = (AbstractMap) map.clone(); map2.put("key", "value2"); Collection values2 = map2.values(); assertTrue("values() is identical", values2 != values); // values() and keySet() on the cloned() map should be different - assertTrue("values() was not cloned", values2.iterator().next().equals( - "value2")); + assertEquals("values() was not cloned", + "value2", values2.iterator().next()); map2.clear(); map2.put("key2", "value3"); Set key2 = map2.keySet(); assertTrue("keySet() is identical", key2 != keys); - assertTrue("keySet() was not cloned", key2.iterator().next().equals( - "key2")); + assertEquals("keySet() was not cloned", + "key2", key2.iterator().next()); } /** @@ -201,12 +201,12 @@ assertNull("Get returned non-null for non existent key", hm.get("T")); hm.put("T", "HELLO"); - assertTrue("Get returned incorecct value for existing key", hm.get("T") - .equals("HELLO")); + assertEquals("Get returned incorecct value for existing key", "HELLO", hm.get("T") + ); IdentityHashMap m = new IdentityHashMap(); m.put(null, "test"); - assertTrue("Failed with null key", m.get(null).equals("test")); + assertEquals("Failed with null key", "test", m.get(null)); assertNull("Failed with missing key matching null hash", m .get(new Integer(0))); } @@ -282,8 +282,8 @@ // Test for method java.lang.Object // java.util.IdentityHashMap.put(java.lang.Object, java.lang.Object) hm.put("KEY", "VALUE"); - assertTrue("Failed to install key/value pair", hm.get("KEY").equals( - "VALUE")); + assertEquals("Failed to install key/value pair", + "VALUE", hm.get("KEY")); IdentityHashMap m = new IdentityHashMap(); Short s0 = new Short((short) 0); @@ -291,10 +291,10 @@ m.put(null, "test"); Integer i0 = new Integer(0); m.put(i0, "int"); - assertTrue("Failed adding to bucket containing null", m.get(s0).equals( - "short")); - assertTrue("Failed adding to bucket containing null2", m.get(i0) - .equals("int")); + assertEquals("Failed adding to bucket containing null", + "short", m.get(s0)); + assertEquals("Failed adding to bucket containing null2", "int", m.get(i0) + ); } /** @@ -327,7 +327,7 @@ m.put(null, "test"); assertNull("Failed with same hash as null", m.remove(objArray[0])); - assertTrue("Failed with null key", m.remove(null).equals("test")); + assertEquals("Failed with null key", "test", m.remove(null)); } /** Index: modules/luni/src/test/java/tests/api/java/util/LinkedHashMapTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/util/LinkedHashMapTest.java.orig 2006-04-16 11:47:21.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/util/LinkedHashMapTest.java 2006-04-16 13:59:11.000000000 +0100 @@ -130,12 +130,12 @@ assertNull("Get returned non-null for non existent key", hm.get("T")); hm.put("T", "HELLO"); - assertTrue("Get returned incorecct value for existing key", hm.get("T") - .equals("HELLO")); + assertEquals("Get returned incorecct value for existing key", "HELLO", hm.get("T") + ); LinkedHashMap m = new LinkedHashMap(); m.put(null, "test"); - assertTrue("Failed with null key", m.get(null).equals("test")); + assertEquals("Failed with null key", "test", m.get(null)); assertNull("Failed with missing key matching null hash", m .get(new Integer(0))); } @@ -147,17 +147,17 @@ // Test for method java.lang.Object // java.util.LinkedHashMap.put(java.lang.Object, java.lang.Object) hm.put("KEY", "VALUE"); - assertTrue("Failed to install key/value pair", hm.get("KEY").equals( - "VALUE")); + assertEquals("Failed to install key/value pair", + "VALUE", hm.get("KEY")); LinkedHashMap m = new LinkedHashMap(); m.put(new Short((short) 0), "short"); m.put(null, "test"); m.put(new Integer(0), "int"); - assertTrue("Failed adding to bucket containing null", m.get( - new Short((short) 0)).equals("short")); - assertTrue("Failed adding to bucket containing null2", m.get( - new Integer(0)).equals("int")); + assertEquals("Failed adding to bucket containing null", "short", m.get( + new Short((short) 0))); + assertEquals("Failed adding to bucket containing null2", "int", m.get( + new Integer(0))); } /** @@ -286,7 +286,7 @@ m.put(null, "test"); assertNull("Failed with same hash as null", m.remove(new Integer(0))); - assertTrue("Failed with null key", m.remove(null).equals("test")); + assertEquals("Failed with null key", "test", m.remove(null)); } /** @@ -318,24 +318,24 @@ // get the keySet() and values() on the original Map Set keys = map.keySet(); Collection values = map.values(); - assertTrue("values() does not work", values.iterator().next().equals( - "value")); - assertTrue("keySet() does not work", keys.iterator().next().equals( - "key")); + assertEquals("values() does not work", + "value", values.iterator().next()); + assertEquals("keySet() does not work", + "key", keys.iterator().next()); AbstractMap map2 = (AbstractMap) map.clone(); map2.put("key", "value2"); Collection values2 = map2.values(); assertTrue("values() is identical", values2 != values); // values() and keySet() on the cloned() map should be different - assertTrue("values() was not cloned", values2.iterator().next().equals( - "value2")); + assertEquals("values() was not cloned", + "value2", values2.iterator().next()); map2.clear(); map2.put("key2", "value3"); Set key2 = map2.keySet(); assertTrue("keySet() is identical", key2 != keys); - assertTrue("keySet() was not cloned", key2.iterator().next().equals( - "key2")); + assertEquals("keySet() was not cloned", + "key2", key2.iterator().next()); } /** Index: modules/luni/src/test/java/tests/api/java/util/LinkedListTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/util/LinkedListTest.java.orig 2006-04-16 11:47:21.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/util/LinkedListTest.java 2006-04-16 13:59:11.000000000 +0100 @@ -110,11 +110,11 @@ myList.add(null); ll.addAll(50, myList); assertNull("a) List w/nulls not added correctly", ll.get(50)); - assertTrue("b) List w/nulls not added correctly", ll.get(51).equals( - "Blah")); + assertEquals("b) List w/nulls not added correctly", + "Blah", ll.get(51)); assertNull("c) List w/nulls not added correctly", ll.get(52)); - assertTrue("d) List w/nulls not added correctly", ll.get(53).equals( - "Booga")); + assertEquals("d) List w/nulls not added correctly", + "Booga", ll.get(53)); assertNull("e) List w/nulls not added correctly", ll.get(54)); } @@ -146,11 +146,11 @@ myList.add(null); ll.addAll(myList); assertNull("a) List w/nulls not added correctly", ll.get(200)); - assertTrue("b) List w/nulls not added correctly", ll.get(201).equals( - "Blah")); + assertEquals("b) List w/nulls not added correctly", + "Blah", ll.get(201)); assertNull("c) List w/nulls not added correctly", ll.get(202)); - assertTrue("d) List w/nulls not added correctly", ll.get(203).equals( - "Booga")); + assertEquals("d) List w/nulls not added correctly", + "Booga", ll.get(203)); assertNull("e) List w/nulls not added correctly", ll.get(204)); } @@ -326,9 +326,9 @@ assertTrue("li.hasPrevious() should be true", li.hasPrevious()); assertNull("li.prev() should be null", li.previous()); assertNull("li.next() should be null", li.next()); - assertTrue("li.next() should be Blah", li.next().equals("Blah")); + assertEquals("li.next() should be Blah", "Blah", li.next()); assertNull("li.next() should be null", li.next()); - assertTrue("li.next() should be Booga", li.next().equals("Booga")); + assertEquals("li.next() should be Booga", "Booga", li.next()); assertTrue("li.hasNext() should be true", li.hasNext()); assertNull("li.next() should be null", li.next()); assertTrue("li.hasNext() should be false", !li.hasNext()); Index: modules/luni/src/test/java/tests/api/java/util/LocaleTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/util/LocaleTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/util/LocaleTest.java 2006-04-16 11:47:22.000000000 +0100 @@ -99,7 +99,7 @@ Locale.setDefault(l); Locale x = Locale.getDefault(); Locale.setDefault(org); - assertTrue("Failed to get locale", x.toString().equals("fr_CA_WIN32")); + assertEquals("Failed to get locale", "fr_CA_WIN32", x.toString()); } /** @@ -118,8 +118,8 @@ public void test_getDisplayCountryLjava_util_Locale() { // Test for method java.lang.String // java.util.Locale.getDisplayCountry(java.util.Locale) - assertTrue("Returned incorrect country", Locale.ITALY - .getDisplayCountry(l).equals("Italie")); + assertEquals("Returned incorrect country", "Italie", Locale.ITALY + .getDisplayCountry(l)); } /** @@ -272,14 +272,14 @@ Locale.setDefault(l); Locale x = Locale.getDefault(); Locale.setDefault(org); - assertTrue("Failed to set locale", x.toString().equals("fr_CA_WIN32")); + assertEquals("Failed to set locale", "fr_CA_WIN32", x.toString()); Locale.setDefault(new Locale("tr", "")); String res1 = "\u0069".toUpperCase(); String res2 = "\u0049".toLowerCase(); Locale.setDefault(org); - assertTrue("Wrong toUppercase conversion", res1.equals("\u0130")); - assertTrue("Wrong toLowercase conversion", res2.equals("\u0131")); + assertEquals("Wrong toUppercase conversion", "\u0130", res1); + assertEquals("Wrong toLowercase conversion", "\u0131", res2); } /** @@ -287,21 +287,21 @@ */ public void test_toString() { // Test for method java.lang.String java.util.Locale.toString() - assertTrue("Returned incorrect string representation", testLocale - .toString().equals("en_CA_WIN32")); + assertEquals("Returned incorrect string representation", "en_CA_WIN32", testLocale + .toString()); Locale l = new Locale("en", ""); - assertTrue("Wrong representation 1", l.toString().equals("en")); + assertEquals("Wrong representation 1", "en", l.toString()); l = new Locale("", "CA"); - assertTrue("Wrong representation 2", l.toString().equals("_CA")); + assertEquals("Wrong representation 2", "_CA", l.toString()); l = new Locale("", "CA", "var"); - assertTrue("Wrong representation 2.5", l.toString().equals("_CA_var")); + assertEquals("Wrong representation 2.5", "_CA_var", l.toString()); l = new Locale("en", "", "WIN"); - assertTrue("Wrong representation 4", l.toString().equals("en__WIN")); + assertEquals("Wrong representation 4", "en__WIN", l.toString()); l = new Locale("en", "CA"); - assertTrue("Wrong representation 6", l.toString().equals("en_CA")); + assertEquals("Wrong representation 6", "en_CA", l.toString()); l = new Locale("en", "CA", "VAR"); - assertTrue("Wrong representation 7", l.toString().equals("en_CA_VAR")); + assertEquals("Wrong representation 7", "en_CA_VAR", l.toString()); } /** Index: modules/luni/src/test/java/tests/api/java/util/MissingResourceExceptionTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/util/MissingResourceExceptionTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/util/MissingResourceExceptionTest.java 2006-04-16 11:47:22.000000000 +0100 @@ -44,8 +44,8 @@ try { ResourceBundle.getBundle("Non-ExistentBundle"); } catch (MissingResourceException e) { - assertTrue("Returned incorrect class name", e.getClassName() - .equals("Non-ExistentBundle")); + assertEquals("Returned incorrect class name", "Non-ExistentBundle", e.getClassName() + ); } } Index: modules/luni/src/test/java/tests/api/java/util/PropertiesTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/util/PropertiesTest.java.orig 2006-04-16 11:47:21.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/util/PropertiesTest.java 2006-04-16 11:47:22.000000000 +0100 @@ -66,8 +66,8 @@ public void test_getPropertyLjava_lang_String() { // Test for method java.lang.String // java.util.Properties.getProperty(java.lang.String) - assertTrue("Did not retrieve property", ((String) tProps - .getProperty("test.prop")).equals("this is a test property")); + assertEquals("Did not retrieve property", "this is a test property", ((String) tProps + .getProperty("test.prop"))); } /** @@ -77,10 +77,10 @@ public void test_getPropertyLjava_lang_StringLjava_lang_String() { // Test for method java.lang.String // java.util.Properties.getProperty(java.lang.String, java.lang.String) - assertTrue("Did not retrieve property", ((String) tProps.getProperty( - "test.prop", "Blarg")).equals("this is a test property")); - assertTrue("Did not return default value", ((String) tProps - .getProperty("notInThere.prop", "Gabba")).equals("Gabba")); + assertEquals("Did not retrieve property", "this is a test property", ((String) tProps.getProperty( + "test.prop", "Blarg"))); + assertEquals("Did not return default value", "Gabba", ((String) tProps + .getProperty("notInThere.prop", "Gabba"))); } /** @@ -135,8 +135,8 @@ } catch (Exception e) { fail("Exception during load test : " + e.getMessage()); } - assertTrue("Failed to load correct properties", prop.getProperty( - "test.pkg").equals("harmony.tests")); + assertEquals("Failed to load correct properties", "harmony.tests", prop.getProperty( + "test.pkg")); assertNull("Load failed to parse incorrectly", prop .getProperty("commented.entry")); @@ -159,15 +159,15 @@ prop.load(new ByteArrayInputStream(" a= b".getBytes())); } catch (IOException e) { } - assertTrue("Failed to ignore whitespace", prop.get("a").equals("b")); + assertEquals("Failed to ignore whitespace", "b", prop.get("a")); prop = new Properties(); try { prop.load(new ByteArrayInputStream(" a b".getBytes())); } catch (IOException e) { } - assertTrue("Failed to interpret whitespace as =", prop.get("a").equals( - "b")); + assertEquals("Failed to interpret whitespace as =", + "b", prop.get("a")); prop = new Properties(); try { @@ -175,8 +175,8 @@ .getBytes("ISO8859_1"))); } catch (IOException e) { } - assertTrue("Failed to parse chars >= 0x80", prop.get("a").equals( - "\u008d\u00d3")); + assertEquals("Failed to parse chars >= 0x80", + "\u008d\u00d3", prop.get("a")); prop = new Properties(); try { @@ -187,8 +187,8 @@ } catch (IndexOutOfBoundsException e) { fail("IndexOutOfBoundsException when last line is a comment with no line terminator"); } - assertTrue("Failed to load when last line contains a comment", prop - .get("fred").equals("1")); + assertEquals("Failed to load when last line contains a comment", "1", prop + .get("fred")); } /** @@ -282,11 +282,11 @@ // java.util.Properties.setProperty(java.lang.String, java.lang.String) Properties myProps = new Properties(); myProps.setProperty("Yoink", "Yabba"); - assertTrue("Failed to set property", myProps.getProperty("Yoink") - .equals("Yabba")); + assertEquals("Failed to set property", "Yabba", myProps.getProperty("Yoink") + ); myProps.setProperty("Yoink", "Gab"); - assertTrue("Failed to reset property", myProps.getProperty("Yoink") - .equals("Gab")); + assertEquals("Failed to reset property", "Gab", myProps.getProperty("Yoink") + ); } /** Index: modules/luni/src/test/java/tests/api/java/util/PropertyPermissionTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/util/PropertyPermissionTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/util/PropertyPermissionTest.java 2006-04-16 14:00:48.000000000 +0100 @@ -63,11 +63,10 @@ public void test_getActions() { // Test for method java.lang.String // java.util.PropertyPermission.getActions() - assertTrue("getActions did not return proper action", javaPP - .getActions().equals("read")); - assertTrue( - "getActions did not return proper canonical representation of actions", - userPP.getActions().equals("read,write")); + assertEquals("getActions did not return proper action", "read", javaPP + .getActions()); + assertEquals("getActions did not return proper canonical representation of actions", + "read,write", userPP.getActions()); } /** Index: modules/luni/src/test/java/tests/api/java/util/ResourceBundleTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/util/ResourceBundleTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/util/ResourceBundleTest.java 2006-04-16 11:47:22.000000000 +0100 @@ -39,27 +39,27 @@ Locale.setDefault(new Locale("en", "US")); bundle = ResourceBundle.getBundle(name, new Locale("fr", "FR", "VAR")); - assertTrue("Wrong bundle fr_FR_VAR", bundle.getString("parent4") - .equals("frFRVARValue4")); + assertEquals("Wrong bundle fr_FR_VAR", "frFRVARValue4", bundle.getString("parent4") + ); bundle = ResourceBundle.getBundle(name, new Locale("fr", "FR", "v1")); - assertTrue("Wrong bundle fr_FR_v1", bundle.getString("parent4").equals( - "frFRValue4")); + assertEquals("Wrong bundle fr_FR_v1", + "frFRValue4", bundle.getString("parent4")); bundle = ResourceBundle.getBundle(name, new Locale("fr", "US", "VAR")); - assertTrue("Wrong bundle fr_US_var", bundle.getString("parent4") - .equals("frValue4")); + assertEquals("Wrong bundle fr_US_var", "frValue4", bundle.getString("parent4") + ); bundle = ResourceBundle.getBundle(name, new Locale("de", "FR", "VAR")); - assertTrue("Wrong bundle de_FR_var", bundle.getString("parent4") - .equals("enUSValue4")); + assertEquals("Wrong bundle de_FR_var", "enUSValue4", bundle.getString("parent4") + ); Locale.setDefault(new Locale("fr", "FR", "VAR")); bundle = ResourceBundle.getBundle(name, new Locale("de", "FR", "v1")); - assertTrue("Wrong bundle de_FR_var 2", bundle.getString("parent4") - .equals("frFRVARValue4")); + assertEquals("Wrong bundle de_FR_var 2", "frFRVARValue4", bundle.getString("parent4") + ); Locale.setDefault(new Locale("de", "US")); bundle = ResourceBundle.getBundle(name, new Locale("de", "FR", "var")); - assertTrue("Wrong bundle de_FR_var 2", bundle.getString("parent4") - .equals("parentValue4")); + assertEquals("Wrong bundle de_FR_var 2", "parentValue4", bundle.getString("parent4") + ); // Test with a security manager Locale.setDefault(new Locale("en", "US")); @@ -67,16 +67,16 @@ try { bundle = ResourceBundle.getBundle(name, new Locale("fr", "FR", "VAR")); - assertTrue("Security: Wrong bundle fr_FR_VAR", bundle.getString( - "parent4").equals("frFRVARValue4")); + assertEquals("Security: Wrong bundle fr_FR_VAR", "frFRVARValue4", bundle.getString( + "parent4")); bundle = ResourceBundle.getBundle(name, new Locale("fr", "FR", "v1")); - assertTrue("Security: Wrong bundle fr_FR_v1", bundle.getString( - "parent4").equals("frFRValue4")); + assertEquals("Security: Wrong bundle fr_FR_v1", "frFRValue4", bundle.getString( + "parent4")); bundle = ResourceBundle.getBundle(name, new Locale("fr", "US", "VAR")); - assertTrue("Security: Wrong bundle fr_US_var", bundle.getString( - "parent4").equals("frValue4")); + assertEquals("Security: Wrong bundle fr_US_var", "frValue4", bundle.getString( + "parent4")); bundle = ResourceBundle.getBundle(name, new Locale("de", "FR", "VAR")); assertTrue("Security: Wrong bundle de_FR_var: " @@ -120,8 +120,8 @@ ResourceBundle bundle = ResourceBundle.getBundle(name, Locale .getDefault()); bundle = ResourceBundle.getBundle(name, Locale.getDefault(), loader); - assertTrue("Wrong cached value", bundle.getString("property").equals( - "resource")); + assertEquals("Wrong cached value", + "resource", bundle.getString("property")); } /** @@ -132,20 +132,20 @@ String name = "tests.support.Support_TestResource"; Locale.setDefault(new Locale("en", "US")); bundle = ResourceBundle.getBundle(name, new Locale("fr", "FR", "VAR")); - assertTrue("Wrong value parent4", bundle.getString("parent4").equals( - "frFRVARValue4")); - assertTrue("Wrong value parent3", bundle.getString("parent3").equals( - "frFRValue3")); - assertTrue("Wrong value parent2", bundle.getString("parent2").equals( - "frValue2")); - assertTrue("Wrong value parent1", bundle.getString("parent1").equals( - "parentValue1")); - assertTrue("Wrong value child3", bundle.getString("child3").equals( - "frFRVARChildValue3")); - assertTrue("Wrong value child2", bundle.getString("child2").equals( - "frFRVARChildValue2")); - assertTrue("Wrong value child1", bundle.getString("child1").equals( - "frFRVARChildValue1")); + assertEquals("Wrong value parent4", + "frFRVARValue4", bundle.getString("parent4")); + assertEquals("Wrong value parent3", + "frFRValue3", bundle.getString("parent3")); + assertEquals("Wrong value parent2", + "frValue2", bundle.getString("parent2")); + assertEquals("Wrong value parent1", + "parentValue1", bundle.getString("parent1")); + assertEquals("Wrong value child3", + "frFRVARChildValue3", bundle.getString("child3")); + assertEquals("Wrong value child2", + "frFRVARChildValue2", bundle.getString("child2")); + assertEquals("Wrong value child1", + "frFRVARChildValue1", bundle.getString("child1")); } protected void setUp() { Index: modules/luni/src/test/java/tests/api/java/util/SimpleTimeZoneTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/util/SimpleTimeZoneTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/util/SimpleTimeZoneTest.java 2006-04-16 13:59:11.000000000 +0100 @@ -34,7 +34,7 @@ // Test for method java.util.SimpleTimeZone(int, java.lang.String) SimpleTimeZone st = new SimpleTimeZone(1000, "TEST"); - assertTrue("Incorrect TZ constructed", st.getID().equals("TEST")); + assertEquals("Incorrect TZ constructed", "TEST", st.getID()); assertTrue("Incorrect TZ constructed: " + "returned wrong offset", st .getRawOffset() == 1000); assertTrue("Incorrect TZ constructed" + "using daylight savings", !st @@ -57,7 +57,7 @@ assertTrue("Incorrect TZ constructed", !(st .inDaylightTime(new GregorianCalendar(1998, Calendar.OCTOBER, 13).getTime()))); - assertTrue("Incorrect TZ constructed", st.getID().equals("TEST")); + assertEquals("Incorrect TZ constructed", "TEST", st.getID()); assertTrue("Incorrect TZ constructed", st.getRawOffset() == 1000); assertTrue("Incorrect TZ constructed", st.useDaylightTime()); } @@ -78,7 +78,7 @@ assertTrue("Incorrect TZ constructed", !(st .inDaylightTime(new GregorianCalendar(1998, Calendar.OCTOBER, 13).getTime()))); - assertTrue("Incorrect TZ constructed", st.getID().equals("TEST")); + assertEquals("Incorrect TZ constructed", "TEST", st.getID()); assertTrue("Incorrect TZ constructed", st.getRawOffset() == 1000); assertTrue("Incorrect TZ constructed", st.useDaylightTime()); assertTrue("Incorrect TZ constructed", Index: modules/luni/src/test/java/tests/api/java/util/StringTokenizerTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/util/StringTokenizerTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/util/StringTokenizerTest.java 2006-04-16 14:00:48.000000000 +0100 @@ -105,16 +105,16 @@ // Test for method java.lang.Object // java.util.StringTokenizer.nextElement() StringTokenizer st = new StringTokenizer("This is a test String"); - assertTrue("nextElement returned incorrect value", ((String) st - .nextElement()).equals("This")); - assertTrue("nextElement returned incorrect value", ((String) st - .nextElement()).equals("is")); - assertTrue("nextElement returned incorrect value", ((String) st - .nextElement()).equals("a")); - assertTrue("nextElement returned incorrect value", ((String) st - .nextElement()).equals("test")); - assertTrue("nextElement returned incorrect value", ((String) st - .nextElement()).equals("String")); + assertEquals("nextElement returned incorrect value", "This", ((String) st + .nextElement())); + assertEquals("nextElement returned incorrect value", "is", ((String) st + .nextElement())); + assertEquals("nextElement returned incorrect value", "a", ((String) st + .nextElement())); + assertEquals("nextElement returned incorrect value", "test", ((String) st + .nextElement())); + assertEquals("nextElement returned incorrect value", "String", ((String) st + .nextElement())); try { st.nextElement(); fail( @@ -131,16 +131,16 @@ // Test for method java.lang.String // java.util.StringTokenizer.nextToken() StringTokenizer st = new StringTokenizer("This is a test String"); - assertTrue("nextToken returned incorrect value", st.nextToken().equals( - "This")); - assertTrue("nextToken returned incorrect value", st.nextToken().equals( - "is")); - assertTrue("nextToken returned incorrect value", st.nextToken().equals( - "a")); - assertTrue("nextToken returned incorrect value", st.nextToken().equals( - "test")); - assertTrue("nextToken returned incorrect value", st.nextToken().equals( - "String")); + assertEquals("nextToken returned incorrect value", + "This", st.nextToken()); + assertEquals("nextToken returned incorrect value", + "is", st.nextToken()); + assertEquals("nextToken returned incorrect value", + "a", st.nextToken()); + assertEquals("nextToken returned incorrect value", + "test", st.nextToken()); + assertEquals("nextToken returned incorrect value", + "String", st.nextToken()); try { st.nextToken(); fail( @@ -157,15 +157,12 @@ // Test for method java.lang.String // java.util.StringTokenizer.nextToken(java.lang.String) StringTokenizer st = new StringTokenizer("This is a test String"); - assertTrue( - "nextToken(String) returned incorrect value with normal token String", - st.nextToken(" ").equals("This")); - assertTrue( - "nextToken(String) returned incorrect value with custom token String", - st.nextToken("tr").equals(" is a ")); - assertTrue( - "calling nextToken() did not use the new default delimiter list", - st.nextToken().equals("es")); + assertEquals("nextToken(String) returned incorrect value with normal token String", + "This", st.nextToken(" ")); + assertEquals("nextToken(String) returned incorrect value with custom token String", + " is a ", st.nextToken("tr")); + assertEquals("calling nextToken() did not use the new default delimiter list", + "es", st.nextToken()); } /** Index: modules/luni/src/test/java/tests/api/java/util/TooManyListenersExceptionTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/util/TooManyListenersExceptionTest.java.orig 2006-04-16 11:47:21.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/util/TooManyListenersExceptionTest.java 2006-04-16 11:47:22.000000000 +0100 @@ -41,8 +41,8 @@ try { throw new TooManyListenersException("Gah"); } catch (TooManyListenersException e) { - assertTrue("Incorrect message thrown with exception", e - .getMessage().equals("Gah")); + assertEquals("Incorrect message thrown with exception", "Gah", e + .getMessage()); } } Index: modules/luni/src/test/java/tests/api/java/util/TreeMapTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/util/TreeMapTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/util/TreeMapTest.java 2006-04-16 13:59:11.000000000 +0100 @@ -132,23 +132,23 @@ // get the keySet() and values() on the original Map Set keys = map.keySet(); Collection values = map.values(); - assertTrue("values() does not work", values.iterator().next().equals( - "value")); - assertTrue("keySet() does not work", keys.iterator().next().equals( - "key")); + assertEquals("values() does not work", + "value", values.iterator().next()); + assertEquals("keySet() does not work", + "key", keys.iterator().next()); AbstractMap map2 = (AbstractMap) map.clone(); map2.put("key", "value2"); Collection values2 = map2.values(); assertTrue("values() is identical", values2 != values); // values() and keySet() on the cloned() map should be different - assertTrue("values() was not cloned", values2.iterator().next().equals( - "value2")); + assertEquals("values() was not cloned", + "value2", values2.iterator().next()); map2.clear(); map2.put("key2", "value3"); Set key2 = map2.keySet(); assertTrue("keySet() is identical", key2 != keys); - assertTrue("keySet() was not cloned", key2.iterator().next().equals( - "key2")); + assertEquals("keySet() was not cloned", + "key2", key2.iterator().next()); } /** @@ -212,7 +212,7 @@ */ public void test_firstKey() { // Test for method java.lang.Object java.util.TreeMap.firstKey() - assertTrue("Returned incorrect first key", tm.firstKey().equals("0")); + assertEquals("Returned incorrect first key", "0", tm.firstKey()); } /** Index: modules/luni/src/test/java/tests/api/java/util/VectorTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/util/VectorTest.java.orig 2006-04-16 11:47:21.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/util/VectorTest.java 2006-04-16 13:59:11.000000000 +0100 @@ -172,8 +172,8 @@ tVector.addAll(50, l); assertNull("Wrong element at position 50--wanted null", tVector.get(50)); - assertTrue("Wrong element at position 51--wanted 'gah'", tVector - .get(51).equals("gah")); + assertEquals("Wrong element at position 51--wanted 'gah'", "gah", tVector + .get(51)); assertNull("Wrong element at position 52--wanted null", tVector.get(52)); } @@ -203,8 +203,8 @@ tVector.addAll(l); assertNull("Wrong element at 3rd last position--wanted null", tVector .get(vSize)); - assertTrue("Wrong element at 2nd last position--wanted 'gah'", tVector - .get(vSize + 1).equals("gah")); + assertEquals("Wrong element at 2nd last position--wanted 'gah'", "gah", tVector + .get(vSize + 1)); assertNull("Wrong element at last position--wanted null", tVector .get(vSize + 2)); } @@ -217,8 +217,8 @@ Vector v = vectorClone(tVector); v.addElement("Added Element"); assertTrue("Failed to add element", v.contains("Added Element")); - assertTrue("Added Element to wrong slot", ((String) v.elementAt(100)) - .equals("Added Element")); + assertEquals("Added Element to wrong slot", "Added Element", ((String) v.elementAt(100)) + ); v.addElement(null); assertTrue("Failed to add null", v.contains(null)); assertNull("Added null to wrong slot", v.elementAt(101)); @@ -232,8 +232,8 @@ Vector v = vectorClone(tVector); v.addElement("Added Element"); assertTrue("Failed to add element", v.contains("Added Element")); - assertTrue("Added Element to wrong slot", ((String) v.elementAt(100)) - .equals("Added Element")); + assertEquals("Added Element to wrong slot", "Added Element", ((String) v.elementAt(100)) + ); v.addElement(null); assertTrue("Failed to add null", v.contains(null)); assertNull("Added null to wrong slot", v.elementAt(101)); @@ -350,8 +350,8 @@ */ public void test_elementAtI() { // Test for method java.lang.Object java.util.Vector.elementAt(int) - assertTrue("Incorrect element returned", ((String) tVector - .elementAt(18)).equals("Test 18")); + assertEquals("Incorrect element returned", "Test 18", ((String) tVector + .elementAt(18))); tVector.setElementAt(null, 20); assertNull("Incorrect element returned--wanted null", tVector .elementAt(20)); @@ -441,8 +441,8 @@ */ public void test_firstElement() { // Test for method java.lang.Object java.util.Vector.firstElement() - assertTrue("Returned incorrect firstElement", tVector.firstElement() - .equals("Test 0")); + assertEquals("Returned incorrect firstElement", "Test 0", tVector.firstElement() + ); tVector.insertElementAt(null, 0); assertNull("Returned incorrect firstElement--wanted null", tVector .firstElement()); @@ -453,8 +453,8 @@ */ public void test_getI() { // Test for method java.lang.Object java.util.Vector.get(int) - assertTrue("Get returned incorrect object", tVector.get(80).equals( - "Test 80")); + assertEquals("Get returned incorrect object", + "Test 80", tVector.get(80)); tVector.add(25, null); assertNull("Returned incorrect element--wanted null", tVector.get(25)); @@ -516,8 +516,8 @@ Vector v = vectorClone(tVector); String prevElement = (String) v.elementAt(99); v.insertElementAt("Inserted Element", 99); - assertTrue("Element not inserted", ((String) v.elementAt(99)) - .equals("Inserted Element")); + assertEquals("Element not inserted", "Inserted Element", ((String) v.elementAt(99)) + ); assertTrue("Elements shifted incorrectly", ((String) v.elementAt(100)) .equals(prevElement)); v.insertElementAt(null, 20); @@ -571,8 +571,8 @@ */ public void test_lastElement() { // Test for method java.lang.Object java.util.Vector.lastElement() - assertTrue("Incorrect last element returned", tVector.lastElement() - .equals("Test 99")); + assertEquals("Incorrect last element returned", "Test 99", tVector.lastElement() + ); tVector.addElement(null); assertNull("Incorrect last element returned--wanted null", tVector .lastElement()); @@ -680,7 +680,7 @@ l.add(null); v.removeAll(l); assertTrue("Should only have one element", v.size() == 1); - assertTrue("Element should be 'Boom'", v.firstElement().equals("Boom")); + assertEquals("Element should be 'Boom'", "Boom", v.firstElement()); } /** @@ -701,8 +701,8 @@ // java.util.Vector.removeElement(java.lang.Object) Vector v = vectorClone(tVector); v.removeElement("Test 98"); - assertTrue("Element not removed", ((String) v.elementAt(98)) - .equals("Test 99")); + assertEquals("Element not removed", "Test 99", ((String) v.elementAt(98)) + ); assertTrue("Vector is wrong size after removal: " + v.size(), v.size() == 99); tVector.addElement(null); @@ -760,8 +760,8 @@ // int) Vector v = vectorClone(tVector); v.setElementAt("Inserted Element", 99); - assertTrue("Element not set", ((String) v.elementAt(99)) - .equals("Inserted Element")); + assertEquals("Element not set", "Inserted Element", ((String) v.elementAt(99)) + ); } /** @@ -819,8 +819,8 @@ assertTrue("Returned incorrect sublist", sl .contains(tVector.get(i))); - assertTrue("Not synchronized random access", sl.getClass().getName() - .equals("java.util.Collections$SynchronizedRandomAccessList")); + assertEquals("Not synchronized random access", "java.util.Collections$SynchronizedRandomAccessList", sl.getClass().getName() + ); } Index: modules/math/src/test/java/org/apache/harmony/tests/java/math/BigDecimalArithmeticTest.java =================================================================== --- modules/math/src/test/java/org/apache/harmony/tests/java/math/BigDecimalArithmeticTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/math/src/test/java/org/apache/harmony/tests/java/math/BigDecimalArithmeticTest.java 2006-04-16 11:47:22.000000000 +0100 @@ -262,7 +262,7 @@ BigDecimal result = aNumber.divide(bNumber, BigDecimal.ROUND_UNNECESSARY); fail("ArithmeticException has not been caught"); } catch (ArithmeticException e) { - assertTrue("Improper exception message", e.getMessage().equals("division by zero")); + assertEquals("Improper exception message", "division by zero", e.getMessage()); } } @@ -280,7 +280,7 @@ BigDecimal result = aNumber.divide(bNumber, BigDecimal.ROUND_UNNECESSARY); fail("ArithmeticException has not been caught"); } catch (ArithmeticException e) { - assertTrue("Improper exception message", e.getMessage().equals("rounding mode is ROUND_UNNECESSARY but the result is not exact")); + assertEquals("Improper exception message", "rounding mode is ROUND_UNNECESSARY but the result is not exact", e.getMessage()); } } @@ -298,7 +298,7 @@ BigDecimal result = aNumber.divide(bNumber, 100); fail("IllegalArgumentException has not been caught"); } catch (IllegalArgumentException e) { - assertTrue("Improper exception message", e.getMessage().equals("invalid rounding mode")); + assertEquals("Improper exception message", "invalid rounding mode", e.getMessage()); } } Index: modules/math/src/test/java/org/apache/harmony/tests/java/math/BigDecimalConstructorsTest.java =================================================================== --- modules/math/src/test/java/org/apache/harmony/tests/java/math/BigDecimalConstructorsTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/math/src/test/java/org/apache/harmony/tests/java/math/BigDecimalConstructorsTest.java 2006-04-16 13:59:11.000000000 +0100 @@ -91,7 +91,7 @@ BigDecimal aNumber = new BigDecimal(a); fail("NumberFormatException has not been caught"); } catch (NumberFormatException e) { - assertTrue("Improper exception message", e.getMessage().equals("argument is NaN")); + assertEquals("Improper exception message", "argument is NaN", e.getMessage()); } } @@ -104,7 +104,7 @@ BigDecimal aNumber = new BigDecimal(a); fail("NumberFormatException has not been caught"); } catch (NumberFormatException e) { - assertTrue("Improper exception message", e.getMessage().equals("argument is infinite")); + assertEquals("Improper exception message", "argument is infinite", e.getMessage()); } } @@ -117,7 +117,7 @@ BigDecimal aNumber = new BigDecimal(a); fail("NumberFormatException has not been caught"); } catch (NumberFormatException e) { - assertTrue("Improper exception message", e.getMessage().equals("argument is infinite")); + assertEquals("Improper exception message", "argument is infinite", e.getMessage()); } } @@ -204,7 +204,7 @@ BigDecimal aNumber = new BigDecimal(a); fail("NumberFormatException has not been caught"); } catch (NumberFormatException e) { - assertTrue("Improper exception message", e.getMessage().equals("empty exponent")); + assertEquals("Improper exception message", "empty exponent", e.getMessage()); } } @@ -218,7 +218,7 @@ BigDecimal aNumber = new BigDecimal(a); fail("NumberFormatException has not been caught"); } catch (NumberFormatException e) { - assertTrue("Improper exception message", e.getMessage().equals("empty exponent")); + assertEquals("Improper exception message", "empty exponent", e.getMessage()); } } @@ -232,7 +232,7 @@ BigDecimal aNumber = new BigDecimal(a); fail("NumberFormatException has not been caught"); } catch (NumberFormatException e) { - assertTrue("Improper exception message", e.getMessage().equals("exponent is not signed integer")); + assertEquals("Improper exception message", "exponent is not signed integer", e.getMessage()); } } @@ -246,7 +246,7 @@ BigDecimal aNumber = new BigDecimal(a); fail("NumberFormatException has not been caught"); } catch (NumberFormatException e) { - assertTrue("Improper exception message", e.getMessage().equals("exponent is not signed integer")); + assertEquals("Improper exception message", "exponent is not signed integer", e.getMessage()); } } @@ -274,8 +274,8 @@ try { BigDecimal aNumber = new BigDecimal(a); } catch (NumberFormatException e) { - assertTrue("Improper exception message", - e.getMessage().equals("resulting scale out of range")); + assertEquals("Improper exception message", + "resulting scale out of range", e.getMessage()); } } Index: modules/math/src/test/java/org/apache/harmony/tests/java/math/BigDecimalScaleOperationsTest.java =================================================================== --- modules/math/src/test/java/org/apache/harmony/tests/java/math/BigDecimalScaleOperationsTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/math/src/test/java/org/apache/harmony/tests/java/math/BigDecimalScaleOperationsTest.java 2006-04-16 13:59:11.000000000 +0100 @@ -319,7 +319,7 @@ BigDecimal bNumber = aNumber.movePointRight(shift); fail("ArithmeticException has not been caught"); } catch (ArithmeticException e) { - assertTrue("Improper exception message", e.getMessage().equals("scale outside the range of a 32-bit integer")); + assertEquals("Improper exception message", "scale outside the range of a 32-bit integer", e.getMessage()); } } } Index: modules/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerCompareTest.java =================================================================== --- modules/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerCompareTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerCompareTest.java 2006-04-16 13:59:11.000000000 +0100 @@ -253,7 +253,7 @@ int result = aNumber.compareTo(obj); fail("ClassCastException has not been caught"); } catch (ClassCastException e) { - assertTrue("Improper exception class", e.getClass().getName().equals("java.lang.ClassCastException")); + assertEquals("Improper exception class", "java.lang.ClassCastException", e.getClass().getName()); } } Index: modules/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerConstructorsTest.java =================================================================== --- modules/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerConstructorsTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerConstructorsTest.java 2006-04-16 13:59:11.000000000 +0100 @@ -40,7 +40,7 @@ BigInteger aNumber = new BigInteger(aBytes); fail("NumberFormatException has not been caught"); } catch (NumberFormatException e) { - assertTrue("Improper exception message", e.getMessage().equals("zero length array")); + assertEquals("Improper exception message", "zero length array", e.getMessage()); } } @@ -198,7 +198,7 @@ BigInteger aNumber = new BigInteger(aSign, aBytes); fail("NumberFormatException has not been caught"); } catch (NumberFormatException e) { - assertTrue("Improper exception message", e.getMessage().equals("sign must be -1, 0, or 1")); + assertEquals("Improper exception message", "sign must be -1, 0, or 1", e.getMessage()); } } @@ -213,7 +213,7 @@ BigInteger aNumber = new BigInteger(aSign, aBytes); fail("NumberFormatException has not been caught"); } catch (NumberFormatException e) { - assertTrue("Improper exception message", e.getMessage().equals("zero sign with non-zero magnitude")); + assertEquals("Improper exception message", "zero sign with non-zero magnitude", e.getMessage()); } } @@ -580,7 +580,7 @@ BigInteger aNumber = new BigInteger(value, radix); fail("NumberFormatException has not been caught"); } catch (NumberFormatException e) { - assertTrue("Improper exception message", e.getMessage().equals("radix is out of range")); + assertEquals("Improper exception message", "radix is out of range", e.getMessage()); } } Index: modules/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerDivideTest.java =================================================================== --- modules/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerDivideTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerDivideTest.java 2006-04-16 13:59:11.000000000 +0100 @@ -42,7 +42,7 @@ BigInteger result = aNumber.divide(bNumber); fail("ArithmeticException has not been caught"); } catch (ArithmeticException e) { - assertTrue("Improper exception message", e.getMessage().equals("division by zero")); + assertEquals("Improper exception message", "division by zero", e.getMessage()); } } @@ -58,7 +58,7 @@ BigInteger result = aNumber.divide(bNumber); fail("ArithmeticException has not been caught"); } catch (ArithmeticException e) { - assertTrue("Improper exception message", e.getMessage().equals("division by zero")); + assertEquals("Improper exception message", "division by zero", e.getMessage()); } } @@ -411,7 +411,7 @@ BigInteger result = aNumber.remainder(bNumber); fail("ArithmeticException has not been caught"); } catch (ArithmeticException e) { - assertTrue("Improper exception message", e.getMessage().equals("division by zero")); + assertEquals("Improper exception message", "division by zero", e.getMessage()); } } @@ -624,7 +624,7 @@ BigInteger result = aNumber.mod(bNumber); fail("ArithmeticException has not been caught"); } catch (ArithmeticException e) { - assertTrue("Improper exception message", e.getMessage().equals("modulus is non-positive")); + assertEquals("Improper exception message", "modulus is non-positive", e.getMessage()); } } Index: modules/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerModPowTest.java =================================================================== --- modules/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerModPowTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerModPowTest.java 2006-04-16 13:59:11.000000000 +0100 @@ -45,7 +45,7 @@ BigInteger result = aNumber.modPow(exp, modulus); fail("ArithmeticException has not been caught"); } catch (ArithmeticException e) { - assertTrue("Improper exception message", e.getMessage().equals("non-positive modulus")); + assertEquals("Improper exception message", "non-positive modulus", e.getMessage()); } } @@ -109,7 +109,7 @@ BigInteger result = aNumber.modInverse(modulus); fail("ArithmeticException has not been caught"); } catch (ArithmeticException e) { - assertTrue("Improper exception message", e.getMessage().equals("non-positive modulus")); + assertEquals("Improper exception message", "non-positive modulus", e.getMessage()); } } @@ -127,7 +127,7 @@ BigInteger result = aNumber.modInverse(modulus); fail("ArithmeticException has not been caught"); } catch (ArithmeticException e) { - assertTrue("Improper exception message", e.getMessage().equals("non-invertible BigInteger")); + assertEquals("Improper exception message", "non-invertible BigInteger", e.getMessage()); } } Index: modules/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerMultiplyTest.java =================================================================== --- modules/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerMultiplyTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerMultiplyTest.java 2006-04-16 13:59:11.000000000 +0100 @@ -285,7 +285,7 @@ BigInteger result = aNumber.pow(exp); fail("ArithmeticException has not been caught"); } catch (ArithmeticException e) { - assertTrue("Improper exception message", e.getMessage().equals("exponent is negative")); + assertEquals("Improper exception message", "exponent is negative", e.getMessage()); } } Index: modules/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerOperateBitsTest.java =================================================================== --- modules/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerOperateBitsTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerOperateBitsTest.java 2006-04-16 13:59:11.000000000 +0100 @@ -133,7 +133,7 @@ BigInteger result = aNumber.clearBit(number); fail("ArithmeticException has not been caught"); } catch (ArithmeticException e) { - assertTrue("Improper exception message", e.getMessage().equals("negative bit number")); + assertEquals("Improper exception message", "negative bit number", e.getMessage()); } } @@ -440,7 +440,7 @@ BigInteger result = aNumber.flipBit(number); fail("ArithmeticException has not been caught"); } catch (ArithmeticException e) { - assertTrue("Improper exception message", e.getMessage().equals("negative bit number")); + assertEquals("Improper exception message", "negative bit number", e.getMessage()); } } @@ -730,7 +730,7 @@ BigInteger result = aNumber.setBit(number); fail("ArithmeticException has not been caught"); } catch (ArithmeticException e) { - assertTrue("Improper exception message", e.getMessage().equals("negative bit number")); + assertEquals("Improper exception message", "negative bit number", e.getMessage()); } } @@ -1031,7 +1031,7 @@ */ public void testSetBitBug1331() { BigInteger result = BigInteger.valueOf(0L).setBit(191); - assertTrue("incorrect value", result.toString().equals("3138550867693340381917894711603833208051177722232017256448")); + assertEquals("incorrect value", "3138550867693340381917894711603833208051177722232017256448", result.toString()); assertTrue("incorrect sign", result.signum() == 1); } @@ -1307,7 +1307,7 @@ boolean result = aNumber.testBit(number); fail("ArithmeticException has not been caught"); } catch (ArithmeticException e) { - assertTrue("Improper exception message", e.getMessage().equals("negative bit number")); + assertEquals("Improper exception message", "negative bit number", e.getMessage()); } } Index: modules/math/src/test/java/tests/api/java/math/BigDecimalTest.java =================================================================== --- modules/math/src/test/java/tests/api/java/math/BigDecimalTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/math/src/test/java/tests/api/java/math/BigDecimalTest.java 2006-04-16 14:00:48.000000000 +0100 @@ -41,8 +41,8 @@ assertTrue("the BigDecimal value is not initialized properly", big .unscaledValue().equals(value2) && big.scale() == 5); - assertTrue("the BigDecimal value is not represented properly", big - .toString().equals("123345.60000")); + assertEquals("the BigDecimal value is not represented properly", "123345.60000", big + .toString()); } /** @@ -50,9 +50,8 @@ */ public void test_ConstructorD() { BigDecimal big = new BigDecimal(123E04); - assertTrue( - "the BigDecimal value taking a double argument is not initialized properly", - big.toString().equals("1230000")); + assertEquals("the BigDecimal value taking a double argument is not initialized properly", + "1230000", big.toString()); big = new BigDecimal(1.2345E-12); assertTrue("the double representation is not correct", big .doubleValue() == 1.2345E-12); @@ -152,12 +151,12 @@ public void test_abs() { BigDecimal big = new BigDecimal("-1234"); BigDecimal bigabs = big.abs(); - assertTrue("the absolute value of -1234 is not 1234", bigabs.toString() - .equals("1234")); + assertEquals("the absolute value of -1234 is not 1234", "1234", bigabs.toString() + ); big = new BigDecimal(new BigInteger("2345"), 2); bigabs = big.abs(); - assertTrue("the absolute value of 23.45 is not 23.45", bigabs - .toString().equals("23.45")); + assertEquals("the absolute value of 23.45 is not 23.45", "23.45", bigabs + .toString()); } /** @@ -170,11 +169,11 @@ assertTrue("the sum of 23.456 + 3849.235 is wrong", sum.unscaledValue() .toString().equals("3872691") && sum.scale() == 3); - assertTrue("the sum of 23.456 + 3849.235 is not printed correctly", sum - .toString().equals("3872.691")); + assertEquals("the sum of 23.456 + 3849.235 is not printed correctly", "3872.691", sum + .toString()); BigDecimal add3 = new BigDecimal(12.34E02D); - assertTrue("the sum of 23.456 + 12.34E02 is not printed correctly", - (add1.add(add3)).toString().equals("1257.456")); + assertEquals("the sum of 23.456 + 12.34E02 is not printed correctly", + "1257.456", (add1.add(add3)).toString()); } /** @@ -220,9 +219,8 @@ assertTrue("123459.08/2.335 is not correct", divd3.toString().equals( "52873.27") && divd3.scale() == divd1.scale()); - assertTrue( - "the unscaledValue representation of 123459.08/2.335 is not correct", - divd3.unscaledValue().toString().equals("5287327")); + assertEquals("the unscaledValue representation of 123459.08/2.335 is not correct", + "5287327", divd3.unscaledValue().toString()); divd2 = new BigDecimal(123.4D); divd3 = divd1.divide(divd2, BigDecimal.ROUND_DOWN); assertTrue("123459.08/123.4 is not correct", divd3.toString().equals( @@ -545,11 +543,11 @@ */ public void test_negate() { BigDecimal negate1 = new BigDecimal(value2, 7); - assertTrue("the negate of 1233.4560000 is not -1233.4560000", negate1 - .negate().toString().equals("-1233.4560000")); + assertEquals("the negate of 1233.4560000 is not -1233.4560000", "-1233.4560000", negate1 + .negate().toString()); negate1 = new BigDecimal("-23465839"); - assertTrue("the negate of -23465839 is not 23465839", negate1.negate() - .toString().equals("23465839")); + assertEquals("the negate of -23465839 is not 23465839", "23465839", negate1.negate() + .toString()); negate1 = new BigDecimal(-3.456E6); assertTrue("the negate of -3.456E6 is not 3.456E6", negate1.negate() .negate().equals(negate1)); @@ -614,9 +612,8 @@ setScale2 = setScale1.setScale(17, BigDecimal.ROUND_CEILING); assertTrue("the number -1.253E-12 after setting scale is wrong", setScale2.scale() == 17); - assertTrue( - "the representation of the number -1.253E-12 after setting scale is wrong", - setScale2.toString().equals("-0.00000000000125300")); + assertEquals("the representation of the number -1.253E-12 after setting scale is wrong", + "-0.00000000000125300", setScale2.toString()); // testing rounding Mode ROUND_CEILING setScale1 = new BigDecimal(value, 4); @@ -793,8 +790,8 @@ BigDecimal sub1 = new BigDecimal("-29830.989"); BigInteger result = sub1.toBigInteger(); - assertTrue("the bigInteger equivalent of -29830.989 is wrong", result - .toString().equals("-29830")); + assertEquals("the bigInteger equivalent of -29830.989 is wrong", "-29830", result + .toString()); sub1 = new BigDecimal(-2837E10); result = sub1.toBigInteger(); assertTrue("the bigInteger equivalent of -2837E10 is wrong", result @@ -805,8 +802,8 @@ .equals(BigInteger.ZERO)); sub1 = new BigDecimal(value2, 6); result = sub1.toBigInteger(); - assertTrue("the bigInteger equivalent of 12334.560000 is wrong", result - .toString().equals("12334")); + assertEquals("the bigInteger equivalent of 12334.560000 is wrong", "12334", result + .toString()); } /** @@ -814,17 +811,17 @@ */ public void test_toString() { BigDecimal toString1 = new BigDecimal("1234.000"); - assertTrue("the toString representation of 1234.000 is wrong", - toString1.toString().equals("1234.000")); + assertEquals("the toString representation of 1234.000 is wrong", + "1234.000", toString1.toString()); toString1 = new BigDecimal(-123.4E-5); assertTrue("the toString representation of -123.4E-5 is wrong: " + toString1, toString1.toString().equals("-0.001234")); toString1 = new BigDecimal(-1.455E-20); - assertTrue("the toString representation of -1.455E-20 is wrong", - toString1.toString().equals("-0.00000000000000000001455")); + assertEquals("the toString representation of -1.455E-20 is wrong", + "-0.00000000000000000001455", toString1.toString()); toString1 = new BigDecimal(value2, 4); - assertTrue("the toString representation of 1233456.0000 is wrong", - toString1.toString().equals("1233456.0000")); + assertEquals("the toString representation of 1233456.0000 is wrong", + "1233456.0000", toString1.toString()); } /** @@ -832,18 +829,18 @@ */ public void test_unscaledValue() { BigDecimal unsVal = new BigDecimal("-2839485.000"); - assertTrue("the unscaledValue of -2839485.000 is wrong", unsVal - .unscaledValue().toString().equals("-2839485000")); + assertEquals("the unscaledValue of -2839485.000 is wrong", "-2839485000", unsVal + .unscaledValue().toString()); unsVal = new BigDecimal(123E10); - assertTrue("the unscaledValue of 123E10 is wrong", unsVal - .unscaledValue().toString().equals("1230000000000")); + assertEquals("the unscaledValue of 123E10 is wrong", "1230000000000", unsVal + .unscaledValue().toString()); unsVal = new BigDecimal(-4.56E-13); assertTrue("the unscaledValue of -4.56E-13 is wrong: " + unsVal.unscaledValue(), unsVal.unscaledValue().toString() .equals("-456")); unsVal = new BigDecimal(value, 3); - assertTrue("the unscaledValue of 12345.908 is wrong", unsVal - .unscaledValue().toString().equals("12345908")); + assertEquals("the unscaledValue of 12345.908 is wrong", "12345908", unsVal + .unscaledValue().toString()); } @@ -856,9 +853,8 @@ valueOfL.unscaledValue().toString().equals( "9223372036854775806") && valueOfL.scale() == 0); - assertTrue( - "the toString representation of 9223372036854775806 is wrong", - valueOfL.toString().equals("9223372036854775806")); + assertEquals("the toString representation of 9223372036854775806 is wrong", + "9223372036854775806", valueOfL.toString()); valueOfL = BigDecimal.valueOf(0L); assertTrue("the bigDecimal equivalent of 0 is wrong", valueOfL .unscaledValue().toString().equals("0") @@ -875,25 +871,22 @@ valueOfJI.unscaledValue().toString().equals( "9223372036854775806") && valueOfJI.scale() == 5); - assertTrue( - "the toString representation of 9223372036854775806 is wrong", - valueOfJI.toString().equals("92233720368547.75806")); + assertEquals("the toString representation of 9223372036854775806 is wrong", + "92233720368547.75806", valueOfJI.toString()); valueOfJI = BigDecimal.valueOf(1234L, 8); assertTrue( "the bigDecimal equivalent of 92233720368547.75806 is wrong", valueOfJI.unscaledValue().toString().equals("1234") && valueOfJI.scale() == 8); - assertTrue( - "the toString representation of 9223372036854775806 is wrong", - valueOfJI.toString().equals("0.00001234")); + assertEquals("the toString representation of 9223372036854775806 is wrong", + "0.00001234", valueOfJI.toString()); valueOfJI = BigDecimal.valueOf(0, 3); assertTrue( "the bigDecimal equivalent of 92233720368547.75806 is wrong", valueOfJI.unscaledValue().toString().equals("0") && valueOfJI.scale() == 3); - assertTrue( - "the toString representation of 9223372036854775806 is wrong", - valueOfJI.toString().equals("0.000")); + assertEquals("the toString representation of 9223372036854775806 is wrong", + "0.000", valueOfJI.toString()); } Index: modules/security/src/test/java/common/tests/api/java/security/AlgorithmParameterGeneratorTest.java =================================================================== --- modules/security/src/test/java/common/tests/api/java/security/AlgorithmParameterGeneratorTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/security/src/test/java/common/tests/api/java/security/AlgorithmParameterGeneratorTest.java 2006-04-16 11:47:22.000000000 +0100 @@ -52,7 +52,7 @@ // java.security.AlgorithmParameterGenerator.getAlgorithm() String alg = AlgorithmParameterGenerator.getInstance("DSA") .getAlgorithm(); - assertTrue("getAlgorithm ok", alg.equals("DSA")); + assertEquals("getAlgorithm ok", "DSA", alg); } /** Index: modules/security/src/test/java/common/tests/api/java/security/CodeSourceTest.java =================================================================== --- modules/security/src/test/java/common/tests/api/java/security/CodeSourceTest.java.orig 2006-04-16 11:47:21.000000000 +0100 +++ modules/security/src/test/java/common/tests/api/java/security/CodeSourceTest.java 2006-04-16 11:47:22.000000000 +0100 @@ -73,8 +73,8 @@ // Test for method java.net.URL java.security.CodeSource.getLocation() CodeSource cs = new CodeSource(new java.net.URL("file:///test"), (Certificate[]) null); - assertTrue("Did not get expected location!", cs.getLocation() - .toString().equals("file:/test")); + assertEquals("Did not get expected location!", "file:/test", cs.getLocation() + .toString()); } /** Index: modules/security/src/test/java/common/tests/api/java/security/GeneralSecurityExceptionTest.java =================================================================== --- modules/security/src/test/java/common/tests/api/java/security/GeneralSecurityExceptionTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/security/src/test/java/common/tests/api/java/security/GeneralSecurityExceptionTest.java 2006-04-16 11:47:22.000000000 +0100 @@ -26,8 +26,8 @@ // Test for method java.security.GeneralSecurityException() GeneralSecurityException e = new GeneralSecurityException(); assertNotNull("Constructor returned null instance", e); - assertTrue("Failed toString test for constructed instance", e - .toString().equals("java.security.GeneralSecurityException")); + assertEquals("Failed toString test for constructed instance", "java.security.GeneralSecurityException", e + .toString()); } /** @@ -39,8 +39,8 @@ GeneralSecurityException e = new GeneralSecurityException( "test message"); assertNotNull("Constructor returned null instance", e); - assertTrue("Failed toString test for constructed instance", e - .toString().equals( - "java.security.GeneralSecurityException: test message")); + assertEquals("Failed toString test for constructed instance", + "java.security.GeneralSecurityException: test message", e + .toString()); } } \ No newline at end of file Index: modules/security/src/test/java/common/tests/api/java/security/InvalidKeyExceptionTest.java =================================================================== --- modules/security/src/test/java/common/tests/api/java/security/InvalidKeyExceptionTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/security/src/test/java/common/tests/api/java/security/InvalidKeyExceptionTest.java 2006-04-16 11:47:22.000000000 +0100 @@ -26,8 +26,8 @@ // Test for method java.security.InvalidKeyException() InvalidKeyException e = new InvalidKeyException(); assertNotNull("Constructor returned a null", e); - assertTrue("Failed toString test for constructed instance", e - .toString().equals("java.security.InvalidKeyException")); + assertEquals("Failed toString test for constructed instance", "java.security.InvalidKeyException", e + .toString()); } /** @@ -37,8 +37,8 @@ // Test for method java.security.InvalidKeyException(java.lang.String) InvalidKeyException e = new InvalidKeyException("test message"); assertNotNull("Constructor returned a null", e); - assertTrue("Failed toString test for constructed instance", e - .toString().equals( - "java.security.InvalidKeyException: test message")); + assertEquals("Failed toString test for constructed instance", + "java.security.InvalidKeyException: test message", e + .toString()); } } \ No newline at end of file Index: modules/security/src/test/java/common/tests/api/java/security/InvalidParameterExceptionTest.java =================================================================== --- modules/security/src/test/java/common/tests/api/java/security/InvalidParameterExceptionTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/security/src/test/java/common/tests/api/java/security/InvalidParameterExceptionTest.java 2006-04-16 14:00:48.000000000 +0100 @@ -25,8 +25,8 @@ public void test_Constructor() { // Test for method java.security.InvalidParameterException() InvalidParameterException e = new InvalidParameterException(); - assertTrue("Failed toString test for constructed instance", e - .toString().equals("java.security.InvalidParameterException")); + assertEquals("Failed toString test for constructed instance", "java.security.InvalidParameterException", e + .toString()); } /** @@ -37,11 +37,10 @@ // java.security.InvalidParameterException(java.lang.String) InvalidParameterException e = new InvalidParameterException( "test message"); - assertTrue( - "Failed toString test for constructed instance", - e + assertEquals("Failed toString test for constructed instance", + + "java.security.InvalidParameterException: test message", e .toString() - .equals( - "java.security.InvalidParameterException: test message")); + ); } } \ No newline at end of file Index: modules/security/src/test/java/common/tests/api/java/security/KeyExceptionTest.java =================================================================== --- modules/security/src/test/java/common/tests/api/java/security/KeyExceptionTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/security/src/test/java/common/tests/api/java/security/KeyExceptionTest.java 2006-04-16 11:47:22.000000000 +0100 @@ -25,8 +25,8 @@ public void test_Constructor() { // Test for method java.security.KeyException() KeyException e = new KeyException(); - assertTrue("Failed toString test for constructed instance", e - .toString().equals("java.security.KeyException")); + assertEquals("Failed toString test for constructed instance", "java.security.KeyException", e + .toString()); } /** @@ -35,7 +35,7 @@ public void test_ConstructorLjava_lang_String() { // Test for method java.security.KeyException(java.lang.String) KeyException e = new KeyException("test message"); - assertTrue("Failed toString test for constructed instance", e - .toString().equals("java.security.KeyException: test message")); + assertEquals("Failed toString test for constructed instance", "java.security.KeyException: test message", e + .toString()); } } \ No newline at end of file Index: modules/security/src/test/java/common/tests/api/java/security/KeyStoreExceptionTest.java =================================================================== --- modules/security/src/test/java/common/tests/api/java/security/KeyStoreExceptionTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/security/src/test/java/common/tests/api/java/security/KeyStoreExceptionTest.java 2006-04-16 11:47:22.000000000 +0100 @@ -25,8 +25,8 @@ public void test_Constructor() { // Test for method java.security.KeyStoreException() KeyStoreException e = new KeyStoreException(); - assertTrue("Failed toString test for constructed instance", e - .toString().equals("java.security.KeyStoreException")); + assertEquals("Failed toString test for constructed instance", "java.security.KeyStoreException", e + .toString()); } /** @@ -35,8 +35,8 @@ public void test_ConstructorLjava_lang_String() { // Test for method java.security.KeyStoreException(java.lang.String) KeyStoreException e = new KeyStoreException("test message"); - assertTrue("Failed toString test for constructed instance", e - .toString().equals( - "java.security.KeyStoreException: test message")); + assertEquals("Failed toString test for constructed instance", + "java.security.KeyStoreException: test message", e + .toString()); } } \ No newline at end of file Index: modules/security/src/test/java/common/tests/api/java/security/PermissionCollectionTest.java =================================================================== --- modules/security/src/test/java/common/tests/api/java/security/PermissionCollectionTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/security/src/test/java/common/tests/api/java/security/PermissionCollectionTest.java 2006-04-16 11:47:22.000000000 +0100 @@ -170,12 +170,12 @@ StringTokenizer resultTokenizer = new StringTokenizer(result, ","); // Check the test result from the new VM process - assertTrue("Permission should be granted", resultTokenizer - .nextToken().equals("true")); - assertTrue("signed Permission should be granted", resultTokenizer - .nextToken().equals("true")); - assertTrue("Permission should not be granted", resultTokenizer - .nextToken().equals("false")); + assertEquals("Permission should be granted", "true", resultTokenizer + .nextToken()); + assertEquals("signed Permission should be granted", "true", resultTokenizer + .nextToken()); + assertEquals("Permission should not be granted", "false", resultTokenizer + .nextToken()); } catch (IOException e) { fail("IOException during test : " + e); } catch (InterruptedException e) { Index: modules/security/src/test/java/common/tests/api/java/security/SecurityPermissionTest.java =================================================================== --- modules/security/src/test/java/common/tests/api/java/security/SecurityPermissionTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/security/src/test/java/common/tests/api/java/security/SecurityPermissionTest.java 2006-04-16 14:00:48.000000000 +0100 @@ -24,9 +24,9 @@ */ public void test_ConstructorLjava_lang_String() { // Test for method java.security.SecurityPermission(java.lang.String) - assertTrue("create securityPermission constructor(string) failed", - new SecurityPermission("SecurityPermission(string)").getName() - .equals("SecurityPermission(string)")); + assertEquals("create securityPermission constructor(string) failed", + "SecurityPermission(string)", new SecurityPermission("SecurityPermission(string)").getName() + ); } @@ -38,9 +38,8 @@ // Test for method java.security.SecurityPermission(java.lang.String, // java.lang.String) SecurityPermission sp = new SecurityPermission("security.file", "write"); - assertTrue( - "creat securityPermission constructor(string,string) failed", - sp.getName().equals("security.file")); + assertEquals("creat securityPermission constructor(string,string) failed", + "security.file", sp.getName()); } } \ No newline at end of file Index: modules/security/src/test/java/common/tests/api/java/security/SecurityTest.java =================================================================== --- modules/security/src/test/java/common/tests/api/java/security/SecurityTest.java.orig 2006-04-16 11:47:21.000000000 +0100 +++ modules/security/src/test/java/common/tests/api/java/security/SecurityTest.java 2006-04-16 14:00:48.000000000 +0100 @@ -37,10 +37,9 @@ // Test for method java.lang.String // java.security.Security.getProperty(java.lang.String) Security.setProperty("keyTestAlternate", "testing a property set"); - assertTrue( - "the property value returned for keyTestAlternate was incorrect", - Security.getProperty("keyTestAlternate").equals( - "testing a property set")); + assertEquals("the property value returned for keyTestAlternate was incorrect", + + "testing a property set", Security.getProperty("keyTestAlternate")); } /** @@ -53,9 +52,9 @@ // java.lang.String) Security.setProperty("keyTest", "permission to set property"); - assertTrue("the property value returned for keyTest was not correct", - Security.getProperty("keyTest").equals( - "permission to set property")); + assertEquals("the property value returned for keyTest was not correct", + + "permission to set property", Security.getProperty("keyTest")); } @@ -172,10 +171,10 @@ Provider provTest[] = Security.getProviders(); assertEquals("the number of providers is not 2 it was: " + provTest.length, 2, provTest.length); - assertTrue("the first provider should be DRLCertFactory", provTest[0] - .getName().equals("DRLCertFactory")); - assertTrue("the second provider should be BC", provTest[1].getName() - .equals("BC")); + assertEquals("the first provider should be DRLCertFactory", "DRLCertFactory", provTest[0] + .getName()); + assertEquals("the second provider should be BC", "BC", provTest[1].getName() + ); } /** Index: modules/security/src/test/java/common/tests/api/java/security/SignatureExceptionTest.java =================================================================== --- modules/security/src/test/java/common/tests/api/java/security/SignatureExceptionTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/security/src/test/java/common/tests/api/java/security/SignatureExceptionTest.java 2006-04-16 11:47:22.000000000 +0100 @@ -25,8 +25,8 @@ public void test_Constructor() { // Test for method java.security.SignatureException() SignatureException e = new SignatureException(); - assertTrue("Failed toString test for constructed instance", e - .toString().equals("java.security.SignatureException")); + assertEquals("Failed toString test for constructed instance", "java.security.SignatureException", e + .toString()); } /** @@ -35,8 +35,8 @@ public void test_ConstructorLjava_lang_String() { // Test for method java.security.SignatureException(java.lang.String) SignatureException e = new SignatureException("test message"); - assertTrue("Failed toString test for constructed instance", e - .toString().equals( - "java.security.SignatureException: test message")); + assertEquals("Failed toString test for constructed instance", + "java.security.SignatureException: test message", e + .toString()); } } \ No newline at end of file Index: modules/security/src/test/java/common/tests/api/java/security/UnrecoverableKeyExceptionTest.java =================================================================== --- modules/security/src/test/java/common/tests/api/java/security/UnrecoverableKeyExceptionTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/security/src/test/java/common/tests/api/java/security/UnrecoverableKeyExceptionTest.java 2006-04-16 11:47:22.000000000 +0100 @@ -25,8 +25,8 @@ public void test_Constructor() { // Test for method java.security.UnrecoverableKeyException() UnrecoverableKeyException e = new UnrecoverableKeyException(); - assertTrue("Failed toString test for constructed instance", e - .toString().equals("java.security.UnrecoverableKeyException")); + assertEquals("Failed toString test for constructed instance", "java.security.UnrecoverableKeyException", e + .toString()); } /** Index: modules/text/src/test/java/tests/api/java/text/ChoiceFormatTest.java =================================================================== --- modules/text/src/test/java/tests/api/java/text/ChoiceFormatTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/text/src/test/java/tests/api/java/text/ChoiceFormatTest.java 2006-04-16 13:59:11.000000000 +0100 @@ -203,19 +203,19 @@ FieldPosition field = new FieldPosition(0); StringBuffer buf = new StringBuffer(); String r = f1.format(-1, buf, field).toString(); - assertTrue("Wrong choice for -1", r.equals("Less than one")); + assertEquals("Wrong choice for -1", "Less than one", r); buf.setLength(0); r = f1.format(0, buf, field).toString(); - assertTrue("Wrong choice for 0", r.equals("Less than one")); + assertEquals("Wrong choice for 0", "Less than one", r); buf.setLength(0); r = f1.format(1, buf, field).toString(); - assertTrue("Wrong choice for 1", r.equals("one")); + assertEquals("Wrong choice for 1", "one", r); buf.setLength(0); r = f1.format(2, buf, field).toString(); - assertTrue("Wrong choice for 2", r.equals("Between one and two")); + assertEquals("Wrong choice for 2", "Between one and two", r); buf.setLength(0); r = f1.format(3, buf, field).toString(); - assertTrue("Wrong choice for 3", r.equals("Greater than two")); + assertEquals("Wrong choice for 3", "Greater than two", r); } /** @@ -229,13 +229,13 @@ FieldPosition field = new FieldPosition(0); StringBuffer buf = new StringBuffer(); String r = f1.format(0.5, buf, field).toString(); - assertTrue("Wrong choice for 0.5", r.equals("Less than one")); + assertEquals("Wrong choice for 0.5", "Less than one", r); buf.setLength(0); r = f1.format(1.5, buf, field).toString(); - assertTrue("Wrong choice for 1.5", r.equals("Between one and two")); + assertEquals("Wrong choice for 1.5", "Between one and two", r); buf.setLength(0); r = f1.format(2.5, buf, field).toString(); - assertTrue("Wrong choice for 2.5", r.equals("Greater than two")); + assertEquals("Wrong choice for 2.5", "Greater than two", r); } /** @@ -357,8 +357,8 @@ MessageFormat mf = new MessageFormat("CHOICE {1,choice}"); String ptrn = mf.toPattern(); - assertTrue("Unused message format returning incorrect pattern", ptrn - .equals("CHOICE {1,choice,}")); + assertEquals("Unused message format returning incorrect pattern", "CHOICE {1,choice,}", ptrn + ); String pattern = f1.toPattern(); assertTrue( Index: modules/text/src/test/java/tests/api/java/text/DecimalFormatTest.java =================================================================== --- modules/text/src/test/java/tests/api/java/text/DecimalFormatTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/text/src/test/java/tests/api/java/text/DecimalFormatTest.java 2006-04-16 13:59:11.000000000 +0100 @@ -47,13 +47,13 @@ */ public void test_applyPatternLjava_lang_String() { DecimalFormat format = new DecimalFormat("#.#"); - assertTrue("Wrong pattern 1", format.toPattern().equals("#0.#")); + assertEquals("Wrong pattern 1", "#0.#", format.toPattern()); format = new DecimalFormat("#."); - assertTrue("Wrong pattern 2", format.toPattern().equals("#0.")); + assertEquals("Wrong pattern 2", "#0.", format.toPattern()); format = new DecimalFormat("#"); - assertTrue("Wrong pattern 3", format.toPattern().equals("#")); + assertEquals("Wrong pattern 3", "#", format.toPattern()); format = new DecimalFormat(".#"); - assertTrue("Wrong pattern 4", format.toPattern().equals("#.0")); + assertEquals("Wrong pattern 4", "#.0", format.toPattern()); } /** @@ -323,64 +323,64 @@ Support_BitSet failures = new Support_BitSet(); DecimalFormat df = new DecimalFormat("00.0#E0"); - assertTrue("00.0#E0: 0", df.format(0).equals("00.0E0")); - assertTrue("00.0#E0: 1", df.format(1).equals("10.0E-1")); - assertTrue("00.0#E0: 12", df.format(12).equals("12.0E0")); - assertTrue("00.0#E0: 123", df.format(123).equals("12.3E1")); - assertTrue("00.0#E0: 1234", df.format(1234).equals("12.34E2")); - assertTrue("00.0#E0: 12346", df.format(12346).equals("12.35E3")); - assertTrue("00.0#E0: 99999", df.format(99999).equals("10.0E4")); - assertTrue("00.0#E0: -1", df.format(-1).equals("-10.0E-1")); - assertTrue("00.0#E0: -12", df.format(-12).equals("-12.0E0")); - assertTrue("00.0#E0: -123", df.format(-123).equals("-12.3E1")); - assertTrue("00.0#E0: -1234", df.format(-1234).equals("-12.34E2")); - assertTrue("00.0#E0: -12346", df.format(-12346).equals("-12.35E3")); - assertTrue("00.0#E0: -99999", df.format(-99999).equals("-10.0E4")); + assertEquals("00.0#E0: 0", "00.0E0", df.format(0)); + assertEquals("00.0#E0: 1", "10.0E-1", df.format(1)); + assertEquals("00.0#E0: 12", "12.0E0", df.format(12)); + assertEquals("00.0#E0: 123", "12.3E1", df.format(123)); + assertEquals("00.0#E0: 1234", "12.34E2", df.format(1234)); + assertEquals("00.0#E0: 12346", "12.35E3", df.format(12346)); + assertEquals("00.0#E0: 99999", "10.0E4", df.format(99999)); + assertEquals("00.0#E0: -1", "-10.0E-1", df.format(-1)); + assertEquals("00.0#E0: -12", "-12.0E0", df.format(-12)); + assertEquals("00.0#E0: -123", "-12.3E1", df.format(-123)); + assertEquals("00.0#E0: -1234", "-12.34E2", df.format(-1234)); + assertEquals("00.0#E0: -12346", "-12.35E3", df.format(-12346)); + assertEquals("00.0#E0: -99999", "-10.0E4", df.format(-99999)); df = new DecimalFormat("##0.0E0"); - assertTrue("##0.0E0: 0", df.format(0).equals("0.0E0")); - assertTrue("##0.0E0: 1", df.format(1).equals("1.0E0")); - assertTrue("##0.0E0: 12", df.format(12).equals("12E0")); - assertTrue("##0.0E0: 123", df.format(123).equals("123E0")); - assertTrue("##0.0E0: 1234", df.format(1234).equals("1.234E3")); - assertTrue("##0.0E0: 12346", df.format(12346).equals("12.35E3")); + assertEquals("##0.0E0: 0", "0.0E0", df.format(0)); + assertEquals("##0.0E0: 1", "1.0E0", df.format(1)); + assertEquals("##0.0E0: 12", "12E0", df.format(12)); + assertEquals("##0.0E0: 123", "123E0", df.format(123)); + assertEquals("##0.0E0: 1234", "1.234E3", df.format(1234)); + assertEquals("##0.0E0: 12346", "12.35E3", df.format(12346)); // Fails in JDK 1.2.2 if (!df.format(99999).equals("100E3")) failures.set(failCount); failCount++; - assertTrue("##0.0E0: 999999", df.format(999999).equals("1.0E6")); + assertEquals("##0.0E0: 999999", "1.0E6", df.format(999999)); df = new DecimalFormat("#00.0##E0"); // Fails in JDK 1.2.2 if (!df.format(0).equals("0.00E0")) failures.set(failCount); failCount++; - assertTrue("#00.0##E0: 1", df.format(1).equals("1.00E0")); - assertTrue("#00.0##E0: 12", df.format(12).equals("12.0E0")); - assertTrue("#00.0##E0: 123", df.format(123).equals("123E0")); - assertTrue("#00.0##E0: 1234", df.format(1234).equals("1.234E3")); - assertTrue("#00.0##E0: 12345", df.format(12345).equals("12.345E3")); - assertTrue("#00.0##E0: 123456", df.format(123456).equals("123.456E3")); - assertTrue("#00.0##E0: 1234567", df.format(1234567).equals("1.23457E6")); - assertTrue("#00.0##E0: 12345678", df.format(12345678).equals( - "12.3457E6")); - assertTrue("#00.0##E0: 99999999", df.format(99999999).equals("100E6")); + assertEquals("#00.0##E0: 1", "1.00E0", df.format(1)); + assertEquals("#00.0##E0: 12", "12.0E0", df.format(12)); + assertEquals("#00.0##E0: 123", "123E0", df.format(123)); + assertEquals("#00.0##E0: 1234", "1.234E3", df.format(1234)); + assertEquals("#00.0##E0: 12345", "12.345E3", df.format(12345)); + assertEquals("#00.0##E0: 123456", "123.456E3", df.format(123456)); + assertEquals("#00.0##E0: 1234567", "1.23457E6", df.format(1234567)); + assertEquals("#00.0##E0: 12345678", + "12.3457E6", df.format(12345678)); + assertEquals("#00.0##E0: 99999999", "100E6", df.format(99999999)); df = new DecimalFormat("#.0E0"); - assertTrue("#.0E0: 0", df.format(0).equals(".0E0")); - assertTrue("#.0E0: 1", df.format(1).equals(".1E1")); - assertTrue("#.0E0: 12", df.format(12).equals(".12E2")); - assertTrue("#.0E0: 123", df.format(123).equals(".12E3")); - assertTrue("#.0E0: 1234", df.format(1234).equals(".12E4")); - assertTrue("#.0E0: 9999", df.format(9999).equals(".1E5")); + assertEquals("#.0E0: 0", ".0E0", df.format(0)); + assertEquals("#.0E0: 1", ".1E1", df.format(1)); + assertEquals("#.0E0: 12", ".12E2", df.format(12)); + assertEquals("#.0E0: 123", ".12E3", df.format(123)); + assertEquals("#.0E0: 1234", ".12E4", df.format(1234)); + assertEquals("#.0E0: 9999", ".1E5", df.format(9999)); df = new DecimalFormat("0.#E0"); - assertTrue("0.#E0: 0", df.format(0).equals("0E0")); - assertTrue("0.#E0: 1", df.format(1).equals("1E0")); - assertTrue("0.#E0: 12", df.format(12).equals("1.2E1")); - assertTrue("0.#E0: 123", df.format(123).equals("1.2E2")); - assertTrue("0.#E0: 1234", df.format(1234).equals("1.2E3")); - assertTrue("0.#E0: 9999", df.format(9999).equals("1E4")); + assertEquals("0.#E0: 0", "0E0", df.format(0)); + assertEquals("0.#E0: 1", "1E0", df.format(1)); + assertEquals("0.#E0: 12", "1.2E1", df.format(12)); + assertEquals("0.#E0: 123", "1.2E2", df.format(123)); + assertEquals("0.#E0: 1234", "1.2E3", df.format(1234)); + assertEquals("0.#E0: 9999", "1E4", df.format(9999)); assertTrue("Failed " + failures + " of " + failCount, failures.length() == 0); @@ -629,7 +629,7 @@ dfs.setDecimalSeparator('@'); df.setDecimalFormatSymbols(dfs); assertTrue("Not set", df.getDecimalFormatSymbols().equals(dfs)); - assertTrue("Symbols not used", df.format(1.2).equals("1@2")); + assertEquals("Symbols not used", "1@2", df.format(1.2)); } /** @@ -637,10 +637,10 @@ */ public void test_setDecimalSeparatorAlwaysShownZ() { DecimalFormat df = new DecimalFormat("###0.##"); - assertTrue("Wrong default result", df.format(5).equals("5")); + assertEquals("Wrong default result", "5", df.format(5)); df.setDecimalSeparatorAlwaysShown(true); assertTrue("Not set", df.isDecimalSeparatorAlwaysShown()); - assertTrue("Wrong set result", df.format(7).equals("7.")); + assertEquals("Wrong set result", "7.", df.format(7)); } /** @@ -689,10 +689,10 @@ DecimalFormat df = new DecimalFormat("###0.##"); df.setMaximumFractionDigits(3); assertTrue("Not set", df.getMaximumFractionDigits() == 3); - assertTrue("Wrong maximum", df.format(1.23456).equals("1.235")); + assertEquals("Wrong maximum", "1.235", df.format(1.23456)); df.setMinimumFractionDigits(4); assertTrue("Not changed", df.getMaximumFractionDigits() == 4); - assertTrue("Incorrect fraction", df.format(456).equals("456.0000")); + assertEquals("Incorrect fraction", "456.0000", df.format(456)); } /** @@ -702,10 +702,10 @@ DecimalFormat df = new DecimalFormat("###0.##"); df.setMaximumIntegerDigits(2); assertTrue("Not set", df.getMaximumIntegerDigits() == 2); - assertTrue("Wrong maximum", df.format(1234).equals("34")); + assertEquals("Wrong maximum", "34", df.format(1234)); df.setMinimumIntegerDigits(4); assertTrue("Not changed", df.getMaximumIntegerDigits() == 4); - assertTrue("Incorrect integer", df.format(26).equals("0026")); + assertEquals("Incorrect integer", "0026", df.format(26)); } /** @@ -715,10 +715,10 @@ DecimalFormat df = new DecimalFormat("###0.##"); df.setMinimumFractionDigits(4); assertTrue("Not set", df.getMinimumFractionDigits() == 4); - assertTrue("Wrong minimum", df.format(1.23).equals("1.2300")); + assertEquals("Wrong minimum", "1.2300", df.format(1.23)); df.setMaximumFractionDigits(2); assertTrue("Not changed", df.getMinimumFractionDigits() == 2); - assertTrue("Incorrect fraction", df.format(456).equals("456.00")); + assertEquals("Incorrect fraction", "456.00", df.format(456)); } /** @@ -728,10 +728,10 @@ DecimalFormat df = new DecimalFormat("###0.##"); df.setMinimumIntegerDigits(3); assertTrue("Not set", df.getMinimumIntegerDigits() == 3); - assertTrue("Wrong minimum", df.format(12).equals("012")); + assertEquals("Wrong minimum", "012", df.format(12)); df.setMaximumIntegerDigits(2); assertTrue("Not changed", df.getMinimumIntegerDigits() == 2); - assertTrue("Incorrect integer", df.format(0.7).equals("00.7")); + assertEquals("Incorrect integer", "00.7", df.format(0.7)); } /** @@ -741,7 +741,7 @@ DecimalFormat df = new DecimalFormat("###0.##"); df.setMultiplier(10); assertTrue("Wrong multiplier", df.getMultiplier() == 10); - assertTrue("Wrong format", df.format(5).equals("50")); + assertEquals("Wrong format", "50", df.format(5)); assertTrue("Wrong parse", df.parse("50", new ParsePosition(0)) .intValue() == 5); } Index: modules/text/src/test/java/tests/api/java/text/MessageFormatTest.java =================================================================== --- modules/text/src/test/java/tests/api/java/text/MessageFormatTest.java.orig 2006-04-16 11:47:21.000000000 +0100 +++ modules/text/src/test/java/tests/api/java/text/MessageFormatTest.java 2006-04-16 11:47:22.000000000 +0100 @@ -118,8 +118,8 @@ assertTrue("Wrong answer:\n" + result + "\n" + buffer, result .equals(buffer.toString())); - assertTrue("Simple string", new MessageFormat("Test message").format( - new Object[0]).equals("Test message")); + assertEquals("Simple string", "Test message", new MessageFormat("Test message").format( + new Object[0])); try { result = new MessageFormat("Don't").format(new Object[0]); @@ -166,8 +166,8 @@ // java.text.MessageFormat.applyPattern(java.lang.String) MessageFormat format = new MessageFormat("test"); format.applyPattern("xx {0}"); - assertTrue("Invalid number", format.format( - new Object[] { new Integer(46) }).equals("xx 46")); + assertEquals("Invalid number", "xx 46", format.format( + new Object[] { new Integer(46) })); Date date = new Date(); String result = format.format(new Object[] { date }); String expected = "xx " + DateFormat.getInstance().format(date); @@ -175,110 +175,110 @@ .equals(expected)); format = new MessageFormat("{0,date}{1,time}{2,number,integer}"); format.applyPattern("nothing"); - assertTrue("Found formats", format.toPattern().equals("nothing")); + assertEquals("Found formats", "nothing", format.toPattern()); format.applyPattern("{0}"); assertNull("Wrong format", format.getFormats()[0]); - assertTrue("Wrong pattern", format.toPattern().equals("{0}")); + assertEquals("Wrong pattern", "{0}", format.toPattern()); format.applyPattern("{0, \t\u001ftime }"); assertTrue("Wrong time format", format.getFormats()[0] .equals(DateFormat.getTimeInstance())); - assertTrue("Wrong time pattern", format.toPattern().equals("{0,time}")); + assertEquals("Wrong time pattern", "{0,time}", format.toPattern()); format.applyPattern("{0,Time, Short\n}"); assertTrue("Wrong short time format", format.getFormats()[0] .equals(DateFormat.getTimeInstance(DateFormat.SHORT))); - assertTrue("Wrong short time pattern", format.toPattern().equals( - "{0,time,short}")); + assertEquals("Wrong short time pattern", + "{0,time,short}", format.toPattern()); format.applyPattern("{0,TIME,\nmedium }"); assertTrue("Wrong medium time format", format.getFormats()[0] .equals(DateFormat.getTimeInstance(DateFormat.MEDIUM))); - assertTrue("Wrong medium time pattern", format.toPattern().equals( - "{0,time}")); + assertEquals("Wrong medium time pattern", + "{0,time}", format.toPattern()); format.applyPattern("{0,time,LONG}"); assertTrue("Wrong long time format", format.getFormats()[0] .equals(DateFormat.getTimeInstance(DateFormat.LONG))); - assertTrue("Wrong long time pattern", format.toPattern().equals( - "{0,time,long}")); + assertEquals("Wrong long time pattern", + "{0,time,long}", format.toPattern()); format.setLocale(Locale.FRENCH); // use French since English has the // same LONG and FULL time patterns format.applyPattern("{0,time, Full}"); assertTrue("Wrong full time format", format.getFormats()[0] .equals(DateFormat.getTimeInstance(DateFormat.FULL, Locale.FRENCH))); - assertTrue("Wrong full time pattern", format.toPattern().equals( - "{0,time,full}")); + assertEquals("Wrong full time pattern", + "{0,time,full}", format.toPattern()); format.setLocale(Locale.getDefault()); format.applyPattern("{0, date}"); assertTrue("Wrong date format", format.getFormats()[0] .equals(DateFormat.getDateInstance())); - assertTrue("Wrong date pattern", format.toPattern().equals("{0,date}")); + assertEquals("Wrong date pattern", "{0,date}", format.toPattern()); format.applyPattern("{0, date, short}"); assertTrue("Wrong short date format", format.getFormats()[0] .equals(DateFormat.getDateInstance(DateFormat.SHORT))); - assertTrue("Wrong short date pattern", format.toPattern().equals( - "{0,date,short}")); + assertEquals("Wrong short date pattern", + "{0,date,short}", format.toPattern()); format.applyPattern("{0, date, medium}"); assertTrue("Wrong medium date format", format.getFormats()[0] .equals(DateFormat.getDateInstance(DateFormat.MEDIUM))); - assertTrue("Wrong medium date pattern", format.toPattern().equals( - "{0,date}")); + assertEquals("Wrong medium date pattern", + "{0,date}", format.toPattern()); format.applyPattern("{0, date, long}"); assertTrue("Wrong long date format", format.getFormats()[0] .equals(DateFormat.getDateInstance(DateFormat.LONG))); - assertTrue("Wrong long date pattern", format.toPattern().equals( - "{0,date,long}")); + assertEquals("Wrong long date pattern", + "{0,date,long}", format.toPattern()); format.applyPattern("{0, date, full}"); assertTrue("Wrong full date format", format.getFormats()[0] .equals(DateFormat.getDateInstance(DateFormat.FULL))); - assertTrue("Wrong full date pattern", format.toPattern().equals( - "{0,date,full}")); + assertEquals("Wrong full date pattern", + "{0,date,full}", format.toPattern()); format.applyPattern("{0, date, MMM d {hh:mm:ss}}"); - assertTrue("Wrong time/date format", ((SimpleDateFormat) (format - .getFormats()[0])).toPattern().equals(" MMM d {hh:mm:ss}")); - assertTrue("Wrong time/date pattern", format.toPattern().equals( - "{0,date, MMM d {hh:mm:ss}}")); + assertEquals("Wrong time/date format", " MMM d {hh:mm:ss}", ((SimpleDateFormat) (format + .getFormats()[0])).toPattern()); + assertEquals("Wrong time/date pattern", + "{0,date, MMM d {hh:mm:ss}}", format.toPattern()); format.applyPattern("{0, number}"); assertTrue("Wrong number format", format.getFormats()[0] .equals(NumberFormat.getNumberInstance())); - assertTrue("Wrong number pattern", format.toPattern().equals( - "{0,number}")); + assertEquals("Wrong number pattern", + "{0,number}", format.toPattern()); format.applyPattern("{0, number, currency}"); assertTrue("Wrong currency number format", format.getFormats()[0] .equals(NumberFormat.getCurrencyInstance())); - assertTrue("Wrong currency number pattern", format.toPattern().equals( - "{0,number,currency}")); + assertEquals("Wrong currency number pattern", + "{0,number,currency}", format.toPattern()); format.applyPattern("{0, number, percent}"); assertTrue("Wrong percent number format", format.getFormats()[0] .equals(NumberFormat.getPercentInstance())); - assertTrue("Wrong percent number pattern", format.toPattern().equals( - "{0,number,percent}")); + assertEquals("Wrong percent number pattern", + "{0,number,percent}", format.toPattern()); format.applyPattern("{0, number, integer}"); NumberFormat nf = NumberFormat.getInstance(); nf.setMaximumFractionDigits(0); nf.setParseIntegerOnly(true); assertTrue("Wrong integer number format", format.getFormats()[0] .equals(nf)); - assertTrue("Wrong integer number pattern", format.toPattern().equals( - "{0,number,integer}")); + assertEquals("Wrong integer number pattern", + "{0,number,integer}", format.toPattern()); format.applyPattern("{0, number, {'#'}##0.0E0}"); - assertTrue("Wrong pattern number format", ((DecimalFormat) (format - .getFormats()[0])).toPattern().equals("' {#}'##0.0E0")); - assertTrue("Wrong pattern number pattern", format.toPattern().equals( - "{0,number,' {#}'##0.0E0}")); + assertEquals("Wrong pattern number format", "' {#}'##0.0E0", ((DecimalFormat) (format + .getFormats()[0])).toPattern()); + assertEquals("Wrong pattern number pattern", + "{0,number,' {#}'##0.0E0}", format.toPattern()); format.applyPattern("{0, choice,0#no|1#one|2#{1,number}}"); - assertTrue("Wrong choice format", - ((ChoiceFormat) format.getFormats()[0]).toPattern().equals( - "0.0#no|1.0#one|2.0#{1,number}")); - assertTrue("Wrong choice pattern", format.toPattern().equals( - "{0,choice,0.0#no|1.0#one|2.0#{1,number}}")); - assertTrue("Wrong formatted choice", format.format( - new Object[] { new Integer(2), new Float(3.6) }).equals("3.6")); + assertEquals("Wrong choice format", + + "0.0#no|1.0#one|2.0#{1,number}", ((ChoiceFormat) format.getFormats()[0]).toPattern()); + assertEquals("Wrong choice pattern", + "{0,choice,0.0#no|1.0#one|2.0#{1,number}}", format.toPattern()); + assertEquals("Wrong formatted choice", "3.6", format.format( + new Object[] { new Integer(2), new Float(3.6) })); try { format.applyPattern("WRONG MESSAGE FORMAT {0,number,{}"); @@ -295,8 +295,8 @@ MessageFormat format = new MessageFormat("'{'choice'}'{0}"); MessageFormat clone = (MessageFormat) format.clone(); assertTrue("Clone not equal", format.equals(clone)); - assertTrue("Wrong answer", format.format(new Object[] {}).equals( - "{choice}{0}")); + assertEquals("Wrong answer", + "{choice}{0}", format.format(new Object[] {})); clone.setFormat(0, DateFormat.getInstance()); assertTrue("Clone shares format data", !format.equals(clone)); format = (MessageFormat) clone.clone(); @@ -344,7 +344,7 @@ StringBuffer buffer = new StringBuffer(); format.format(new Object[] { "0", new Double(53.863) }, buffer, new FieldPosition(0)); - assertTrue("Wrong result", buffer.toString().equals("54")); + assertEquals("Wrong result", "54", buffer.toString()); format .applyPattern("{0,choice,0#zero|1#one '{1,choice,2#two {2,time}}'}"); Date date = new Date(); @@ -643,7 +643,7 @@ mf = new MessageFormat("{0}; {0}; {0}"); String parse = "a; b; c"; result = mf.parse(parse, new ParsePosition(0)); - assertTrue("Wrong variable result", result[0].equals("c")); + assertEquals("Wrong variable result", "c", result[0]); } /** Index: modules/text/src/test/java/tests/api/java/text/NumberFormatTest.java =================================================================== --- modules/text/src/test/java/tests/api/java/text/NumberFormatTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/text/src/test/java/tests/api/java/text/NumberFormatTest.java 2006-04-16 11:47:22.000000000 +0100 @@ -200,7 +200,7 @@ public void test_getMaximumIntegerDigits() { NumberFormat format = NumberFormat.getInstance(); format.setMaximumIntegerDigits(2); - assertTrue("Wrong result", format.format(123).equals("23")); + assertEquals("Wrong result", "23", format.format(123)); } /** Index: modules/text/src/test/java/tests/api/java/text/SimpleDateFormatTest.java =================================================================== --- modules/text/src/test/java/tests/api/java/text/SimpleDateFormatTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/text/src/test/java/tests/api/java/text/SimpleDateFormatTest.java 2006-04-16 13:59:11.000000000 +0100 @@ -124,7 +124,7 @@ // Test for method java.text.SimpleDateFormat(java.lang.String) SimpleDateFormat f2 = new SimpleDateFormat("yyyy"); assertTrue("Wrong class", f2.getClass() == SimpleDateFormat.class); - assertTrue("Wrong pattern", f2.toPattern().equals("yyyy")); + assertEquals("Wrong pattern", "yyyy", f2.toPattern()); assertTrue("Wrong locale", f2.equals(new SimpleDateFormat("yyyy", Locale.getDefault()))); assertTrue("Wrong symbols", f2.getDateFormatSymbols().equals( @@ -168,7 +168,7 @@ symbols.setEras(new String[] { "Before", "After" }); SimpleDateFormat f2 = new SimpleDateFormat("y'y'yy", symbols); assertTrue("Wrong class", f2.getClass() == SimpleDateFormat.class); - assertTrue("Wrong pattern", f2.toPattern().equals("y'y'yy")); + assertEquals("Wrong pattern", "y'y'yy", f2.toPattern()); assertTrue("Wrong symbols", f2.getDateFormatSymbols().equals(symbols)); assertTrue("Doesn't work", f2.format(new Date()).getClass() == String.class); @@ -184,7 +184,7 @@ SimpleDateFormat f2 = new SimpleDateFormat("'yyyy' MM yy", Locale.GERMAN); assertTrue("Wrong class", f2.getClass() == SimpleDateFormat.class); - assertTrue("Wrong pattern", f2.toPattern().equals("'yyyy' MM yy")); + assertEquals("Wrong pattern", "'yyyy' MM yy", f2.toPattern()); assertTrue("Wrong symbols", f2.getDateFormatSymbols().equals( new DateFormatSymbols(Locale.GERMAN))); assertTrue("Doesn't work", @@ -243,7 +243,7 @@ // java.text.SimpleDateFormat.applyPattern(java.lang.String) SimpleDateFormat f2 = new SimpleDateFormat("y", new Locale("de", "CH")); f2.applyPattern("GyMdkHmsSEDFwWahKz"); - assertTrue("Wrong pattern", f2.toPattern().equals("GyMdkHmsSEDFwWahKz")); + assertEquals("Wrong pattern", "GyMdkHmsSEDFwWahKz", f2.toPattern()); // test invalid patterns try { @@ -483,7 +483,7 @@ test.test(" z", cal, " GMT-01:30", DateFormat.TIMEZONE_FIELD); format.applyPattern("'Mkz''':.@5"); - assertTrue("Wrong output", format.format(new Date()).equals("Mkz':.@5")); + assertEquals("Wrong output", "Mkz':.@5", format.format(new Date())); assertTrue("Tests failed", !test.testsFailed()); @@ -815,7 +815,7 @@ assertTrue("Not a clone", f1.getDateFormatSymbols() != symbols); String result = f1.format(new GregorianCalendar(1999, Calendar.JUNE, 12, 3, 0).getTime()); - assertTrue("Incorrect symbols used", result.equals("morning")); + assertEquals("Incorrect symbols used", "morning", result); symbols.setEras(new String[] { "before", "after" }); assertTrue("Identical symbols", !f1.getDateFormatSymbols().equals( symbols)); Index: modules/auth/src/test/java/common/javax/security/auth/login/LoginContextTest.java =================================================================== --- modules/auth/src/test/java/common/javax/security/auth/login/LoginContextTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/auth/src/test/java/common/javax/security/auth/login/LoginContextTest.java 2006-04-16 13:59:11.000000000 +0100 @@ -106,8 +106,7 @@ new LoginContext(moduleName); fail("No expected LoginException"); } catch (LoginException e) { - assertTrue("Default module", MyConfig.getLastAppName().equals( - "other")); + assertEquals("Default module", "other", MyConfig.getLastAppName()); } } @@ -315,8 +314,7 @@ new LoginContext(moduleName, handler); fail("No expected LoginException"); } catch (LoginException e) { - assertTrue("Default module", MyConfig.getLastAppName().equals( - "other")); + assertEquals("Default module", "other", MyConfig.getLastAppName()); } } @@ -454,8 +452,7 @@ new LoginContext(moduleName, subject); fail("No expected LoginException"); } catch (LoginException e) { - assertTrue("Default module", MyConfig.getLastAppName().equals( - "other")); + assertEquals("Default module", "other", MyConfig.getLastAppName()); } } @@ -651,8 +648,7 @@ new LoginContext(moduleName, subject, handler); fail("No expected LoginException"); } catch (LoginException e) { - assertTrue("Default module", MyConfig.getLastAppName().equals( - "other")); + assertEquals("Default module", "other", MyConfig.getLastAppName()); } } @@ -934,4 +930,4 @@ return false; } } -} \ No newline at end of file +} Index: modules/luni/src/test/java/tests/api/java/io/InputStreamReaderTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/io/InputStreamReaderTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/io/InputStreamReaderTest.java 2006-04-16 11:47:22.000000000 +0100 @@ -414,8 +414,8 @@ try { is = new InputStreamReader(fis, "8859_1"); } catch (UnsupportedEncodingException e) { - assertTrue("Returned incorrect encoding", is.getEncoding().equals( - "8859_1")); + assertEquals("Returned incorrect encoding", + "8859_1", is.getEncoding()); } } Index: modules/luni/src/test/java/tests/api/java/io/SerializablePermissionTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/io/SerializablePermissionTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/io/SerializablePermissionTest.java 2006-04-16 11:47:22.000000000 +0100 @@ -24,9 +24,9 @@ */ public void test_ConstructorLjava_lang_String() { // Test for method java.io.SerializablePermission(java.lang.String) - assertTrue("permission ill-formed", new SerializablePermission( - "enableSubclassImplementation").getName().equals( - "enableSubclassImplementation")); + assertEquals("permission ill-formed", + "enableSubclassImplementation", new SerializablePermission( + "enableSubclassImplementation").getName()); } /** @@ -36,9 +36,9 @@ public void test_ConstructorLjava_lang_StringLjava_lang_String() { // Test for method java.io.SerializablePermission(java.lang.String, // java.lang.String) - assertTrue("permission ill-formed", new SerializablePermission( - "enableSubclassImplementation", "").getName().equals( - "enableSubclassImplementation")); + assertEquals("permission ill-formed", + "enableSubclassImplementation", new SerializablePermission( + "enableSubclassImplementation", "").getName()); } /** Index: modules/luni/src/test/java/tests/api/java/lang/BooleanTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/lang/BooleanTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/lang/BooleanTest.java 2006-04-16 13:59:11.000000000 +0100 @@ -113,10 +113,10 @@ */ public void test_toString() { // Test for method java.lang.String java.lang.Boolean.toString() - assertTrue("Boolean true value printed wrong.", t.toString().equals( - "true")); - assertTrue("Boolean false value printed wrong.", f.toString().equals( - "false")); + assertEquals("Boolean true value printed wrong.", + "true", t.toString()); + assertEquals("Boolean false value printed wrong.", + "false", f.toString()); } /** Index: modules/luni/src/test/java/tests/api/java/lang/InternalErrorTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/lang/InternalErrorTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/lang/InternalErrorTest.java 2006-04-16 11:47:22.000000000 +0100 @@ -41,8 +41,8 @@ if (true) throw new InternalError("Test"); } catch (InternalError e) { - assertTrue("Returned incorrect message", e.getMessage().equals( - "Test")); + assertEquals("Returned incorrect message", + "Test", e.getMessage()); return; } fail("Failed to throw Runtime Exception"); Index: modules/luni/src/test/java/tests/api/java/lang/LinkageErrorTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/lang/LinkageErrorTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/lang/LinkageErrorTest.java 2006-04-16 11:47:22.000000000 +0100 @@ -27,8 +27,8 @@ } fail("Error not thrown."); } catch (LinkageError e) { - assertTrue("Error not initialized.", e.toString().equals( - "java.lang.LinkageError")); + assertEquals("Error not initialized.", + "java.lang.LinkageError", e.toString()); } } Index: modules/luni/src/test/java/tests/api/java/lang/NoClassDefFoundErrorTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/lang/NoClassDefFoundErrorTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/lang/NoClassDefFoundErrorTest.java 2006-04-16 11:47:22.000000000 +0100 @@ -27,8 +27,8 @@ } fail("Error not thrown."); } catch (NoClassDefFoundError e) { - assertTrue("Error not intitialized.", e.toString().equals( - "java.lang.NoClassDefFoundError")); + assertEquals("Error not intitialized.", + "java.lang.NoClassDefFoundError", e.toString()); } } Index: modules/luni/src/test/java/tests/api/java/lang/NoSuchFieldErrorTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/lang/NoSuchFieldErrorTest.java.orig 2006-04-16 11:47:21.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/lang/NoSuchFieldErrorTest.java 2006-04-16 11:47:22.000000000 +0100 @@ -26,8 +26,8 @@ throw new NoSuchFieldError(); } catch (NoSuchFieldError e) { assertNull("Initializer failed.", e.getMessage()); - assertTrue("To string failed.", e.toString().equals( - "java.lang.NoSuchFieldError")); + assertEquals("To string failed.", + "java.lang.NoSuchFieldError", e.toString()); } } Index: modules/luni/src/test/java/tests/api/java/lang/NoSuchMethodErrorTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/lang/NoSuchMethodErrorTest.java.orig 2006-04-16 11:47:21.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/lang/NoSuchMethodErrorTest.java 2006-04-16 11:47:22.000000000 +0100 @@ -26,8 +26,8 @@ throw new NoSuchMethodError(); } catch (NoSuchMethodError e) { assertNull("Initializer failed.", e.getMessage()); - assertTrue("To string failed.", e.toString().equals( - "java.lang.NoSuchMethodError")); + assertEquals("To string failed.", + "java.lang.NoSuchMethodError", e.toString()); } } Index: modules/luni/src/test/java/tests/api/java/lang/RuntimeExceptionTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/lang/RuntimeExceptionTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/lang/RuntimeExceptionTest.java 2006-04-16 11:47:22.000000000 +0100 @@ -44,8 +44,8 @@ if (true) throw new RuntimeException("Runtime message"); } catch (RuntimeException e) { - assertTrue("Incorrect message", e.getMessage().equals( - "Runtime message")); + assertEquals("Incorrect message", + "Runtime message", e.getMessage()); return; } fail("Failed to throw Runtime Exception"); Index: modules/luni/src/test/java/tests/api/java/lang/RuntimePermissionTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/lang/RuntimePermissionTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/lang/RuntimePermissionTest.java 2006-04-16 11:47:22.000000000 +0100 @@ -23,8 +23,8 @@ public void test_ConstructorLjava_lang_String() { // Test for method java.lang.RuntimePermission(java.lang.String) RuntimePermission r = new RuntimePermission("createClassLoader"); - assertTrue("Returned incorrect name", r.getName().equals( - "createClassLoader")); + assertEquals("Returned incorrect name", + "createClassLoader", r.getName()); } @@ -36,8 +36,8 @@ // Test for method java.lang.RuntimePermission(java.lang.String, // java.lang.String) RuntimePermission r = new RuntimePermission("createClassLoader", null); - assertTrue("Returned incorrect name", r.getName().equals( - "createClassLoader")); + assertEquals("Returned incorrect name", + "createClassLoader", r.getName()); } /** Index: modules/luni/src/test/java/tests/api/java/lang/UnknownErrorTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/lang/UnknownErrorTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/lang/UnknownErrorTest.java 2006-04-16 11:47:22.000000000 +0100 @@ -40,8 +40,8 @@ if (true) throw new UnknownError("Unknown"); } catch (UnknownError e) { - assertTrue(" Incorrect msg string ", e.getMessage().equals( - "Unknown")); + assertEquals(" Incorrect msg string ", + "Unknown", e.getMessage()); return; } fail("Failed to generate error"); Index: modules/luni/src/test/java/tests/api/java/lang/UnsatisfiedLinkErrorTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/lang/UnsatisfiedLinkErrorTest.java.orig 2006-04-16 11:47:21.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/lang/UnsatisfiedLinkErrorTest.java 2006-04-16 14:00:48.000000000 +0100 @@ -27,8 +27,8 @@ throw new UnsatisfiedLinkError(); } catch (UnsatisfiedLinkError e) { assertNull("Initializer failed.", e.getMessage()); - assertTrue("To string failed.", e.toString().equals( - "java.lang.UnsatisfiedLinkError")); + assertEquals("To string failed.", + "java.lang.UnsatisfiedLinkError", e.toString()); } } @@ -47,7 +47,7 @@ assertTrue("Does not throw UnsatisfiedLinkError", exception); UnsatisfiedLinkError err = new UnsatisfiedLinkError("my message"); - assertTrue("Incorrect message", "my message".equals(err.getMessage())); + assertEquals("Incorrect message", "my message", err.getMessage()); } protected void setUp() { Index: modules/luni/src/test/java/tests/api/java/lang/UnsupportedOperationExceptionTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/lang/UnsupportedOperationExceptionTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/lang/UnsupportedOperationExceptionTest.java 2006-04-16 11:47:22.000000000 +0100 @@ -54,8 +54,8 @@ try { throw new UnsupportedOperationException("HelloWorld"); } catch (UnsupportedOperationException e) { - assertTrue("Wrong message given.", e.getMessage().equals( - "HelloWorld")); + assertEquals("Wrong message given.", + "HelloWorld", e.getMessage()); return; } catch (Exception e) { fail("Exception during Constructor : " + e.getMessage()); Index: modules/luni/src/test/java/tests/api/java/lang/VerifyErrorTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/lang/VerifyErrorTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/lang/VerifyErrorTest.java 2006-04-16 11:47:22.000000000 +0100 @@ -38,8 +38,8 @@ if (true) throw new VerifyError("HelloWorld"); } catch (VerifyError e) { - assertTrue("VerifyError(String) failed.", e.getMessage().equals( - "HelloWorld")); + assertEquals("VerifyError(String) failed.", + "HelloWorld", e.getMessage()); return; } fail("Constructor failed"); Index: modules/luni/src/test/java/tests/api/java/lang/VirtualMachineErrorTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/lang/VirtualMachineErrorTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/lang/VirtualMachineErrorTest.java 2006-04-16 11:47:22.000000000 +0100 @@ -51,8 +51,8 @@ if (true) throw new TestVirtualMachineError("HelloWorld"); } catch (VirtualMachineError e) { - assertTrue("VerifyError(String) failed.", e.getMessage().equals( - "HelloWorld")); + assertEquals("VerifyError(String) failed.", + "HelloWorld", e.getMessage()); return; } fail("Constructor failed"); Index: modules/luni/src/test/java/tests/api/java/lang/reflect/FieldTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/lang/reflect/FieldTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/lang/reflect/FieldTest.java 2006-04-16 14:00:48.000000000 +0100 @@ -749,8 +749,8 @@ } catch (Exception e) { fail("Exception during getType test : " + e.getMessage()); } - assertTrue("Returned incorrect field name", f.getName().equals( - "shortField")); + assertEquals("Returned incorrect field name", + "shortField", f.getName()); } /** @@ -1183,12 +1183,11 @@ } catch (Exception e) { fail("Exception getting field : " + e.getMessage()); } - assertTrue( - "Field returned incorrect string", - f + assertEquals("Field returned incorrect string", + + "private static final int tests.api.java.lang.reflect.FieldTest$TestField.x", f .toString() - .equals( - "private static final int tests.api.java.lang.reflect.FieldTest$TestField.x")); + ); } /** Index: modules/luni/src/test/java/tests/api/java/lang/reflect/MethodTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/lang/reflect/MethodTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/lang/reflect/MethodTest.java 2006-04-16 13:59:11.000000000 +0100 @@ -267,8 +267,8 @@ } catch (Exception e) { fail("Exception during getMethodName(): " + e.toString()); } - assertTrue("Returned incorrect method name", mth.getName().equals( - "voidMethod")); + assertEquals("Returned incorrect method name", + "voidMethod", mth.getName()); } /** Index: modules/luni/src/test/java/tests/api/java/net/NetPermissionTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/net/NetPermissionTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/net/NetPermissionTest.java 2006-04-16 11:47:22.000000000 +0100 @@ -25,8 +25,8 @@ public void test_ConstructorLjava_lang_String() { // Test for method java.net.NetPermission(java.lang.String) NetPermission n = new NetPermission("requestPasswordAuthentication"); - assertTrue("Returned incorrect name", n.getName().equals( - "requestPasswordAuthentication")); + assertEquals("Returned incorrect name", + "requestPasswordAuthentication", n.getName()); } /** @@ -38,8 +38,8 @@ // java.lang.String) NetPermission n = new NetPermission("requestPasswordAuthentication", null); - assertTrue("Returned incorrect name", n.getName().equals( - "requestPasswordAuthentication")); + assertEquals("Returned incorrect name", + "requestPasswordAuthentication", n.getName()); } /** Index: modules/luni/src/test/java/tests/api/java/util/ArrayListTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/util/ArrayListTest.java.orig 2006-04-16 11:47:21.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/util/ArrayListTest.java 2006-04-16 13:59:11.000000000 +0100 @@ -129,10 +129,10 @@ assertTrue("Incorrect size: " + alist.size(), alist.size() == 205); assertNull("Item at slot 100 should be null", alist.get(100)); assertNull("Item at slot 101 should be null", alist.get(101)); - 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")); + 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); Index: modules/security/src/test/java/common/tests/api/java/security/ProviderExceptionTest.java =================================================================== --- modules/security/src/test/java/common/tests/api/java/security/ProviderExceptionTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/security/src/test/java/common/tests/api/java/security/ProviderExceptionTest.java 2006-04-16 11:47:22.000000000 +0100 @@ -35,8 +35,8 @@ public void test_ConstructorLjava_lang_String() { // Test for method java.security.ProviderException(java.lang.String) ProviderException e = new ProviderException("test message"); - assertTrue("Failed toString test for constructed instance", e - .toString().equals( - "java.security.ProviderException: test message")); + assertEquals("Failed toString test for constructed instance", + "java.security.ProviderException: test message", e + .toString()); } } \ No newline at end of file Index: modules/text/src/test/java/tests/api/java/text/AnnotationTest.java =================================================================== --- modules/text/src/test/java/tests/api/java/text/AnnotationTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/text/src/test/java/tests/api/java/text/AnnotationTest.java 2006-04-16 11:47:22.000000000 +0100 @@ -61,8 +61,8 @@ */ public void test_toString() { ant = new Annotation("HelloWorld"); - assertTrue("toString error.", ant.toString().equals( - "java.text.Annotation[value=HelloWorld]")); + assertEquals("toString error.", + "java.text.Annotation[value=HelloWorld]", ant.toString()); } protected void setUp() { Index: modules/text/src/test/java/tests/api/java/text/ParsePositionTest.java =================================================================== --- modules/text/src/test/java/tests/api/java/text/ParsePositionTest.java.orig 2006-04-16 11:46:59.000000000 +0100 +++ modules/text/src/test/java/tests/api/java/text/ParsePositionTest.java 2006-04-16 13:59:11.000000000 +0100 @@ -99,8 +99,8 @@ */ public void test_toString() { // Test for method java.lang.String java.text.ParsePosition.toString() - assertTrue("toString failed.", pp.toString().equals( - "java.text.ParsePosition[index=2147483647, errorIndex=-1]")); + assertEquals("toString failed.", + "java.text.ParsePosition[index=2147483647, errorIndex=-1]", pp.toString()); } /** Index: modules/auth/src/test/java/common/javax/security/auth/PrivateCredentialPermissionTest.java =================================================================== --- modules/auth/src/test/java/common/javax/security/auth/PrivateCredentialPermissionTest.java.orig 2006-04-16 13:59:57.000000000 +0100 +++ modules/auth/src/test/java/common/javax/security/auth/PrivateCredentialPermissionTest.java 2006-04-16 14:00:48.000000000 +0100 @@ -708,7 +708,7 @@ PrivateCredentialPermission p = new PrivateCredentialPermission( "a b \"c c\"", "read"); - assertTrue("Principal name:", "c c".equals(p.getPrincipals()[0][1])); + assertEquals("Principal name:", "c c", p.getPrincipals()[0][1]); } public final void testSerialization_Wildcard() throws Exception { @@ -747,12 +747,12 @@ PrivateCredentialPermission p = (PrivateCredentialPermission) sIn .readObject(); - assertTrue("CredentialClass ", "a".equals(p.getCredentialClass())); + assertEquals("CredentialClass ", "a", p.getCredentialClass()); String[][] principals = p.getPrincipals(); assertTrue("Size:", principals.length == 1); - assertTrue("PrincipalClass:", "b".equals(principals[0][0])); - assertTrue("PrincipalName:", "c".equals(principals[0][1])); + assertEquals("PrincipalClass:", "b", principals[0][0]); + assertEquals("PrincipalName:", "c", principals[0][1]); } public final void testSerialization_Self() throws Exception { @@ -763,12 +763,12 @@ PrivateCredentialPermission p = (PrivateCredentialPermission) sIn .readObject(); - assertTrue("CredentialClass ", "a".equals(p.getCredentialClass())); + assertEquals("CredentialClass ", "a", p.getCredentialClass()); String[][] principals = p.getPrincipals(); assertTrue("Size:", principals.length == 1); - assertTrue("PrincipalClass:", "b".equals(principals[0][0])); - assertTrue("PrincipalName:", "c".equals(principals[0][1])); + assertEquals("PrincipalClass:", "b", principals[0][0]); + assertEquals("PrincipalName:", "c", principals[0][1]); } // Golden: PrivateCredentialPermission("a b \"c\"","read"); Index: modules/luni/src/test/java/tests/api/java/io/CharArrayWriterTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/io/CharArrayWriterTest.java.orig 2006-04-16 13:59:57.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/io/CharArrayWriterTest.java 2006-04-16 14:00:48.000000000 +0100 @@ -101,8 +101,8 @@ try { char[] c = new char[100]; cr.read(c, 0, 10); - assertTrue("toCharArray failed to return correct array", - "HelloWorld".equals(new String(c, 0, 10))); + assertEquals("toCharArray failed to return correct array", + "HelloWorld", new String(c, 0, 10)); } catch (IOException e) { fail("Exception during toCharArray test : " + e.getMessage()); } @@ -115,7 +115,7 @@ // Test for method java.lang.String java.io.CharArrayWriter.toString() cw.write("HelloWorld", 5, 5); cr = new CharArrayReader(cw.toCharArray()); - assertTrue("Returned incorrect string", "World".equals(cw.toString())); + assertEquals("Returned incorrect string", "World", cw.toString()); } /** Index: modules/luni/src/test/java/tests/api/java/io/CharConversionExceptionTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/io/CharConversionExceptionTest.java.orig 2006-04-16 11:47:21.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/io/CharConversionExceptionTest.java 2006-04-16 14:00:48.000000000 +0100 @@ -45,9 +45,8 @@ throw new java.io.CharConversionException("Blah"); fail("Exception not thrown"); } catch (java.io.CharConversionException e) { - assertTrue( - "Exception defined with no message answers non-null to getMessage()", - e.getMessage().equals("Blah")); + assertEquals("Exception defined with no message answers non-null to getMessage()", + "Blah", e.getMessage()); } } Index: modules/luni/src/test/java/tests/api/java/io/LineNumberReaderTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/io/LineNumberReaderTest.java.orig 2006-04-16 13:59:57.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/io/LineNumberReaderTest.java 2006-04-16 14:00:48.000000000 +0100 @@ -136,7 +136,7 @@ } catch (IOException e) { fail("Exception during getLineNumberTest: " + e.toString()); } - assertTrue("Returned incorrect string", "1".equals(line)); + assertEquals("Returned incorrect string", "1", line); assertTrue("Returned incorrect line number :" + lnr.getLineNumber(), lnr.getLineNumber() == 2); } @@ -157,7 +157,7 @@ } catch (IOException e) { fail("Exception during getLineNumberTest: " + e.toString()); } - assertTrue("Failed to reset reader", "0".equals(line)); + assertEquals("Failed to reset reader", "0", line); } /** Index: modules/luni/src/test/java/tests/api/java/io/PipedWriterTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/io/PipedWriterTest.java.orig 2006-04-16 13:59:57.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/io/PipedWriterTest.java 2006-04-16 14:00:48.000000000 +0100 @@ -159,8 +159,8 @@ } catch (Exception e) { fail("Exception during flush test : " + e.getMessage()); } - assertTrue("Failed to flush chars", "HelloWorld".equals(new String( - reader.buf))); + assertEquals("Failed to flush chars", "HelloWorld", new String( + reader.buf)); } /** Index: modules/luni/src/test/java/tests/api/java/io/RandomAccessFileTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/io/RandomAccessFileTest.java.orig 2006-04-16 13:59:57.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/io/RandomAccessFileTest.java 2006-04-16 14:00:48.000000000 +0100 @@ -470,8 +470,8 @@ raf.seek(0); raf.skipBytes(5); raf.readFully(buf); - assertTrue("Failed to skip bytes", "World".equals(new String(buf, - 0, 5))); + assertEquals("Failed to skip bytes", "World", new String(buf, + 0, 5)); raf.close(); } catch (java.io.IOException e) { fail("skipBytes threw an IOException : " + e.getMessage()); Index: modules/luni/src/test/java/tests/api/java/lang/IllegalArgumentExceptionTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/lang/IllegalArgumentExceptionTest.java.orig 2006-04-16 11:47:21.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/lang/IllegalArgumentExceptionTest.java 2006-04-16 14:00:48.000000000 +0100 @@ -54,9 +54,8 @@ // Test for method java.lang.IllegalArgumentException(java.lang.String) IllegalArgumentException ill = new IllegalArgumentException( "testing illArg exception"); - assertTrue( - "failed to create instance of illegalArgumentException(string)", - ill.getMessage().equals("testing illArg exception")); + assertEquals("failed to create instance of illegalArgumentException(string)", + "testing illArg exception", ill.getMessage()); } /** Index: modules/luni/src/test/java/tests/api/java/lang/IllegalStateExceptionTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/lang/IllegalStateExceptionTest.java.orig 2006-04-16 11:47:21.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/lang/IllegalStateExceptionTest.java 2006-04-16 14:00:48.000000000 +0100 @@ -46,9 +46,8 @@ // Test for method java.lang.IllegalStateException(java.lang.String) IllegalStateException ill = new IllegalStateException( "testing illState exception"); - assertTrue( - "failed to create instance of illegalStateException(string)", - ill.getMessage().equals("testing illState exception")); + assertEquals("failed to create instance of illegalStateException(string)", + "testing illState exception", ill.getMessage()); } /** Index: modules/math/src/test/java/tests/api/java/math/BigIntegerTest.java =================================================================== --- modules/math/src/test/java/tests/api/java/math/BigIntegerTest.java.orig 2006-04-16 13:59:57.000000000 +0100 +++ modules/math/src/test/java/tests/api/java/math/BigIntegerTest.java 2006-04-16 14:00:48.000000000 +0100 @@ -759,8 +759,8 @@ * @tests java.math.BigInteger#toString() */ public void test_toString() { - assertTrue("0.toString", "0".equals(BigInteger.valueOf(0).toString())); - assertTrue("1.toString", "1".equals(BigInteger.valueOf(1).toString())); + assertEquals("0.toString", "0", BigInteger.valueOf(0).toString()); + assertEquals("1.toString", "1", BigInteger.valueOf(1).toString()); assertTrue("12345678901234.toString", "12345678901234" .equals(BigInteger.valueOf(12345678901234L).toString())); assertTrue("-1.toString", "-1" @@ -773,18 +773,18 @@ * @tests java.math.BigInteger#toString(int) */ public void test_toStringI() { - assertTrue("0.toString(16)", "0".equals(BigInteger.valueOf(0).toString( - 16))); - assertTrue("1.toString(16)", "1".equals(BigInteger.valueOf(1).toString( - 16))); + assertEquals("0.toString(16)", "0", BigInteger.valueOf(0).toString( + 16)); + assertEquals("1.toString(16)", "1", BigInteger.valueOf(1).toString( + 16)); assertTrue("ABF345678901234.toString(16)", "abf345678901234" .equals(BigInteger.valueOf(0xABF345678901234L).toString(16))); - assertTrue("-1.toString(16)", "-1".equals(BigInteger.valueOf(-1) - .toString(16))); + assertEquals("-1.toString(16)", "-1", BigInteger.valueOf(-1) + .toString(16)); assertTrue("-ABF345678901234.toString(16)", "-abf345678901234" .equals(BigInteger.valueOf(-0xABF345678901234L).toString(16))); - assertTrue("-101010101.toString(2)", "-101010101".equals(BigInteger - .valueOf(-341).toString(2))); + assertEquals("-101010101.toString(2)", "-101010101", BigInteger + .valueOf(-341).toString(2)); } /** Index: modules/security/src/test/java/common/java/security/cert/LDAPCertStoreParametersTest.java =================================================================== --- modules/security/src/test/java/common/java/security/cert/LDAPCertStoreParametersTest.java.orig 2006-04-16 13:59:57.000000000 +0100 +++ modules/security/src/test/java/common/java/security/cert/LDAPCertStoreParametersTest.java 2006-04-16 14:00:48.000000000 +0100 @@ -60,7 +60,7 @@ */ public final void testLDAPCertStoreParameters02() { LDAPCertStoreParameters cp = new LDAPCertStoreParameters(); - assertTrue("host", "localhost".equals(cp.getServerName())); + assertEquals("host", "localhost", cp.getServerName()); assertTrue("port", cp.getPort() == 389); } Index: modules/security/src/test/java/common/org/apache/harmony/security/asn1/der/DerGeneralizedTimeEDTest.java =================================================================== --- modules/security/src/test/java/common/org/apache/harmony/security/asn1/der/DerGeneralizedTimeEDTest.java.orig 2006-04-16 13:59:57.000000000 +0100 +++ modules/security/src/test/java/common/org/apache/harmony/security/asn1/der/DerGeneralizedTimeEDTest.java 2006-04-16 14:00:48.000000000 +0100 @@ -61,21 +61,21 @@ encoded = new DerOutputStream(gTime, myDate).encoded; rep = new String(encoded, 2, encoded[1] & 0xff); - assertTrue("2 fraction", "20041202093934.18Z".equals(rep)); + assertEquals("2 fraction", "20041202093934.18Z", rep); // 1 digit fractional seconds (last 2 0s must be trimmed out) myDate = getGmtDate(1101980374100L); encoded = new DerOutputStream(gTime, myDate).encoded; rep = new String(encoded, 2, encoded[1] & 0xff); - assertTrue("1 fraction", "20041202093934.1Z".equals(rep)); + assertEquals("1 fraction", "20041202093934.1Z", rep); // no fractional seconds (last 3 0s and "." must be trimmed out) myDate = getGmtDate(1101980374000L); encoded = new DerOutputStream(gTime, myDate).encoded; rep = new String(encoded, 2, encoded[1] & 0xff); - assertTrue("no fraction", "20041202093934Z".equals(rep)); + assertEquals("no fraction", "20041202093934Z", rep); // midnight SimpleDateFormat sdf = @@ -85,7 +85,7 @@ encoded = new DerOutputStream(gTime, myDate).encoded; rep = new String(encoded, 2, encoded[1] & 0xff); - assertTrue("midnight", "20040606000000Z".equals(rep)); + assertEquals("midnight", "20040606000000Z", rep); } /** Index: modules/security/src/test/java/common/org/apache/harmony/security/asn1/der/DerUTCTimeEDTest.java =================================================================== --- modules/security/src/test/java/common/org/apache/harmony/security/asn1/der/DerUTCTimeEDTest.java.orig 2006-04-16 13:59:57.000000000 +0100 +++ modules/security/src/test/java/common/org/apache/harmony/security/asn1/der/DerUTCTimeEDTest.java 2006-04-16 14:00:48.000000000 +0100 @@ -56,7 +56,7 @@ byte[] encoded = new DerOutputStream(uTime, myDate).encoded; String rep = new String(encoded, 2, encoded[1] & 0xff); - assertTrue("no fraction", "041202093934Z".equals(rep)); + assertEquals("no fraction", "041202093934Z", rep); // midnight SimpleDateFormat sdf = @@ -66,7 +66,7 @@ encoded = new DerOutputStream(uTime, myDate).encoded; rep = new String(encoded, 2, encoded[1] & 0xff); - assertTrue("midnight", "040606000000Z".equals(rep)); + assertEquals("midnight", "040606000000Z", rep); } /** Index: modules/logging/src/test/java/tests/api/java/util/logging/StreamHandlerTest.java =================================================================== --- modules/logging/src/test/java/tests/api/java/util/logging/StreamHandlerTest.java.orig 2006-04-16 10:18:59.000000000 +0100 +++ modules/logging/src/test/java/tests/api/java/util/logging/StreamHandlerTest.java 2006-04-16 14:03:19.000000000 +0100 @@ -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() + ); } /* Index: modules/luni/src/test/java/tests/api/java/lang/AssertionErrorTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/lang/AssertionErrorTest.java.orig 2006-04-16 11:47:21.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/lang/AssertionErrorTest.java 2006-04-16 14:03:19.000000000 +0100 @@ -22,7 +22,7 @@ public void test_ObjectConstructor() { AssertionError error = new AssertionError(new String("hi")); assertNull("non-null cause", error.getCause()); - assertTrue(error.getMessage().equals("hi")); + assertEquals("hi", error.getMessage()); Exception exc = new NullPointerException(); error = new AssertionError(exc); assertTrue("non-null cause", error.getCause() == exc); Index: modules/luni/src/test/java/tests/api/java/lang/ProcessTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/lang/ProcessTest.java.orig 2006-04-16 09:44:43.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/lang/ProcessTest.java 2006-04-16 14:03:19.000000000 +0100 @@ -54,7 +54,7 @@ proc.waitFor(); Support_Exec.checkStderr(execArgs); proc.destroy(); - assertTrue(msg.toString(), msg.toString().equals("true")); + assertEquals("true", msg.toString(), msg.toString()); } catch (IOException e) { fail("IOException executing avail test: " + e); } catch (InterruptedException e) { Index: modules/regex/src/test/java/tests/api/java/util/regex/ModeTest.java =================================================================== --- modules/regex/src/test/java/tests/api/java/util/regex/ModeTest.java.orig 2006-04-16 09:44:44.000000000 +0100 +++ modules/regex/src/test/java/tests/api/java/util/regex/ModeTest.java 2006-04-16 14:03:19.000000000 +0100 @@ -32,25 +32,25 @@ p = Pattern.compile("([a-z]+)[0-9]+"); m = p.matcher("cAT123#dog345"); assertTrue(m.find()); - assertTrue(m.group(1).equals("dog")); + assertEquals("dog", m.group(1)); assertFalse(m.find()); p = Pattern.compile("([a-z]+)[0-9]+", Pattern.CASE_INSENSITIVE); m = p.matcher("cAt123#doG345"); assertTrue(m.find()); - assertTrue(m.group(1).equals("cAt")); + assertEquals("cAt", m.group(1)); assertTrue(m.find()); - assertTrue(m.group(1).equals("doG")); + assertEquals("doG", m.group(1)); assertFalse(m.find()); p = Pattern.compile("(?i)([a-z]+)[0-9]+"); m = p.matcher("cAt123#doG345"); assertTrue(m.find()); - assertTrue(m.group(1).equals("cAt")); + assertEquals("cAt", m.group(1)); assertTrue(m.find()); - assertTrue(m.group(1).equals("doG")); + assertEquals("doG", m.group(1)); assertFalse(m.find()); } @@ -81,35 +81,35 @@ p = Pattern.compile("^foo([0-9]*)", Pattern.MULTILINE); m = p.matcher("foo1bar\nfoo2foo3\nbarfoo4"); assertTrue(m.find()); - assertTrue(m.group(1).equals("1")); + assertEquals("1", m.group(1)); assertTrue(m.find()); - assertTrue(m.group(1).equals("2")); + assertEquals("2", m.group(1)); assertFalse(m.find()); p = Pattern.compile("foo([0-9]*)$", Pattern.MULTILINE); m = p.matcher("foo1bar\nfoo2foo3\nbarfoo4"); assertTrue(m.find()); - assertTrue(m.group(1).equals("3")); + assertEquals("3", m.group(1)); assertTrue(m.find()); - assertTrue(m.group(1).equals("4")); + assertEquals("4", m.group(1)); assertFalse(m.find()); p = Pattern.compile("(?m)^foo([0-9]*)"); m = p.matcher("foo1bar\nfoo2foo3\nbarfoo4"); assertTrue(m.find()); - assertTrue(m.group(1).equals("1")); + assertEquals("1", m.group(1)); assertTrue(m.find()); - assertTrue(m.group(1).equals("2")); + assertEquals("2", m.group(1)); assertFalse(m.find()); p = Pattern.compile("(?m)foo([0-9]*)$"); m = p.matcher("foo1bar\nfoo2foo3\nbarfoo4"); assertTrue(m.find()); - assertTrue(m.group(1).equals("3")); + assertEquals("3", m.group(1)); assertTrue(m.find()); - assertTrue(m.group(1).equals("4")); + assertEquals("4", m.group(1)); assertFalse(m.find()); } } Index: modules/regex/src/test/java/tests/api/java/util/regex/PatternTest.java =================================================================== --- modules/regex/src/test/java/tests/api/java/util/regex/PatternTest.java.orig 2006-04-16 09:44:44.000000000 +0100 +++ modules/regex/src/test/java/tests/api/java/util/regex/PatternTest.java 2006-04-16 14:03:19.000000000 +0100 @@ -119,10 +119,10 @@ assertTrue(m.end(1) == 2); assertTrue(m.start(2) == 3); assertTrue(m.end(2) == 5); - assertTrue(m.group().equals("p1#q3")); - assertTrue(m.group(0).equals("p1#q3")); - assertTrue(m.group(1).equals("p1")); - assertTrue(m.group(2).equals("q3")); + assertEquals("p1#q3", m.group()); + assertEquals("p1#q3", m.group(0)); + assertEquals("p1", m.group(1)); + assertEquals("q3", m.group(2)); assertTrue(m.find()); assertTrue(m.start() == 5); @@ -133,10 +133,10 @@ assertTrue(m.end(1) == 7); assertTrue(m.start(2) == 7); assertTrue(m.end(2) == 10); - assertTrue(m.group().equals("p2q42")); - assertTrue(m.group(0).equals("p2q42")); - assertTrue(m.group(1).equals("p2")); - assertTrue(m.group(2).equals("q42")); + assertEquals("p2q42", m.group()); + assertEquals("p2q42", m.group(0)); + assertEquals("p2", m.group(1)); + assertEquals("q42", m.group(2)); assertTrue(m.find()); assertTrue(m.start() == 15); @@ -148,10 +148,10 @@ assertTrue(m.end(1) == 18); assertTrue(m.start(2) == 19); assertTrue(m.end(2) == 23); - assertTrue(m.group().equals("p63#q888")); - assertTrue(m.group(0).equals("p63#q888")); - assertTrue(m.group(1).equals("p63")); - assertTrue(m.group(2).equals("q888")); + assertEquals("p63#q888", m.group()); + assertEquals("p63#q888", m.group(0)); + assertEquals("p63", m.group(1)); + assertEquals("q888", m.group(2)); assertFalse(m.find()); } @@ -210,42 +210,42 @@ p = Pattern.compile("([a-z]+)\\\\([a-z]+);"); m = p.matcher("fred\\ginger;abbott\\costello;jekell\\hyde;"); assertTrue(m.find()); - assertTrue(m.group(1).equals("fred")); - assertTrue(m.group(2).equals("ginger")); + assertEquals("fred", m.group(1)); + assertEquals("ginger", m.group(2)); assertTrue(m.find()); - assertTrue(m.group(1).equals("abbott")); - assertTrue(m.group(2).equals("costello")); + assertEquals("abbott", m.group(1)); + assertEquals("costello", m.group(2)); assertTrue(m.find()); - assertTrue(m.group(1).equals("jekell")); - assertTrue(m.group(2).equals("hyde")); + assertEquals("jekell", m.group(1)); + assertEquals("hyde", m.group(2)); assertFalse(m.find()); // Test \n, \t, \r, \f, \e, \a sequences p = Pattern.compile("([a-z]+)[\\n\\t\\r\\f\\e\\a]+([a-z]+)"); m = p.matcher("aa\nbb;cc\u0009\rdd;ee\u000C\u001Bff;gg\n\u0007hh"); assertTrue(m.find()); - assertTrue(m.group(1).equals("aa")); - assertTrue(m.group(2).equals("bb")); + assertEquals("aa", m.group(1)); + assertEquals("bb", m.group(2)); assertTrue(m.find()); - assertTrue(m.group(1).equals("cc")); - assertTrue(m.group(2).equals("dd")); + assertEquals("cc", m.group(1)); + assertEquals("dd", m.group(2)); assertTrue(m.find()); - assertTrue(m.group(1).equals("ee")); - assertTrue(m.group(2).equals("ff")); + assertEquals("ee", m.group(1)); + assertEquals("ff", m.group(2)); assertTrue(m.find()); - assertTrue(m.group(1).equals("gg")); - assertTrue(m.group(2).equals("hh")); + assertEquals("gg", m.group(1)); + assertEquals("hh", m.group(2)); assertFalse(m.find()); // Test \\u and \\x sequences p = Pattern.compile("([0-9]+)[\\u0020:\\x21];"); m = p.matcher("11:;22 ;33-;44!;"); assertTrue(m.find()); - assertTrue(m.group(1).equals("11")); + assertEquals("11", m.group(1)); assertTrue(m.find()); - assertTrue(m.group(1).equals("22")); + assertEquals("22", m.group(1)); assertTrue(m.find()); - assertTrue(m.group(1).equals("44")); + assertEquals("44", m.group(1)); assertFalse(m.find()); // Test invalid unicode sequences @@ -302,11 +302,11 @@ p = Pattern.compile("([0-9]+)[\\07\\040\\0160];"); m = p.matcher("11\u0007;22:;33 ;44p;"); assertTrue(m.find()); - assertTrue(m.group(1).equals("11")); + assertEquals("11", m.group(1)); assertTrue(m.find()); - assertTrue(m.group(1).equals("33")); + assertEquals("33", m.group(1)); assertTrue(m.find()); - assertTrue(m.group(1).equals("44")); + assertEquals("44", m.group(1)); assertFalse(m.find()); // Test invalid octal sequences @@ -341,13 +341,13 @@ p = Pattern.compile("([0-9]+)[\\cA\\cB\\cC\\cD];"); m = p.matcher("11\u0001;22:;33\u0002;44p;55\u0003;66\u0004;"); assertTrue(m.find()); - assertTrue(m.group(1).equals("11")); + assertEquals("11", m.group(1)); assertTrue(m.find()); - assertTrue(m.group(1).equals("33")); + assertEquals("33", m.group(1)); assertTrue(m.find()); - assertTrue(m.group(1).equals("55")); + assertEquals("55", m.group(1)); assertTrue(m.find()); - assertTrue(m.group(1).equals("66")); + assertEquals("66", m.group(1)); assertFalse(m.find()); // More thorough control escape test @@ -1012,7 +1012,7 @@ p = Pattern.compile("[a-z]+;(foo[0-9]-\\Q(...)\\E);[0-9]+"); m = p.matcher("abc;foo5-(...);123"); assertTrue(m.matches()); - assertTrue(m.group(1).equals("foo5-(...)")); + assertEquals("foo5-(...)", m.group(1)); m = p.matcher("abc;foo9-(xxx);789"); assertFalse(m.matches()); @@ -1069,14 +1069,14 @@ p = Pattern.compile("a$"); m = p.matcher("a\n"); assertTrue(m.find()); - assertTrue(m.group().equals("a")); + assertEquals("a", m.group()); assertFalse(m.find()); p = Pattern.compile("(a$)"); m = p.matcher("a\n"); assertTrue(m.find()); - assertTrue(m.group().equals("a")); - assertTrue(m.group(1).equals("a")); + assertEquals("a", m.group()); + assertEquals("a", m.group(1)); assertFalse(m.find()); p = Pattern.compile("^.*$", Pattern.MULTILINE); @@ -1084,24 +1084,24 @@ m = p.matcher("a\n"); assertTrue(m.find()); // System.out.println("["+m.group()+"]"); - assertTrue(m.group().equals("a")); + assertEquals("a", m.group()); assertFalse(m.find()); m = p.matcher("a\nb\n"); assertTrue(m.find()); // System.out.println("["+m.group()+"]"); - assertTrue(m.group().equals("a")); + assertEquals("a", m.group()); assertTrue(m.find()); // System.out.println("["+m.group()+"]"); - assertTrue(m.group().equals("b")); + assertEquals("b", m.group()); assertFalse(m.find()); m = p.matcher("a\nb"); assertTrue(m.find()); // System.out.println("["+m.group()+"]"); - assertTrue(m.group().equals("a")); + assertEquals("a", m.group()); assertTrue(m.find()); - assertTrue(m.group().equals("b")); + assertEquals("b", m.group()); assertFalse(m.find()); m = p.matcher("\naa\r\nbb\rcc\n\n"); @@ -1110,13 +1110,13 @@ assertTrue(m.group().equals("")); assertTrue(m.find()); // System.out.println("["+m.group()+"]"); - assertTrue(m.group().equals("aa")); + assertEquals("aa", m.group()); assertTrue(m.find()); // System.out.println("["+m.group()+"]"); - assertTrue(m.group().equals("bb")); + assertEquals("bb", m.group()); assertTrue(m.find()); // System.out.println("["+m.group()+"]"); - assertTrue(m.group().equals("cc")); + assertEquals("cc", m.group()); assertTrue(m.find()); // System.out.println("["+m.group()+"]"); assertTrue(m.group().equals("")); @@ -1124,7 +1124,7 @@ m = p.matcher("a"); assertTrue(m.find()); - assertTrue(m.group().equals("a")); + assertEquals("a", m.group()); assertFalse(m.find()); m = p.matcher(""); Index: modules/regex/src/test/java/tests/api/java/util/regex/ReplaceTest.java =================================================================== --- modules/regex/src/test/java/tests/api/java/util/regex/ReplaceTest.java.orig 2006-04-16 09:44:44.000000000 +0100 +++ modules/regex/src/test/java/tests/api/java/util/regex/ReplaceTest.java 2006-04-16 14:03:19.000000000 +0100 @@ -48,9 +48,9 @@ p = Pattern.compile(pattern); m = p.matcher(target); s = m.replaceFirst(repl); - assertTrue(s.equals("foo[31];bar[42];[99]xyz")); + assertEquals("foo[31];bar[42];[99]xyz", s); s = m.replaceAll(repl); - assertTrue(s.equals("foo[31];bar[42];xyz[99]")); + assertEquals("foo[31];bar[42];xyz[99]", s); target = "[31]foo(42)bar{63}zoo;[12]abc(34)def{56}ghi;{99}xyz[88]xyz(77)xyz;"; pattern = "\\[([0-9]+)\\]([a-z]+)\\(([0-9]+)\\)([a-z]+)\\{([0-9]+)\\}([a-z]+)"; @@ -59,12 +59,12 @@ m = p.matcher(target); s = m.replaceFirst(repl); // System.out.println(s); - assertTrue(s - .equals("[63]zoo(42)bar{31}foo;[12]abc(34)def{56}ghi;{99}xyz[88]xyz(77)xyz;")); + assertEquals("[63]zoo(42)bar{31}foo;[12]abc(34)def{56}ghi;{99}xyz[88]xyz(77)xyz;", s + ); s = m.replaceAll(repl); // System.out.println(s); - assertTrue(s - .equals("[63]zoo(42)bar{31}foo;[56]ghi(34)def{12}abc;{99}xyz[88]xyz(77)xyz;")); + assertEquals("[63]zoo(42)bar{31}foo;[56]ghi(34)def{12}abc;{99}xyz[88]xyz(77)xyz;", s + ); } public void testEscapeReplace() { @@ -74,12 +74,12 @@ pattern = "'"; repl = "\\'"; s = target.replaceAll(pattern, repl); - assertTrue(s.equals("foo'bar''foo")); + assertEquals("foo'bar''foo", s); repl = "\\\\'"; s = target.replaceAll(pattern, repl); - assertTrue(s.equals("foo\\'bar\\'\\'foo")); + assertEquals("foo\\'bar\\'\\'foo", s); repl = "\\$3"; s = target.replaceAll(pattern, repl); - assertTrue(s.equals("foo$3bar$3$3foo")); + assertEquals("foo$3bar$3$3foo", s); } } Index: modules/regex/src/test/java/tests/api/java/util/regex/SplitTest.java =================================================================== --- modules/regex/src/test/java/tests/api/java/util/regex/SplitTest.java.orig 2006-04-16 09:44:44.000000000 +0100 +++ modules/regex/src/test/java/tests/api/java/util/regex/SplitTest.java 2006-04-16 14:03:19.000000000 +0100 @@ -45,24 +45,24 @@ assertTrue(tokens[0].equals(input)); tokens = p.split(input, 2); assertTrue(tokens.length == 2); - assertTrue(tokens[0].equals("poodle")); - assertTrue(tokens[1].equals("zoo")); + assertEquals("poodle", tokens[0]); + assertEquals("zoo", tokens[1]); tokens = p.split(input, 5); assertTrue(tokens.length == 2); - assertTrue(tokens[0].equals("poodle")); - assertTrue(tokens[1].equals("zoo")); + assertEquals("poodle", tokens[0]); + assertEquals("zoo", tokens[1]); tokens = p.split(input, -2); assertTrue(tokens.length == 2); - assertTrue(tokens[0].equals("poodle")); - assertTrue(tokens[1].equals("zoo")); + assertEquals("poodle", tokens[0]); + assertEquals("zoo", tokens[1]); tokens = p.split(input, 0); assertTrue(tokens.length == 2); - assertTrue(tokens[0].equals("poodle")); - assertTrue(tokens[1].equals("zoo")); + assertEquals("poodle", tokens[0]); + assertEquals("zoo", tokens[1]); tokens = p.split(input); assertTrue(tokens.length == 2); - assertTrue(tokens[0].equals("poodle")); - assertTrue(tokens[1].equals("zoo")); + assertEquals("poodle", tokens[0]); + assertEquals("zoo", tokens[1]); p = Pattern.compile("d"); @@ -71,24 +71,24 @@ assertTrue(tokens[0].equals(input)); tokens = p.split(input, 2); assertTrue(tokens.length == 2); - assertTrue(tokens[0].equals("poo")); - assertTrue(tokens[1].equals("le zoo")); + assertEquals("poo", tokens[0]); + assertEquals("le zoo", tokens[1]); tokens = p.split(input, 5); assertTrue(tokens.length == 2); - assertTrue(tokens[0].equals("poo")); - assertTrue(tokens[1].equals("le zoo")); + assertEquals("poo", tokens[0]); + assertEquals("le zoo", tokens[1]); tokens = p.split(input, -2); assertTrue(tokens.length == 2); - assertTrue(tokens[0].equals("poo")); - assertTrue(tokens[1].equals("le zoo")); + assertEquals("poo", tokens[0]); + assertEquals("le zoo", tokens[1]); tokens = p.split(input, 0); assertTrue(tokens.length == 2); - assertTrue(tokens[0].equals("poo")); - assertTrue(tokens[1].equals("le zoo")); + assertEquals("poo", tokens[0]); + assertEquals("le zoo", tokens[1]); tokens = p.split(input); assertTrue(tokens.length == 2); - assertTrue(tokens[0].equals("poo")); - assertTrue(tokens[1].equals("le zoo")); + assertEquals("poo", tokens[0]); + assertEquals("le zoo", tokens[1]); p = Pattern.compile("o"); @@ -97,32 +97,32 @@ assertTrue(tokens[0].equals(input)); tokens = p.split(input, 2); assertTrue(tokens.length == 2); - assertTrue(tokens[0].equals("p")); - assertTrue(tokens[1].equals("odle zoo")); + assertEquals("p", tokens[0]); + assertEquals("odle zoo", tokens[1]); tokens = p.split(input, 5); assertTrue(tokens.length == 5); - assertTrue(tokens[0].equals("p")); + assertEquals("p", tokens[0]); assertTrue(tokens[1].equals("")); - assertTrue(tokens[2].equals("dle z")); + assertEquals("dle z", tokens[2]); assertTrue(tokens[3].equals("")); assertTrue(tokens[4].equals("")); tokens = p.split(input, -2); assertTrue(tokens.length == 5); - assertTrue(tokens[0].equals("p")); + assertEquals("p", tokens[0]); assertTrue(tokens[1].equals("")); - assertTrue(tokens[2].equals("dle z")); + assertEquals("dle z", tokens[2]); assertTrue(tokens[3].equals("")); assertTrue(tokens[4].equals("")); tokens = p.split(input, 0); assertTrue(tokens.length == 3); - assertTrue(tokens[0].equals("p")); + assertEquals("p", tokens[0]); assertTrue(tokens[1].equals("")); - assertTrue(tokens[2].equals("dle z")); + assertEquals("dle z", tokens[2]); tokens = p.split(input); assertTrue(tokens.length == 3); - assertTrue(tokens[0].equals("p")); + assertEquals("p", tokens[0]); assertTrue(tokens[1].equals("")); - assertTrue(tokens[2].equals("dle z")); + assertEquals("dle z", tokens[2]); } public void testSplit2() { Index: modules/security/src/test/java/common/java/security/cert/CRLTest.java =================================================================== --- modules/security/src/test/java/common/java/security/cert/CRLTest.java.orig 2006-04-16 11:47:21.000000000 +0100 +++ modules/security/src/test/java/common/java/security/cert/CRLTest.java 2006-04-16 14:10:04.000000000 +0100 @@ -49,7 +49,7 @@ */ public final void testGetType01() { CRL crl = new MyCRL("TEST_TYPE"); - assertTrue("TEST_TYPE".equals(crl.getType())); + assertEquals("TEST_TYPE", crl.getType()); } /** Index: modules/security/src/test/java/common/java/security/cert/CertPathTest.java =================================================================== --- modules/security/src/test/java/common/java/security/cert/CertPathTest.java.orig 2006-04-16 09:44:44.000000000 +0100 +++ modules/security/src/test/java/common/java/security/cert/CertPathTest.java 2006-04-16 14:10:04.000000000 +0100 @@ -75,7 +75,7 @@ * Assertion: returns cert path type */ public final void testGetType() { - assertTrue("MyEncoding".equals(new MyCertPath(testEncoding).getType())); + assertEquals("MyEncoding", new MyCertPath(testEncoding).getType()); } /** Index: modules/security/src/test/java/common/java/security/cert/CertificateTest.java =================================================================== --- modules/security/src/test/java/common/java/security/cert/CertificateTest.java.orig 2006-04-16 09:44:44.000000000 +0100 +++ modules/security/src/test/java/common/java/security/cert/CertificateTest.java 2006-04-16 14:10:04.000000000 +0100 @@ -84,7 +84,7 @@ */ public final void testGetType() { Certificate c1 = new MyCertificate("TEST_TYPE", testEncoding); - assertTrue("TEST_TYPE".equals(c1.getType())); + assertEquals("TEST_TYPE", c1.getType()); } /** Index: modules/security/src/test/java/common/java/security/cert/PolicyQualifierInfoTest.java =================================================================== --- modules/security/src/test/java/common/java/security/cert/PolicyQualifierInfoTest.java.orig 2006-04-16 09:44:44.000000000 +0100 +++ modules/security/src/test/java/common/java/security/cert/PolicyQualifierInfoTest.java 2006-04-16 14:10:04.000000000 +0100 @@ -249,7 +249,7 @@ // pass valid array PolicyQualifierInfo i = new PolicyQualifierInfo(encoding); // get OID as String and check it - assertTrue("1.3.6.1.5.5.7.2.1".equals(i.getPolicyQualifierId())); + assertEquals("1.3.6.1.5.5.7.2.1", i.getPolicyQualifierId()); // get valid encoding encoding = getDerEncoding(); @@ -260,7 +260,7 @@ encoding[9] = (byte)0x87; i = new PolicyQualifierInfo(encoding); // get OID as String and check it - assertTrue("1.3.98437.82818.1".equals(i.getPolicyQualifierId())); + assertEquals("1.3.98437.82818.1", i.getPolicyQualifierId()); } /** Index: modules/security/src/test/java/common/java/security/spec/MGF1ParameterSpecTest.java =================================================================== --- modules/security/src/test/java/common/java/security/spec/MGF1ParameterSpecTest.java.orig 2006-04-16 09:44:48.000000000 +0100 +++ modules/security/src/test/java/common/java/security/spec/MGF1ParameterSpecTest.java 2006-04-16 14:10:04.000000000 +0100 @@ -83,9 +83,9 @@ * digest used by the mask generation function */ public final void testFieldsGetDigestAlgorithm() { - assertTrue("SHA-1".equals(MGF1ParameterSpec.SHA1.getDigestAlgorithm())); - assertTrue("SHA-256".equals(MGF1ParameterSpec.SHA256.getDigestAlgorithm())); - assertTrue("SHA-384".equals(MGF1ParameterSpec.SHA384.getDigestAlgorithm())); - assertTrue("SHA-512".equals(MGF1ParameterSpec.SHA512.getDigestAlgorithm())); + assertEquals("SHA-1", MGF1ParameterSpec.SHA1.getDigestAlgorithm()); + assertEquals("SHA-256", MGF1ParameterSpec.SHA256.getDigestAlgorithm()); + assertEquals("SHA-384", MGF1ParameterSpec.SHA384.getDigestAlgorithm()); + assertEquals("SHA-512", MGF1ParameterSpec.SHA512.getDigestAlgorithm()); } } Index: modules/security/src/test/java/common/java/security/spec/PKCS8EncodedKeySpecTest.java =================================================================== --- modules/security/src/test/java/common/java/security/spec/PKCS8EncodedKeySpecTest.java.orig 2006-04-16 09:44:48.000000000 +0100 +++ modules/security/src/test/java/common/java/security/spec/PKCS8EncodedKeySpecTest.java 2006-04-16 14:10:04.000000000 +0100 @@ -80,7 +80,7 @@ PKCS8EncodedKeySpec meks = new PKCS8EncodedKeySpec(encodedKey); - assertTrue("PKCS#8".equals(meks.getFormat())); + assertEquals("PKCS#8", meks.getFormat()); } /** Index: modules/security/src/test/java/common/java/security/spec/PSSParameterSpecTest.java =================================================================== --- modules/security/src/test/java/common/java/security/spec/PSSParameterSpecTest.java.orig 2006-04-16 11:47:21.000000000 +0100 +++ modules/security/src/test/java/common/java/security/spec/PSSParameterSpecTest.java 2006-04-16 14:18:17.000000000 +0100 @@ -165,7 +165,7 @@ public final void testGetDigestAlgorithm() { PSSParameterSpec pssps = new PSSParameterSpec("SHA-1", "MGF1", MGF1ParameterSpec.SHA1, 20, 1); - assertTrue("SHA-1".equals(pssps.getDigestAlgorithm())); + assertEquals("SHA-1", pssps.getDigestAlgorithm()); } /** @@ -175,7 +175,7 @@ public final void testGetMGFAlgorithm() { PSSParameterSpec pssps = new PSSParameterSpec("SHA-1", "MGF1", MGF1ParameterSpec.SHA1, 20, 1); - assertTrue("MGF1".equals(pssps.getMGFAlgorithm())); + assertEquals("MGF1", pssps.getMGFAlgorithm()); } /** @@ -225,7 +225,7 @@ * Assertion: default message digest algorithm name is "SHA-1" */ public final void testDEFAULTmdName() { - assertTrue("SHA-1".equals(PSSParameterSpec.DEFAULT.getDigestAlgorithm())); + assertEquals("SHA-1", PSSParameterSpec.DEFAULT.getDigestAlgorithm()); } /** @@ -233,7 +233,7 @@ * Assertion: default mask generation function algorithm name is "MGF1" */ public final void testDEFAULTmgfName() { - assertTrue("MGF1".equals(PSSParameterSpec.DEFAULT.getMGFAlgorithm())); + assertEquals("MGF1", PSSParameterSpec.DEFAULT.getMGFAlgorithm()); } /** Index: modules/security/src/test/java/common/java/security/spec/X509EncodedKeySpecTest.java =================================================================== --- modules/security/src/test/java/common/java/security/spec/X509EncodedKeySpecTest.java.orig 2006-04-16 09:44:48.000000000 +0100 +++ modules/security/src/test/java/common/java/security/spec/X509EncodedKeySpecTest.java 2006-04-16 14:10:04.000000000 +0100 @@ -80,7 +80,7 @@ X509EncodedKeySpec meks = new X509EncodedKeySpec(encodedKey); - assertTrue("X.509".equals(meks.getFormat())); + assertEquals("X.509", meks.getFormat()); } /**