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 15:18:06.000000000 +0100 +++ modules/archive/src/test/java/tests/api/java/util/jar/AttributesTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -202,7 +202,7 @@ */ public void test_size() { // Test for method int java.util.jar.Attributes.size() - assertTrue("Incorrect size returned", a.size() == 4); + assertEquals("Incorrect size returned", 4, a.size()); a.clear(); assertTrue("Should have returned 0 size, but got: " + a.size(), a .size() == 0); Index: modules/archive/src/test/java/tests/api/java/util/jar/JarEntryTest.java =================================================================== --- modules/archive/src/test/java/tests/api/java/util/jar/JarEntryTest.java.orig 2006-04-16 15:18:06.000000000 +0100 +++ modules/archive/src/test/java/tests/api/java/util/jar/JarEntryTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -56,8 +56,8 @@ assertTrue("Jar entry is null", jarEntry != null); assertTrue("Wrong entry constucted--wrong name", jarEntry.getName() .equals(entryName)); - assertTrue("Wrong entry constucted--wrong size", - jarEntry.getSize() == 311); + assertEquals("Wrong entry constucted--wrong size", + 311, jarEntry.getSize()); } /** Index: modules/archive/src/test/java/tests/api/java/util/jar/JarFileTest.java =================================================================== --- modules/archive/src/test/java/tests/api/java/util/jar/JarFileTest.java.orig 2006-04-16 15:18:06.000000000 +0100 +++ modules/archive/src/test/java/tests/api/java/util/jar/JarFileTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -155,8 +155,8 @@ try { Support_Resources.copyFile(resources, null, jarName); JarFile jarFile = new JarFile(new File(resources, jarName)); - assertTrue("Error in returned entry", jarFile.getEntry(entryName) - .getSize() == 311); + assertEquals("Error in returned entry", 311, jarFile.getEntry(entryName) + .getSize()); jarFile.close(); } catch (Exception e) { fail("Exception during test: " + e.toString()); Index: modules/archive/src/test/java/tests/api/java/util/zip/Adler32Test.java =================================================================== --- modules/archive/src/test/java/tests/api/java/util/zip/Adler32Test.java.orig 2006-04-16 15:17:59.000000000 +0100 +++ modules/archive/src/test/java/tests/api/java/util/zip/Adler32Test.java 2006-04-16 15:18:06.000000000 +0100 @@ -26,7 +26,7 @@ public void test_Constructor() { // test method of java.util.zip.Adler32() Adler32 adl = new Adler32(); - assertTrue("Constructor of adl32 failed", adl.getValue() == 1); + assertEquals("Constructor of adl32 failed", 1, adl.getValue()); } /** @@ -35,28 +35,25 @@ public void test_getValue() { // test methods of java.util.zip.getValue() Adler32 adl = new Adler32(); - assertTrue( - "GetValue should return a zero as a result of construction an object of Adler32", - adl.getValue() == 1); + assertEquals("GetValue should return a zero as a result of construction an object of Adler32", + 1, adl.getValue()); adl.reset(); adl.update(1); // System.out.print("value of adl"+adl.getValue()); // The value of the adl should be 131074 - assertTrue( - "update(int) failed to update the checksum to the correct value ", - adl.getValue() == 131074); + assertEquals("update(int) failed to update the checksum to the correct value ", + 131074, adl.getValue()); adl.reset(); - assertTrue("reset failed to reset the checksum value to zero", adl - .getValue() == 1); + assertEquals("reset failed to reset the checksum value to zero", 1, adl + .getValue()); adl.reset(); adl.update(Integer.MIN_VALUE); // System.out.print("value of adl " + adl.getValue()); // The value of the adl should be 65537 - assertTrue( - "update(min) failed to update the checksum to the correct value ", - adl.getValue() == 65537L); + assertEquals("update(min) failed to update the checksum to the correct value ", + 65537L, adl.getValue()); } /** @@ -68,12 +65,11 @@ adl.update(1); // System.out.print("value of adl"+adl.getValue()); // The value of the adl should be 131074 - assertTrue( - "update(int) failed to update the checksum to the correct value ", - adl.getValue() == 131074); + assertEquals("update(int) failed to update the checksum to the correct value ", + 131074, adl.getValue()); adl.reset(); - assertTrue("reset failed to reset the checksum value to zero", adl - .getValue() == 1); + assertEquals("reset failed to reset the checksum value to zero", 1, adl + .getValue()); } /** @@ -84,25 +80,22 @@ Adler32 adl = new Adler32(); adl.update(1); // The value of the adl should be 131074 - assertTrue( - "update(int) failed to update the checksum to the correct value ", - adl.getValue() == 131074); + assertEquals("update(int) failed to update the checksum to the correct value ", + 131074, adl.getValue()); adl.reset(); adl.update(Integer.MAX_VALUE); // System.out.print("value of adl " + adl.getValue()); // The value of the adl should be 16777472 - assertTrue( - "update(max) failed to update the checksum to the correct value ", - adl.getValue() == 16777472L); + assertEquals("update(max) failed to update the checksum to the correct value ", + 16777472L, adl.getValue()); adl.reset(); adl.update(Integer.MIN_VALUE); // System.out.print("value of adl " + adl.getValue()); // The value of the adl should be 65537 - assertTrue( - "update(min) failed to update the checksum to the correct value ", - adl.getValue() == 65537L); + assertEquals("update(min) failed to update the checksum to the correct value ", + 65537L, adl.getValue()); } @@ -116,18 +109,16 @@ adl.update(byteArray); // System.out.print("value of adl"+adl.getValue()); // The value of the adl should be 393220 - assertTrue( - "update(byte[]) failed to update the checksum to the correct value ", - adl.getValue() == 393220); + assertEquals("update(byte[]) failed to update the checksum to the correct value ", + 393220, adl.getValue()); adl.reset(); byte byteEmpty[] = new byte[10000]; adl.update(byteEmpty); // System.out.print("value of adl"+adl.getValue()); // The value of the adl should be 655360001 - assertTrue( - "update(byte[]) failed to update the checksum to the correct value ", - adl.getValue() == 655360001L); + assertEquals("update(byte[]) failed to update the checksum to the correct value ", + 655360001L, adl.getValue()); } @@ -145,9 +136,8 @@ adl.update(byteArray, off, len); // System.out.print("value of adl"+adl.getValue()); // The value of the adl should be 262148 - assertTrue( - "update(byte[],int,int) failed to update the checksum to the correct value ", - adl.getValue() == 262148); + assertEquals("update(byte[],int,int) failed to update the checksum to the correct value ", + 262148, adl.getValue()); int r = 0; try { @@ -155,17 +145,16 @@ } catch (ArrayIndexOutOfBoundsException e) { r = 1; } - assertTrue( - "update(byte[],int,int) failed b/c lenError>byte[].length-off", - r == 1); + assertEquals("update(byte[],int,int) failed b/c lenError>byte[].length-off", + 1, r); try { adl.update(byteArray, offError, len); } catch (ArrayIndexOutOfBoundsException e) { r = 2; } - assertTrue("update(byte[],int,int) failed b/c offError>byte[].length", - r == 2); + assertEquals("update(byte[],int,int) failed b/c offError>byte[].length", + 2, r); } Index: modules/archive/src/test/java/tests/api/java/util/zip/CRC32Test.java =================================================================== --- modules/archive/src/test/java/tests/api/java/util/zip/CRC32Test.java.orig 2006-04-16 15:17:59.000000000 +0100 +++ modules/archive/src/test/java/tests/api/java/util/zip/CRC32Test.java 2006-04-16 15:18:06.000000000 +0100 @@ -26,7 +26,7 @@ public void test_Constructor() { // test methods of java.util.zip.CRC32() CRC32 crc = new CRC32(); - assertTrue("Constructor of CRC32 failed", crc.getValue() == 0); + assertEquals("Constructor of CRC32 failed", 0, crc.getValue()); } /** @@ -35,18 +35,16 @@ public void test_getValue() { // test methods of java.util.zip.crc32.getValue() CRC32 crc = new CRC32(); - assertTrue( - "getValue() should return a zero as a result of constructing a CRC32 instance", - crc.getValue() == 0); + assertEquals("getValue() should return a zero as a result of constructing a CRC32 instance", + 0, crc.getValue()); crc.reset(); crc.update(Integer.MAX_VALUE); // System.out.print("value of crc " + crc.getValue()); // Ran JDK and discovered that the value of the CRC should be // 4278190080 - assertTrue( - "update(max) failed to update the checksum to the correct value ", - crc.getValue() == 4278190080L); + assertEquals("update(max) failed to update the checksum to the correct value ", + 4278190080L, crc.getValue()); crc.reset(); byte byteEmpty[] = new byte[10000]; @@ -54,20 +52,19 @@ // System.out.print("value of crc"+crc.getValue()); // Ran JDK and discovered that the value of the CRC should be // 1295764014 - assertTrue( - "update(byte[]) failed to update the checksum to the correct value ", - crc.getValue() == 1295764014L); + assertEquals("update(byte[]) failed to update the checksum to the correct value ", + 1295764014L, crc.getValue()); crc.reset(); crc.update(1); // System.out.print("value of crc"+crc.getValue()); // Ran JDK and discovered that the value of the CRC should be // 2768625435 - // assertTrue("update(int) failed to update the checksum to the correct - // value ",crc.getValue() == 2768625435L); + // assertEquals("update(int) failed to update the checksum to the correct + // value ",2768625435L, crc.getValue()); crc.reset(); - assertTrue("reset failed to reset the checksum value to zero", crc - .getValue() == 0); + assertEquals("reset failed to reset the checksum value to zero", 0, crc + .getValue()); } /** @@ -80,12 +77,11 @@ // System.out.print("value of crc"+crc.getValue()); // Ran JDK and discovered that the value of the CRC should be // 2768625435 - assertTrue( - "update(int) failed to update the checksum to the correct value ", - crc.getValue() == 2768625435L); + assertEquals("update(int) failed to update the checksum to the correct value ", + 2768625435L, crc.getValue()); crc.reset(); - assertTrue("reset failed to reset the checksum value to zero", crc - .getValue() == 0); + assertEquals("reset failed to reset the checksum value to zero", 0, crc + .getValue()); } @@ -99,27 +95,24 @@ // System.out.print("value of crc"+crc.getValue()); // Ran JDK and discovered that the value of the CRC should be // 2768625435 - assertTrue( - "update(1) failed to update the checksum to the correct value ", - crc.getValue() == 2768625435L); + assertEquals("update(1) failed to update the checksum to the correct value ", + 2768625435L, crc.getValue()); crc.reset(); crc.update(Integer.MAX_VALUE); // System.out.print("value of crc " + crc.getValue()); // Ran JDK and discovered that the value of the CRC should be // 4278190080 - assertTrue( - "update(max) failed to update the checksum to the correct value ", - crc.getValue() == 4278190080L); + assertEquals("update(max) failed to update the checksum to the correct value ", + 4278190080L, crc.getValue()); crc.reset(); crc.update(Integer.MIN_VALUE); // System.out.print("value of crc " + crc.getValue()); // Ran JDK and discovered that the value of the CRC should be // 3523407757 - assertTrue( - "update(min) failed to update the checksum to the correct value ", - crc.getValue() == 3523407757L); + assertEquals("update(min) failed to update the checksum to the correct value ", + 3523407757L, crc.getValue()); } /** @@ -133,9 +126,8 @@ // System.out.print("value of crc"+crc.getValue()); // Ran JDK and discovered that the value of the CRC should be // 3066839698 - assertTrue( - "update(byte[]) failed to update the checksum to the correct value ", - crc.getValue() == 3066839698L); + assertEquals("update(byte[]) failed to update the checksum to the correct value ", + 3066839698L, crc.getValue()); crc.reset(); byte byteEmpty[] = new byte[10000]; @@ -143,9 +135,8 @@ // System.out.print("value of crc"+crc.getValue()); // Ran JDK and discovered that the value of the CRC should be // 1295764014 - assertTrue( - "update(byte[]) failed to update the checksum to the correct value ", - crc.getValue() == 1295764014L); + assertEquals("update(byte[]) failed to update the checksum to the correct value ", + 1295764014L, crc.getValue()); } /** @@ -163,26 +154,24 @@ // System.out.print("value of crc"+crc.getValue()); // Ran JDK and discovered that the value of the CRC should be // 1259060791 - assertTrue( - "update(byte[],int,int) failed to update the checksum to the correct value ", - crc.getValue() == 1259060791L); + assertEquals("update(byte[],int,int) failed to update the checksum to the correct value ", + 1259060791L, crc.getValue()); int r = 0; try { crc.update(byteArray, off, lenError); } catch (ArrayIndexOutOfBoundsException e) { r = 1; } - assertTrue( - "update(byte[],int,int) failed b/c lenError>byte[].length-off", - r == 1); + assertEquals("update(byte[],int,int) failed b/c lenError>byte[].length-off", + 1, r); try { crc.update(byteArray, offError, len); } catch (ArrayIndexOutOfBoundsException e) { r = 2; } - assertTrue("update(byte[],int,int) failed b/c offError>byte[].length", - r == 2); + assertEquals("update(byte[],int,int) failed b/c offError>byte[].length", + 2, r); } protected void setUp() { Index: modules/archive/src/test/java/tests/api/java/util/zip/CheckedInputStreamTest.java =================================================================== --- modules/archive/src/test/java/tests/api/java/util/zip/CheckedInputStreamTest.java.orig 2006-04-16 15:17:59.000000000 +0100 +++ modules/archive/src/test/java/tests/api/java/util/zip/CheckedInputStreamTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -40,8 +40,8 @@ checkInput = Support_Resources.getStream("hyts_checkInput.txt"); CheckedInputStream checkIn = new CheckedInputStream(checkInput, new CRC32()); - assertTrue("constructor of checkedInputStream has failed", checkIn - .getChecksum().getValue() == 0); + assertEquals("constructor of checkedInputStream has failed", 0, checkIn + .getChecksum().getValue()); checkInput.close(); } catch (FileNotFoundException e) { fail("File for checkInputStream is not found"); @@ -65,8 +65,8 @@ new CRC32()); while (checkEmpty.read() >= 0) { } - assertTrue("the checkSum value of an empty file is not zero", - checkEmpty.getChecksum().getValue() == 0); + assertEquals("the checkSum value of an empty file is not zero", + 0, checkEmpty.getChecksum().getValue()); inEmp.close(); // testing getChecksum for the file checkInput @@ -77,8 +77,8 @@ } // ran JDK and found that the checkSum value of this is 2036203193 // System.out.print(" " + checkIn.getChecksum().getValue()); - assertTrue("the checksum value is incorrect", checkIn.getChecksum() - .getValue() == 2036203193); + assertEquals("the checksum value is incorrect", 2036203193, checkIn.getChecksum() + .getValue()); checkInput.close(); // testing getChecksum for file checkInput checkInput = Support_Resources.getStream("hyts_checkInput.txt"); @@ -87,8 +87,8 @@ checkIn2.read(outBuf, 0, 10); // ran JDK and found that the checkSum value of this is 2235765342 // System.out.print(" " + checkIn2.getChecksum().getValue()); - assertTrue("the checksum value is incorrect", checkIn2 - .getChecksum().getValue() == 2235765342L); + assertEquals("the checksum value is incorrect", 2235765342L, checkIn2 + .getChecksum().getValue()); checkInput.close(); } catch (FileNotFoundException e) { fail("File for checkInputStream is not found"); @@ -114,8 +114,8 @@ checkIn.skip(skipValue); // ran JDK and found the checkSum value is 2235765342 // System.out.print(checkIn.getChecksum().getValue()); - assertTrue("checkSum value is not correct", checkIn.getChecksum() - .getValue() == 2235765342L); + assertEquals("checkSum value is not correct", 2235765342L, checkIn.getChecksum() + .getValue()); checkInput.close(); } catch (FileNotFoundException e) { fail("File for checkInputStream is not found"); Index: modules/archive/src/test/java/tests/api/java/util/zip/CheckedOutputStreamTest.java =================================================================== --- modules/archive/src/test/java/tests/api/java/util/zip/CheckedOutputStreamTest.java.orig 2006-04-16 15:17:59.000000000 +0100 +++ modules/archive/src/test/java/tests/api/java/util/zip/CheckedOutputStreamTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -35,8 +35,8 @@ FileOutputStream outFile = new FileOutputStream("chkOut.txt"); CheckedOutputStream chkOut = new CheckedOutputStream(outFile, new CRC32()); - assertTrue("the checkSum value of the constructor is not 0", chkOut - .getChecksum().getValue() == 0); + assertEquals("the checkSum value of the constructor is not 0", 0, chkOut + .getChecksum().getValue()); outFile.close(); } catch (IOException e) { fail("Unable to find file"); @@ -60,15 +60,15 @@ // ran JDK and found that checkSum value is 7536755 // System.out.print(chkOut.getChecksum().getValue()); - assertTrue("the checkSum value for writeI is incorrect", chkOut - .getChecksum().getValue() == 7536755); + assertEquals("the checkSum value for writeI is incorrect", 7536755, chkOut + .getChecksum().getValue()); chkOut.getChecksum().reset(); chkOut.write(byteArray, 5, 4); // ran JDK and found that checkSum value is 51708133 // System.out.print(" " +chkOut.getChecksum().getValue()); - assertTrue("the checkSum value for writeBII is incorrect ", chkOut - .getChecksum().getValue() == 51708133); + assertEquals("the checkSum value for writeBII is incorrect ", 51708133, chkOut + .getChecksum().getValue()); outFile.close(); } catch (IOException e) { fail("Unable to find file"); @@ -122,7 +122,7 @@ } catch (IndexOutOfBoundsException e) { r = 1; } - assertTrue("boundary check is not performed", r == 1); + assertEquals("boundary check is not performed", 1, r); outFile.close(); } catch (IOException e) { fail("Unable to find file"); Index: modules/archive/src/test/java/tests/api/java/util/zip/DeflaterOutputStreamTest.java =================================================================== --- modules/archive/src/test/java/tests/api/java/util/zip/DeflaterOutputStreamTest.java.orig 2006-04-16 15:17:59.000000000 +0100 +++ modules/archive/src/test/java/tests/api/java/util/zip/DeflaterOutputStreamTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -76,8 +76,8 @@ // Test to see if DflaterOutputStream was created with the correct // buffer. - assertTrue("Incorrect Buffer Size", - dos.getProtectedBuf().length == 512); + assertEquals("Incorrect Buffer Size", + 512, dos.getProtectedBuf().length); dos.write(byteArray); dos.close(); @@ -103,8 +103,8 @@ // Test to see if DflaterOutputStream was created with the correct // buffer. - assertTrue("Incorrect Buffer Size", - dos.getProtectedBuf().length == 512); + assertEquals("Incorrect Buffer Size", + 512, dos.getProtectedBuf().length); dos.write(outPutBuf); dos.close(); @@ -160,8 +160,8 @@ // Test to see if DflaterOutputStream was created with the correct // buffer. dos = new MyDeflaterOutputStream(fos, defl, buf); - assertTrue("Incorrect Buffer Size", - dos.getProtectedBuf().length == 5); + assertEquals("Incorrect Buffer Size", + 5, dos.getProtectedBuf().length); dos.write(byteArray); dos.close(); @@ -196,12 +196,12 @@ dos.close(); // Test to see if the finish method wrote the bytes to the file. - assertTrue("Incorrect Byte Returned.", iis.read() == 1); - assertTrue("Incorrect Byte Returned.", iis.read() == 3); - assertTrue("Incorrect Byte Returned.", iis.read() == 4); - assertTrue("Incorrect Byte Returned.", iis.read() == 6); - assertTrue("Incorrect Byte Returned.", iis.read() == -1); - assertTrue("Incorrect Byte Returned.", iis.read() == -1); + assertEquals("Incorrect Byte Returned.", 1, iis.read()); + assertEquals("Incorrect Byte Returned.", 3, iis.read()); + assertEquals("Incorrect Byte Returned.", 4, iis.read()); + assertEquals("Incorrect Byte Returned.", 6, iis.read()); + assertEquals("Incorrect Byte Returned.", -1, iis.read()); + assertEquals("Incorrect Byte Returned.", -1, iis.read()); iis.close(); // Not sure if this test will stay. @@ -330,8 +330,8 @@ InflaterInputStream iis = new InflaterInputStream(fis); for (int i = 0; i < 3; i++) assertTrue("Incorrect Byte Returned.", iis.read() == i); - assertTrue("Incorrect Byte Returned (EOF).", iis.read() == -1); - assertTrue("Incorrect Byte Returned (EOF).", iis.read() == -1); + assertEquals("Incorrect Byte Returned (EOF).", -1, iis.read()); + assertEquals("Incorrect Byte Returned (EOF).", -1, iis.read()); iis.close(); // Not sure if this test is that important. @@ -372,11 +372,11 @@ dos1.close(); FileInputStream fis = new FileInputStream(f1); InflaterInputStream iis = new InflaterInputStream(fis); - assertTrue("Incorrect Byte Returned.", iis.read() == 4); - assertTrue("Incorrect Byte Returned.", iis.read() == 7); - assertTrue("Incorrect Byte Returned.", iis.read() == 8); - assertTrue("Incorrect Byte Returned (EOF).", iis.read() == -1); - assertTrue("Incorrect Byte Returned (EOF).", iis.read() == -1); + assertEquals("Incorrect Byte Returned.", 4, iis.read()); + assertEquals("Incorrect Byte Returned.", 7, iis.read()); + assertEquals("Incorrect Byte Returned.", 8, iis.read()); + assertEquals("Incorrect Byte Returned (EOF).", -1, iis.read()); + assertEquals("Incorrect Byte Returned (EOF).", -1, iis.read()); iis.close(); f1.delete(); Index: modules/archive/src/test/java/tests/api/java/util/zip/DeflaterTest.java =================================================================== --- modules/archive/src/test/java/tests/api/java/util/zip/DeflaterTest.java.orig 2006-04-16 15:17:59.000000000 +0100 +++ modules/archive/src/test/java/tests/api/java/util/zip/DeflaterTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -74,8 +74,8 @@ defl.finish(); while (!defl.finished()) x += defl.deflate(outPutBuf); - assertTrue("Deflater at end of stream, should return 0", defl - .deflate(outPutBuf) == 0); + assertEquals("Deflater at end of stream, should return 0", 0, defl + .deflate(outPutBuf)); int totalOut = defl.getTotalOut(); int totalIn = defl.getTotalIn(); assertTrue( @@ -105,9 +105,8 @@ assertTrue( "Final decompressed data does not equal the original data", byteArray[i] == outPutInf[i]); - assertTrue( - "Final decompressed data contained more bytes than original", - outPutInf[byteArray.length] == 0); + assertEquals("Final decompressed data contained more bytes than original", + 0, outPutInf[byteArray.length]); infl.end(); } @@ -128,8 +127,8 @@ defl.finish(); while (!defl.finished()) x += defl.deflate(outPutBuf, offSet, length); - assertTrue("Deflater at end of stream, should return 0", defl.deflate( - outPutBuf, offSet, length) == 0); + assertEquals("Deflater at end of stream, should return 0", 0, defl.deflate( + outPutBuf, offSet, length)); int totalOut = defl.getTotalOut(); int totalIn = defl.getTotalIn(); assertTrue( @@ -158,9 +157,8 @@ assertTrue( "Final decompressed data does not equal the original data", byteArray[i] == outPutInf[i]); - assertTrue( - "Final decompressed data contained more bytes than original", - outPutInf[byteArray.length] == 0); + assertEquals("Final decompressed data contained more bytes than original", + 0, outPutInf[byteArray.length]); infl.end(); // Set of tests testing the boundaries of the offSet/length @@ -264,9 +262,8 @@ assertTrue( "Final decompressed data does not equal the original data", byteArray[i] == outPutInf[i]); - assertTrue( - "Final decompressed data contained more bytes than original", - outPutInf[byteArray.length] == 0); + assertEquals("Final decompressed data contained more bytes than original", + 0, outPutInf[byteArray.length]); infl.end(); } @@ -499,9 +496,8 @@ Deflater defl = new Deflater(); long deflAdler = defl.getAdler(); - assertTrue( - "No dictionary set, no data deflated, getAdler should return 1", - deflAdler == 1); + assertEquals("No dictionary set, no data deflated, getAdler should return 1", + 1, deflAdler); defl.setDictionary(dictionaryArray); deflAdler = defl.getAdler(); @@ -545,9 +541,8 @@ Deflater defl = new Deflater(); long deflAdler = defl.getAdler(); - assertTrue( - "No dictionary set, no data deflated, getAdler should return 1", - deflAdler == 1); + assertEquals("No dictionary set, no data deflated, getAdler should return 1", + 1, deflAdler); defl.setDictionary(dictionaryArray, offSet, length); deflAdler = defl.getAdler(); @@ -794,22 +789,19 @@ // System.out.println(mdefl.getTotalOut()); // ran JDK and found that getTotalOut() = 86 for this particular // file - assertTrue( - "getTotalOut() for the default strategy did not correspond with JDK", - mdefl.getTotalOut() == 86); + assertEquals("getTotalOut() for the default strategy did not correspond with JDK", + 86, mdefl.getTotalOut()); } else if (i == 1) { // System.out.println(mdefl.getTotalOut()); // ran JDK and found that getTotalOut() = 100 for this // particular file - assertTrue( - "getTotalOut() for the Huffman strategy did not correspond with JDK", - mdefl.getTotalOut() == 100); + assertEquals("getTotalOut() for the Huffman strategy did not correspond with JDK", + 100, mdefl.getTotalOut()); } else { // System.out.println(mdefl.getTotalOut()); // ran JDK and found that totalOut = 93 for this particular file - assertTrue( - "Total Out for the Filtered strategy did not correspond with JDK", - mdefl.getTotalOut() == 93); + assertEquals("Total Out for the Filtered strategy did not correspond with JDK", + 93, mdefl.getTotalOut()); } mdefl.end(); } @@ -929,9 +921,8 @@ assertTrue( "Final decompressed data does not equal the original data", byteArray[i] == outPutInf[i]); - assertTrue( - "final decompressed data contained more bytes than original - construcotrIZ", - outPutInf[byteArray.length] == 0); + assertEquals("final decompressed data contained more bytes than original - construcotrIZ", + 0, outPutInf[byteArray.length]); infl.end(); infl = new Inflater(false); @@ -946,7 +937,7 @@ } catch (DataFormatException e) { r = 1; } - assertTrue("header option did not correspond", r == 1); + assertEquals("header option did not correspond", 1, r); // testing boundaries try { Index: modules/archive/src/test/java/tests/api/java/util/zip/GZIPInputStreamTest.java =================================================================== --- modules/archive/src/test/java/tests/api/java/util/zip/GZIPInputStreamTest.java.orig 2006-04-16 15:17:59.000000000 +0100 +++ modules/archive/src/test/java/tests/api/java/util/zip/GZIPInputStreamTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -63,8 +63,8 @@ .openConnection().getInputStream()); assertTrue("the constructor for GZIPInputStream is null", inGZIP != null); - assertTrue("the CRC value of the inputStream is not zero", inGZIP - .getChecksum().getValue() == 0); + assertEquals("the CRC value of the inputStream is not zero", 0, inGZIP + .getChecksum().getValue()); inGZIP.close(); } catch (IOException e) { fail( @@ -87,8 +87,8 @@ .openConnection().getInputStream(), 200); assertTrue("the constructor for GZIPInputStream is null", inGZIP != null); - assertTrue("the CRC value of the inputStream is not zero", inGZIP - .getChecksum().getValue() == 0); + assertEquals("the CRC value of the inputStream is not zero", 0, inGZIP + .getChecksum().getValue()); inGZIP.close(); } catch (IOException e) { fail( @@ -117,9 +117,8 @@ while (!(inGZIP.endofInput())) { result += inGZIP.read(outBuf, result, outBuf.length - result); } - assertTrue( - "the checkSum value of the compressed and decompressed data does not equal", - inGZIP.getChecksum().getValue() == 3097700292L); + assertEquals("the checkSum value of the compressed and decompressed data does not equal", + 3097700292L, inGZIP.getChecksum().getValue()); for (int i = 0; i < orgBuf.length; i++) { assertTrue( "the decompressed data does not equal the orginal data decompressed", @@ -133,7 +132,7 @@ r = 1; } inGZIP.close(); - assertTrue("Boundary Check was not present", r == 1); + assertEquals("Boundary Check was not present", 1, r); } catch (IOException e) { e.printStackTrace(); fail("unexpected: " + e); @@ -158,7 +157,7 @@ int result, total = 0; while ((result = gin2.read(test)) != -1) total += result; - assertTrue("Should return -1", gin2.read() == -1); + assertEquals("Should return -1", -1, gin2.read()); gin2.close(); assertTrue("Incorrectly decompressed", total == test.length); @@ -167,7 +166,7 @@ while ((result = gin2.read(new byte[200])) != -1) { total += result; } - assertTrue("Should return -1", gin2.read() == -1); + assertEquals("Should return -1", -1, gin2.read()); gin2.close(); assertTrue("Incorrectly decompressed", total == test.length); @@ -176,7 +175,7 @@ while ((result = gin2.read(new byte[200])) != -1) { total += result; } - assertTrue("Should return -1", gin2.read() == -1); + assertEquals("Should return -1", -1, gin2.read()); gin2.close(); assertTrue("Incorrectly decompressed", total == test.length); @@ -215,9 +214,8 @@ while (!(inGZIP.endofInput())) { result += inGZIP.read(outBuf, result, outBuf.length - result); } - assertTrue( - "the checkSum value of the compressed and decompressed data does not equal", - inGZIP.getChecksum().getValue() == 3097700292L); + assertEquals("the checkSum value of the compressed and decompressed data does not equal", + 3097700292L, inGZIP.getChecksum().getValue()); inGZIP.close(); int r = 0; try { @@ -225,9 +223,8 @@ } catch (IOException e) { r = 1; } - assertTrue( - "GZIPInputStream can still be used after close is called", - r == 1); + assertEquals("GZIPInputStream can still be used after close is called", + 1, r); } catch (IOException e) { e.printStackTrace(); fail("unexpected: " + e); Index: modules/archive/src/test/java/tests/api/java/util/zip/GZIPOutputStreamTest.java =================================================================== --- modules/archive/src/test/java/tests/api/java/util/zip/GZIPOutputStreamTest.java.orig 2006-04-16 15:17:59.000000000 +0100 +++ modules/archive/src/test/java/tests/api/java/util/zip/GZIPOutputStreamTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -48,8 +48,8 @@ TestGZIPOutputStream outGZIP = new TestGZIPOutputStream(outFile); assertTrue("the constructor for GZIPOutputStream is null", outGZIP != null); - assertTrue("the CRC value of the outputStream is not zero", outGZIP - .getChecksum().getValue() == 0); + assertEquals("the CRC value of the outputStream is not zero", 0, outGZIP + .getChecksum().getValue()); outGZIP.close(); } catch (IOException e) { fail( @@ -68,8 +68,8 @@ 100); assertTrue("the constructor for GZIPOutputStream is null", outGZIP != null); - assertTrue("the CRC value of the outputStream is not zero", outGZIP - .getChecksum().getValue() == 0); + assertEquals("the CRC value of the outputStream is not zero", 0, outGZIP + .getChecksum().getValue()); outGZIP.close(); } catch (IOException e) { fail( @@ -95,9 +95,8 @@ r = 1; } - assertTrue( - "GZIP instance can still be used after finish is called", - r == 1); + assertEquals("GZIP instance can still be used after finish is called", + 1, r); outGZIP.close(); } catch (IOException e) { fail( @@ -121,8 +120,8 @@ } catch (IOException e) { r = 1; } - assertTrue("GZIP instance can still be used after close is called", - r == 1); + assertEquals("GZIP instance can still be used after close is called", + 1, r); } catch (IOException e) { fail( "an IO error occured while trying to find the output file or creating GZIP constructor"); @@ -141,9 +140,8 @@ outGZIP.write(byteArray, 0, 10); // ran JDK and found this CRC32 value is 3097700292 // System.out.print(outGZIP.getChecksum().getValue()); - assertTrue( - "the checksum value was incorrect result of write from GZIP", - outGZIP.getChecksum().getValue() == 3097700292L); + assertEquals("the checksum value was incorrect result of write from GZIP", + 3097700292L, outGZIP.getChecksum().getValue()); // test for boundary check int r = 0; @@ -152,7 +150,7 @@ } catch (ArrayIndexOutOfBoundsException e) { r = 1; } - assertTrue("out of bounds exception is not present", r == 1); + assertEquals("out of bounds exception is not present", 1, r); outGZIP.close(); } catch (IOException e) { fail( Index: modules/archive/src/test/java/tests/api/java/util/zip/InflaterInputStreamTest.java =================================================================== --- modules/archive/src/test/java/tests/api/java/util/zip/InflaterInputStreamTest.java.orig 2006-04-16 15:17:59.000000000 +0100 +++ modules/archive/src/test/java/tests/api/java/util/zip/InflaterInputStreamTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -194,8 +194,8 @@ * InflaterInputStream(infile, inflate); * * inflatIP.read(byteArray, 0, 4);// ony suppose to read in 4 bytes - * inflatIP.close(); assertTrue( "the fifth element of byteArray - * contained a non zero value", byteArray[4] == 0); } catch + * inflatIP.close(); assertEquals("the fifth element of byteArray + * contained a non zero value", 0, byteArray[4]); } catch * (FileNotFoundException e) { fail( "input file to test * InflaterInputStream constructor is not found"); } catch * (ZipException e) { fail( "read() threw an zip exception while @@ -257,27 +257,27 @@ fail("IllegalArgumentException not thrown"); } catch (IllegalArgumentException e) { } - assertTrue("Incorrect Byte Returned.", iis.read() == 5); + assertEquals("Incorrect Byte Returned.", 5, iis.read()); try { iis.skip(Integer.MIN_VALUE); fail("IllegalArgumentException not thrown"); } catch (IllegalArgumentException e) { } - assertTrue("Incorrect Byte Returned.", iis.read() == 4); + assertEquals("Incorrect Byte Returned.", 4, iis.read()); // Test to make sure the correct number of bytes were skipped - assertTrue("Incorrect Number Of Bytes Skipped.", iis.skip(3) == 3); + assertEquals("Incorrect Number Of Bytes Skipped.", 3, iis.skip(3)); // Test to see if the number of bytes skipped returned is true. - assertTrue("Incorrect Byte Returned.", iis.read() == 7); + assertEquals("Incorrect Byte Returned.", 7, iis.read()); - assertTrue("Incorrect Number Of Bytes Skipped.", iis.skip(0) == 0); - assertTrue("Incorrect Byte Returned.", iis.read() == 0); + assertEquals("Incorrect Number Of Bytes Skipped.", 0, iis.skip(0)); + assertEquals("Incorrect Byte Returned.", 0, iis.read()); // Test for skipping more bytes than available in the stream - assertTrue("Incorrect Number Of Bytes Skipped.", iis.skip(4) == 2); - assertTrue("Incorrect Byte Returned.", iis.read() == -1); + assertEquals("Incorrect Number Of Bytes Skipped.", 2, iis.skip(4)); + assertEquals("Incorrect Byte Returned.", -1, iis.read()); iis.close(); } catch (IOException e) { fail("Unexpected IOException during test"); @@ -317,17 +317,16 @@ skip = inflatIP2.skip(Integer.MAX_VALUE); // System.out.println(skip); - assertTrue("method skip() returned wrong number of bytes skiped", - skip == 5); + assertEquals("method skip() returned wrong number of bytes skiped", + 5, skip); // test for skiping of 2 bytes InputStream infile3 = Support_Resources .getStream("hyts_constru(OD).txt"); InflaterInputStream inflatIP3 = new InflaterInputStream(infile3); skip = inflatIP3.skip(2); - assertTrue( - "the number of bytes returned by skip did not correspond with its input parameters", - skip == 2); + assertEquals("the number of bytes returned by skip did not correspond with its input parameters", + 2, skip); int i = 0; result = 0; while ((result = inflatIP3.read()) != -1) { @@ -369,11 +368,11 @@ read = iis.read(); available = iis.available(); if (read == -1) - assertTrue("Bytes Available Should Return 0 ", - available == 0); + assertEquals("Bytes Available Should Return 0 ", + 0, available); else - assertTrue("Bytes Available Should Return 1.", - available == 1); + assertEquals("Bytes Available Should Return 1.", + 1, available); } iis.close(); Index: modules/archive/src/test/java/tests/api/java/util/zip/InflaterTest.java =================================================================== --- modules/archive/src/test/java/tests/api/java/util/zip/InflaterTest.java.orig 2006-04-16 15:17:59.000000000 +0100 +++ modules/archive/src/test/java/tests/api/java/util/zip/InflaterTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -49,7 +49,7 @@ } catch (NullPointerException e) { r = 1; } - assertTrue("inflate can still be used after end is called", r == 1); + assertEquals("inflate can still be used after end is called", 1, r); Inflater i = new Inflater(); i.end(); @@ -84,9 +84,8 @@ "Final decompressed data does not equal the original data", byteArray[i] == outPutInf[i]); } - assertTrue( - "final decompressed data contained more bytes than original - finished()", - outPutInf[byteArray.length] == 0); + assertEquals("final decompressed data contained more bytes than original - finished()", + 0, outPutInf[byteArray.length]); } /** @@ -116,9 +115,8 @@ // test method of java.util.zip.inflater.getRemaining() byte byteArray[] = { 1, 3, 5, 6, 7 }; Inflater inflate = new Inflater(); - assertTrue( - "upon creating an instance of inflate, getRemaining returned a non zero value", - inflate.getRemaining() == 0); + assertEquals("upon creating an instance of inflate, getRemaining returned a non zero value", + 0, inflate.getRemaining()); inflate.setInput(byteArray); assertTrue( "getRemaining returned zero when there is input in the input buffer", @@ -272,9 +270,8 @@ "Final decompressed data does not equal the original data", byteArray[i] == outPutInf[i]); } - assertTrue( - "final decompressed data contained more bytes than original - inflateB", - outPutInf[byteArray.length] == 0); + assertEquals("final decompressed data contained more bytes than original - inflateB", + 0, outPutInf[byteArray.length]); // testing for an empty input array byte outPutBuf[] = new byte[500]; byte emptyArray[] = new byte[11]; @@ -309,12 +306,11 @@ assertTrue( "Final decompressed data does not equal the original data", emptyArray[i] == outPutInf[i]); - assertTrue("Final decompressed data does not equal zero", - outPutInf[i] == 0); + assertEquals("Final decompressed data does not equal zero", + 0, outPutInf[i]); } - assertTrue( - "Final decompressed data contains more element than original data", - outPutInf[emptyArray.length] == 0); + assertEquals("Final decompressed data contains more element than original data", + 0, outPutInf[emptyArray.length]); } /** @@ -342,9 +338,8 @@ "Final decompressed data does not equal the original data", byteArray[i] == outPutInf[i]); } - assertTrue( - "final decompressed data contained more bytes than original - inflateB", - outPutInf[byteArray.length] == 0); + assertEquals("final decompressed data contained more bytes than original - inflateB", + 0, outPutInf[byteArray.length]); // test boundary checks inflate.reset(); @@ -362,7 +357,7 @@ } catch (ArrayIndexOutOfBoundsException e) { r = 1; } - assertTrue("out of bounds error did not get caught", r == 1); + assertEquals("out of bounds error did not get caught", 1, r); } /** @@ -402,16 +397,14 @@ inflate.inflate(outPutInf); } for (int i = 0; i < byteArray.length; i++) { - assertTrue( - "the output array from inflate should contain 0 because the header of inflate and deflate did not match, but this faled", - outPutBuff1[i] == 0); + assertEquals("the output array from inflate should contain 0 because the header of inflate and deflate did not match, but this faled", + 0, outPutBuff1[i]); } } catch (DataFormatException e) { r = 1; } - assertTrue( - "Error: exception should be thrown becuase of header inconsistancy", - r == 1); + assertEquals("Error: exception should be thrown becuase of header inconsistancy", + 1, r); } @@ -429,8 +422,8 @@ inflateDiction.setInput(outPutDiction); } try { - assertTrue("should return 0 because needs dictionary", - inflateDiction.inflate(outPutInf) == 0); + assertEquals("should return 0 because needs dictionary", + 0, inflateDiction.inflate(outPutInf)); } catch (DataFormatException e) { fail("Should not cause exception"); } @@ -501,9 +494,8 @@ "Final decompressed data does not equal the original data", byteArray[i] == outPutInf[i]); } - assertTrue( - "final decompressed data contained more bytes than original - reset", - outPutInf[byteArray.length] == 0); + assertEquals("final decompressed data contained more bytes than original - reset", + 0, outPutInf[byteArray.length]); // testing that resetting the inflater will also return the correct // decompressed data @@ -524,9 +516,8 @@ "Final decompressed data does not equal the original data", byteArray[i] == outPutInf[i]); } - assertTrue( - "final decompressed data contained more bytes than original - reset", - outPutInf[byteArray.length] == 0); + assertEquals("final decompressed data contained more bytes than original - reset", + 0, outPutInf[byteArray.length]); } @@ -556,9 +547,8 @@ } catch (DataFormatException e) { r = 1; } - assertTrue( - "invalid input to be decompressed due to dictionary not set", - r == 1); + assertEquals("invalid input to be decompressed due to dictionary not set", + 1, r); // now setting the dictionary in inflater Inflater inflate = new Inflater(); try { @@ -579,9 +569,8 @@ "Final decompressed data does not equal the original data", byteArray[i] == outPutInf[i]); } - assertTrue( - "final decompressed data contained more bytes than original - deflateB", - outPutInf[byteArray.length] == 0); + assertEquals("final decompressed data contained more bytes than original - deflateB", + 0, outPutInf[byteArray.length]); } /** @@ -617,7 +606,7 @@ } catch (ArrayIndexOutOfBoundsException e) { r = 1; } - assertTrue("boundary check is not present for setInput", r == 1); + assertEquals("boundary check is not present for setInput", 1, r); } protected void setUp() { 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 15:18:06.000000000 +0100 +++ modules/archive/src/test/java/tests/api/java/util/zip/ZipEntryTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -130,7 +130,7 @@ assertTrue("Incorrect compression method returned", zentry.getMethod() == java.util.zip.ZipEntry.DEFLATED); zentry = new ZipEntry("test.tst"); - assertTrue("Incorrect Method Returned.", zentry.getMethod() == -1); + assertEquals("Incorrect Method Returned.", -1, zentry.getMethod()); } /** @@ -208,11 +208,11 @@ assertTrue("Set compressed size failed", zentry.getCompressedSize() == (orgCompressedSize + 10)); zentry.setCompressedSize(0); - assertTrue("Set compressed size failed", - zentry.getCompressedSize() == 0); + assertEquals("Set compressed size failed", + 0, zentry.getCompressedSize()); zentry.setCompressedSize(-25); - assertTrue("Set compressed size failed", - zentry.getCompressedSize() == -25); + assertEquals("Set compressed size failed", + -25, zentry.getCompressedSize()); zentry.setCompressedSize(4294967296l); assertTrue("Set compressed size failed", zentry.getCompressedSize() == 4294967296l); @@ -226,7 +226,7 @@ zentry.setCrc(orgCrc + 100); assertTrue("Failed to set Crc", zentry.getCrc() == (orgCrc + 100)); zentry.setCrc(0); - assertTrue("Failed to set Crc", zentry.getCrc() == 0); + assertEquals("Failed to set Crc", 0, zentry.getCrc()); try { zentry.setCrc(-25); fail("IllegalArgumentException not thrown"); @@ -313,7 +313,7 @@ zentry.setSize(orgSize + 10); assertTrue("Set size failed", zentry.getSize() == (orgSize + 10)); zentry.setSize(0); - assertTrue("Set size failed", zentry.getSize() == 0); + assertEquals("Set size failed", 0, zentry.getSize()); try { zentry.setSize(-25); fail("IllegalArgumentException not thrown"); @@ -385,10 +385,10 @@ zentry.setCompressedSize(4); zentry.setComment("Testing"); ZipEntry zentry2 = new ZipEntry(zentry); - assertTrue("ZipEntry Created With Incorrect Size.", - zentry2.getSize() == 2); - assertTrue("ZipEntry Created With Incorrect Compressed Size.", zentry2 - .getCompressedSize() == 4); + assertEquals("ZipEntry Created With Incorrect Size.", + 2, zentry2.getSize()); + assertEquals("ZipEntry Created With Incorrect Compressed Size.", 4, zentry2 + .getCompressedSize()); assertEquals("ZipEntry Created With Incorrect Comment.", "Testing", zentry2 .getComment()); assertTrue("ZipEntry Created With Incorrect Crc.", Index: modules/archive/src/test/java/tests/api/java/util/zip/ZipInputStreamTest.java =================================================================== --- modules/archive/src/test/java/tests/api/java/util/zip/ZipInputStreamTest.java.orig 2006-04-16 15:17:59.000000000 +0100 +++ modules/archive/src/test/java/tests/api/java/util/zip/ZipInputStreamTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -93,7 +93,7 @@ byte[] rbuf = new byte[(int) zentry.getSize()]; int r = zis.read(rbuf, 0, rbuf.length); new String(rbuf, 0, r); - assertTrue("Failed to read entry", r == 12); + assertEquals("Failed to read entry", 12, r); } catch (java.io.IOException e) { fail("Exception during read test"); } @@ -109,7 +109,7 @@ byte[] rbuf = new byte[(int) zentry.getSize()]; zis.skip(2); int r = zis.read(rbuf, 0, rbuf.length); - assertTrue("Failed to skip data", r == 10); + assertEquals("Failed to skip data", 10, r); } catch (java.io.IOException e) { fail("Unexpected1: " + e); } Index: modules/archive/src/test/java/tests/api/java/util/zip/ZipOutputStreamTest.java =================================================================== --- modules/archive/src/test/java/tests/api/java/util/zip/ZipOutputStreamTest.java.orig 2006-04-16 15:17:59.000000000 +0100 +++ modules/archive/src/test/java/tests/api/java/util/zip/ZipOutputStreamTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -91,7 +91,7 @@ zos.putNextEntry(ze); zos.write("Hello World".getBytes()); zos.finish(); - assertTrue("Finish failed to closeCurrentEntry", ze.getSize() == 11); + assertEquals("Finish failed to closeCurrentEntry", 11, ze.getSize()); } catch (IOException e) { fail("Exception during finish test: " + e.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 15:18:06.000000000 +0100 +++ modules/auth/src/test/java/common/javax/security/auth/PrivateCredentialPermissionTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -750,7 +750,7 @@ assertEquals("CredentialClass ", "a", p.getCredentialClass()); String[][] principals = p.getPrincipals(); - assertTrue("Size:", principals.length == 1); + assertEquals("Size:", 1, principals.length); assertEquals("PrincipalClass:", "b", principals[0][0]); assertEquals("PrincipalName:", "c", principals[0][1]); } @@ -766,7 +766,7 @@ assertEquals("CredentialClass ", "a", p.getCredentialClass()); String[][] principals = p.getPrincipals(); - assertTrue("Size:", principals.length == 1); + assertEquals("Size:", 1, principals.length); assertEquals("PrincipalClass:", "b", principals[0][0]); assertEquals("PrincipalName:", "c", principals[0][1]); } 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 15:18:06.000000000 +0100 +++ modules/auth/src/test/java/common/javax/security/auth/login/LoginContextTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -209,7 +209,7 @@ context.login(); // only one module must be created - assertTrue("Number of modules", MyLoginModule.list.size() == 1); + assertEquals("Number of modules", 1, MyLoginModule.list.size()); MyLoginModule module = (MyLoginModule) MyLoginModule.list.get(0); @@ -369,7 +369,7 @@ context.login(); // only one module must be created - assertTrue("Number of modules", MyLoginModule.list.size() == 1); + assertEquals("Number of modules", 1, MyLoginModule.list.size()); MyLoginModule module = (MyLoginModule) MyLoginModule.list.get(0); @@ -532,7 +532,7 @@ context.login(); // only one module must be created - assertTrue("Number of modules", MyLoginModule.list.size() == 1); + assertEquals("Number of modules", 1, MyLoginModule.list.size()); MyLoginModule module = (MyLoginModule) MyLoginModule.list.get(0); @@ -678,7 +678,7 @@ context.login(); // only one module must be created - assertTrue("Number of modules", MyLoginModule.list.size() == 1); + assertEquals("Number of modules", 1, MyLoginModule.list.size()); MyLoginModule module = (MyLoginModule) MyLoginModule.list.get(0); Index: modules/auth/src/test/java/common/org/apache/harmony/auth/internal/SecurityTest.java =================================================================== --- modules/auth/src/test/java/common/org/apache/harmony/auth/internal/SecurityTest.java.orig 2006-04-16 15:17:59.000000000 +0100 +++ modules/auth/src/test/java/common/org/apache/harmony/auth/internal/SecurityTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -210,7 +210,7 @@ assertTrue("IteratorTest: suite MUST be initialized", set != null && element != null); - assertTrue("IteratorTest: set MUST be empty", set.size() == 0); + assertEquals("IteratorTest: set MUST be empty", 0, set.size()); } /** @@ -656,7 +656,7 @@ assertTrue("SetTest: suite MUST be initialized", set != null && element != null); - assertTrue("SetTest: set MUST be empty", set.size() == 0); + assertEquals("SetTest: set MUST be empty", 0, set.size()); hash.add(element); } @@ -708,13 +708,13 @@ // public void testClear_EmptySet() { set.clear(); - assertTrue("Set MUST be empty", set.size() == 0); + assertEquals("Set MUST be empty", 0, set.size()); } public void testClear_NotEmptySet() { set.add(element); set.clear(); - assertTrue("Set MUST be empty", set.size() == 0); + assertEquals("Set MUST be empty", 0, set.size()); } // @@ -933,8 +933,8 @@ assertTrue("UnsupportedNullTest: suite MUST be initialized", set != null && element != null); - assertTrue("UnsupportedNullTest: set MUST be empty", - set.size() == 0); + assertEquals("UnsupportedNullTest: set MUST be empty", + 0, set.size()); hash.add(null); } @@ -1010,7 +1010,7 @@ assertTrue("Retaining NULL element", set.retainAll(hash)); } catch (NullPointerException npe) { } - assertTrue("Set is empty", set.size() == 0); + assertEquals("Set is empty", 0, set.size()); } } @@ -1047,8 +1047,8 @@ assertTrue("IneligibleElementTest: suite MUST be initialized", set != null && element != null && iElement != null); - assertTrue("IneligibleElementTest: set MUST be empty", - set.size() == 0); + assertEquals("IneligibleElementTest: set MUST be empty", + 0, set.size()); hash.add(null); @@ -1161,7 +1161,7 @@ } catch (ClassCastException e) { } catch (IllegalArgumentException e) { } - assertTrue("Now set is empty", set.size() == 0); + assertEquals("Now set is empty", 0, set.size()); } } Index: modules/crypto/src/test/java/javax/crypto/spec/PSourceTest.java =================================================================== --- modules/crypto/src/test/java/javax/crypto/spec/PSourceTest.java.orig 2006-04-16 15:17:59.000000000 +0100 +++ modules/crypto/src/test/java/javax/crypto/spec/PSourceTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -47,8 +47,8 @@ } catch (NullPointerException e) { } - assertTrue("The PSource.PSpecified DEFAULT value should be byte[0]", - PSource.PSpecified.DEFAULT.getValue().length == 0); + assertEquals("The PSource.PSpecified DEFAULT value should be byte[0]", + 0, PSource.PSpecified.DEFAULT.getValue().length); byte[] p = new byte[] {1, 2, 3, 4, 5}; PSource.PSpecified ps = new PSource.PSpecified(p); Index: modules/crypto/src/test/java/tests/api/javax/crypto/CipherTest.java =================================================================== --- modules/crypto/src/test/java/tests/api/javax/crypto/CipherTest.java.orig 2006-04-16 15:17:59.000000000 +0100 +++ modules/crypto/src/test/java/tests/api/javax/crypto/CipherTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -168,7 +168,7 @@ final String algorithm = "DESede/CBC/PKCS5Padding"; try { Cipher cipher = Cipher.getInstance(algorithm); - assertTrue("Block size does not match", cipher.getBlockSize() == 8); + assertEquals("Block size does not match", 8, cipher.getBlockSize()); } catch (Exception e) { fail("Unexpected Exception"); } Index: modules/luni/src/test/java/tests/api/java/io/BufferedInputStreamTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/io/BufferedInputStreamTest.java.orig 2006-04-16 15:17:59.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/io/BufferedInputStreamTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -199,13 +199,13 @@ InputStream in = new BufferedInputStream( new ByteArrayInputStream(bytes), 12); try { - assertTrue("Wrong initial byte", in.read() == 0); // Fill the + assertEquals("Wrong initial byte", 0, in.read()); // Fill the // buffer byte[] buf = new byte[14]; in.read(buf, 0, 14); // Read greater than the buffer assertTrue("Wrong block read data", new String(buf, 0, 14) .equals(new String(bytes, 1, 14))); - assertTrue("Wrong bytes", in.read() == 15); // Check next byte + assertEquals("Wrong bytes", 15, in.read()); // Check next byte } catch (IOException e) { fail("Exception during read test 2"); } Index: modules/luni/src/test/java/tests/api/java/io/BufferedOutputStreamTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/io/BufferedOutputStreamTest.java.orig 2006-04-16 15:17:59.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/io/BufferedOutputStreamTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -70,8 +70,8 @@ os = new java.io.BufferedOutputStream(baos, 600); os.write(fileString.getBytes(), 0, 500); os.flush(); - assertTrue("Bytes not written after flush", - ((ByteArrayOutputStream) baos).size() == 500); + assertEquals("Bytes not written after flush", + 500, ((ByteArrayOutputStream) baos).size()); } catch (java.io.IOException e) { fail("Flush test failed"); } @@ -88,10 +88,10 @@ baos = new java.io.ByteArrayOutputStream()); os.write(fileString.getBytes(), 0, 500); bais = new java.io.ByteArrayInputStream(baos.toByteArray()); - assertTrue("Bytes written, not buffered", bais.available() == 0); + assertEquals("Bytes written, not buffered", 0, bais.available()); os.flush(); bais = new java.io.ByteArrayInputStream(baos.toByteArray()); - assertTrue("Bytes not written after flush", bais.available() == 500); + assertEquals("Bytes not written after flush", 500, bais.available()); os.write(fileString.getBytes(), 500, 513); bais = new java.io.ByteArrayInputStream(baos.toByteArray()); assertTrue("Bytes not written when buffer full", @@ -117,10 +117,10 @@ os = new java.io.BufferedOutputStream(baos); os.write('t'); bais = new java.io.ByteArrayInputStream(baos.toByteArray()); - assertTrue("Byte written, not buffered", bais.available() == 0); + assertEquals("Byte written, not buffered", 0, bais.available()); os.flush(); bais = new java.io.ByteArrayInputStream(baos.toByteArray()); - assertTrue("Byte not written after flush", bais.available() == 1); + assertEquals("Byte not written after flush", 1, bais.available()); byte[] wbytes = new byte[1]; bais.read(wbytes, 0, 1); assertTrue("Incorrect byte written", wbytes[0] == 't'); 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 15:18:06.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/io/BufferedReaderTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -151,13 +151,13 @@ Reader in = new BufferedReader(new Support_StringReader(new String( chars)), 12); try { - assertTrue("Wrong initial char", in.read() == 0); // Fill the + assertEquals("Wrong initial char", 0, in.read()); // Fill the // buffer char[] buf = new char[14]; in.read(buf, 0, 14); // Read greater than the buffer assertTrue("Wrong block read data", new String(buf) .equals(new String(chars, 1, 14))); - assertTrue("Wrong chars", in.read() == 15); // Check next byte + assertEquals("Wrong chars", 15, in.read()); // Check next byte } catch (IOException e) { fail("Exception during read test 2:" + e); } Index: modules/luni/src/test/java/tests/api/java/io/ByteArrayInputStreamTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/io/ByteArrayInputStreamTest.java.orig 2006-04-16 15:17:59.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/io/ByteArrayInputStreamTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -49,8 +49,8 @@ java.io.InputStream bis = new java.io.ByteArrayInputStream(zz, 0, 100); try { - assertTrue("Unable to create ByteArrayInputStream", - bis.available() == 100); + assertEquals("Unable to create ByteArrayInputStream", + 100, bis.available()); } catch (Exception e) { fail("Exception during Constructor 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 15:18:06.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/io/ByteArrayOutputStreamTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -51,7 +51,7 @@ public void test_ConstructorI() { // Test for method java.io.ByteArrayOutputStream(int) bos = new java.io.ByteArrayOutputStream(100); - assertTrue("Failed to create stream", bos.size() == 0); + assertEquals("Failed to create stream", 0, bos.size()); } /** @@ -60,7 +60,7 @@ public void test_Constructor() { // Test for method java.io.ByteArrayOutputStream() bos = new java.io.ByteArrayOutputStream(); - assertTrue("Failed to create stream", bos.size() == 0); + assertEquals("Failed to create stream", 0, bos.size()); } /** @@ -97,7 +97,7 @@ bos = new java.io.ByteArrayOutputStream(); bos.write(fileString.getBytes(), 0, 100); bos.reset(); - assertTrue("reset failed", bos.size() == 0); + assertEquals("reset failed", 0, bos.size()); } /** @@ -107,9 +107,9 @@ // Test for method int java.io.ByteArrayOutputStream.size() bos = new java.io.ByteArrayOutputStream(); bos.write(fileString.getBytes(), 0, 100); - assertTrue("size test failed", bos.size() == 100); + assertEquals("size test failed", 100, bos.size()); bos.reset(); - assertTrue("size test failed", bos.size() == 0); + assertEquals("size test failed", 0, bos.size()); } /** 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 15:18:06.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/io/CharArrayWriterTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -34,7 +34,7 @@ public void test_Constructor() { // Test for method java.io.CharArrayWriter() cw = new CharArrayWriter(90); - assertTrue("Created incorrect writer", cw.size() == 0); + assertEquals("Created incorrect writer", 0, cw.size()); } /** @@ -43,7 +43,7 @@ public void test_ConstructorI() { // Test for method java.io.CharArrayWriter(int) cw = new CharArrayWriter(); - assertTrue("Created incorrect writer", cw.size() == 0); + assertEquals("Created incorrect writer", 0, cw.size()); } /** @@ -86,9 +86,9 @@ */ public void test_size() { // Test for method int java.io.CharArrayWriter.size() - assertTrue("Returned incorrect size", cw.size() == 0); + assertEquals("Returned incorrect size", 0, cw.size()); cw.write(hw, 5, 5); - assertTrue("Returned incorrect size", cw.size() == 5); + assertEquals("Returned incorrect size", 5, cw.size()); } /** Index: modules/luni/src/test/java/tests/api/java/io/DataInputStreamTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/io/DataInputStreamTest.java.orig 2006-04-16 15:17:59.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/io/DataInputStreamTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -143,8 +143,8 @@ os.writeDouble(2345.76834720202); os.close(); openDataInputStream(); - assertTrue("Incorrect double read", - dis.readDouble() == 2345.76834720202); + assertEquals("Incorrect double read", + 2345.76834720202, dis.readDouble()); } catch (IOException e) { fail("IOException during readDouble test" + e.toString()); } @@ -211,7 +211,7 @@ os.writeInt(768347202); os.close(); openDataInputStream(); - assertTrue("Incorrect int read", dis.readInt() == 768347202); + assertEquals("Incorrect int read", 768347202, dis.readInt()); } catch (IOException e) { fail("IOException during readInt test : " + e.getMessage()); } @@ -242,7 +242,7 @@ os.writeLong(9875645283333L); os.close(); openDataInputStream(); - assertTrue("Incorrect long read", dis.readLong() == 9875645283333L); + assertEquals("Incorrect long read", 9875645283333L, dis.readLong()); } catch (IOException e) { fail("read long test failed : " + e.getMessage()); } @@ -272,7 +272,7 @@ os.writeByte((byte) -127); os.close(); openDataInputStream(); - assertTrue("Incorrect byte read", dis.readUnsignedByte() == 129); + assertEquals("Incorrect byte read", 129, dis.readUnsignedByte()); } catch (IOException e) { fail("IOException during readUnsignedByte test : " + e.getMessage()); } @@ -287,7 +287,7 @@ os.writeShort(9875); os.close(); openDataInputStream(); - assertTrue("Incorrect short read", dis.readUnsignedShort() == 9875); + assertEquals("Incorrect short read", 9875, dis.readUnsignedShort()); } catch (IOException e) { fail("Exception during readShort test : " + e.getMessage()); } 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 15:18:06.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/io/DataOutputStreamTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -52,7 +52,7 @@ openDataInputStream(); int c = dis.readInt(); dis.close(); - assertTrue("Failed to flush correctly", c == 9087589); + assertEquals("Failed to flush correctly", 9087589, c); } catch (IOException e) { fail("Exception during flush test : " + e.getMessage()); } @@ -71,7 +71,7 @@ byte[] rbuf = new byte[150]; dis.read(rbuf, 0, 150); dis.close(); - assertTrue("Incorrect size returned", os.size() == 150); + assertEquals("Incorrect size returned", 150, os.size()); } catch (IOException e) { fail("Exception during write test : " + e.getMessage()); } @@ -217,7 +217,7 @@ openDataInputStream(); double c = dis.readDouble(); dis.close(); - assertTrue("Incorrect double written", c == 908755555456.98); + assertEquals("Incorrect double written", 908755555456.98, c); } catch (IOException e) { fail("Exception during writeDouble test : " + e.getMessage()); } @@ -251,7 +251,7 @@ openDataInputStream(); int c = dis.readInt(); dis.close(); - assertTrue("Incorrect int written", c == 9087589); + assertEquals("Incorrect int written", 9087589, c); } catch (IOException e) { fail("Exception during writeInt test : " + e.getMessage()); } @@ -268,7 +268,7 @@ openDataInputStream(); long c = dis.readLong(); dis.close(); - assertTrue("Incorrect long written", c == 908755555456L); + assertEquals("Incorrect long written", 908755555456L, c); } catch (IOException e) { fail("Exception during writeLong test" + e.getMessage()); } @@ -285,7 +285,7 @@ openDataInputStream(); short c = dis.readShort(); dis.close(); - assertTrue("Incorrect short written", c == 9087); + assertEquals("Incorrect short written", 9087, c); } catch (IOException e) { fail("Exception during writeShort test : " + e.getMessage()); } 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 15:18:06.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/io/FileTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -303,8 +303,8 @@ File f3 = new File("thatFile.tst"); String notAFile = "notAFile.tst"; - assertTrue("Equal files did not answer zero for compareTo", f1 - .compareTo(f2) == 0); + assertEquals("Equal files did not answer zero for compareTo", 0, f1 + .compareTo(f2)); assertTrue("f3.compareTo(f1) did not result in value < 0", f3 .compareTo(f1) < 0); assertTrue("f1.compareTo(f3) did not result in vale > 0", f1 @@ -320,7 +320,7 @@ boolean onWindows = File.separatorChar == '\\'; boolean onUnix = File.separatorChar == '/'; if (onWindows) { - assertTrue("Files Should Return Equal.", f1.compareTo(f3) == 0); + assertEquals("Files Should Return Equal.", 0, f1.compareTo(f3)); } else if (onUnix) { assertTrue("Files Should NOT Return Equal.", f1.compareTo(f3) != 0); } @@ -335,8 +335,8 @@ File f2 = new File("thisFile.file"); File f3 = new File("thatFile.file"); String notAFile = "notAFile.file"; - assertTrue("Equal files did not answer zero for compareTo", f1 - .compareTo((Object) f2) == 0); + assertEquals("Equal files did not answer zero for compareTo", 0, f1 + .compareTo((Object) f2)); assertTrue("f3.compareTo(f1) did not result in value < 0", f3 .compareTo((Object) f1) < 0); assertTrue("f1.compareTo(f3) did not result in vale > 0", f1 @@ -724,16 +724,16 @@ base += slash; File f = new File(base, "temp.tst"); File f2 = f.getAbsoluteFile(); - assertTrue("Test 1: Incorrect File Returned.", f2.compareTo(f - .getAbsoluteFile()) == 0); + assertEquals("Test 1: Incorrect File Returned.", 0, f2.compareTo(f + .getAbsoluteFile())); f = new File(base + "Temp" + slash + slash + "temp.tst"); f2 = f.getAbsoluteFile(); - assertTrue("Test 2: Incorrect File Returned.", f2.compareTo(f - .getAbsoluteFile()) == 0); + assertEquals("Test 2: Incorrect File Returned.", 0, f2.compareTo(f + .getAbsoluteFile())); f = new File(base + slash + ".." + slash + "temp.tst"); f2 = f.getAbsoluteFile(); - assertTrue("Test 3: Incorrect File Returned.", f2.compareTo(f - .getAbsoluteFile()) == 0); + assertEquals("Test 3: Incorrect File Returned.", 0, f2.compareTo(f + .getAbsoluteFile())); f.delete(); f2.delete(); } @@ -771,17 +771,17 @@ base += slash; File f = new File(base, "temp.tst"); File f2 = f.getCanonicalFile(); - assertTrue("Test 1: Incorrect File Returned.", f2 - .getCanonicalFile().compareTo(f.getCanonicalFile()) == 0); + assertEquals("Test 1: Incorrect File Returned.", 0, f2 + .getCanonicalFile().compareTo(f.getCanonicalFile())); f = new File(base + "Temp" + slash + slash + "temp.tst"); f2 = f.getCanonicalFile(); - assertTrue("Test 2: Incorrect File Returned.", f2 - .getCanonicalFile().compareTo(f.getCanonicalFile()) == 0); + assertEquals("Test 2: Incorrect File Returned.", 0, f2 + .getCanonicalFile().compareTo(f.getCanonicalFile())); f = new File(base + "Temp" + slash + slash + ".." + slash + "temp.tst"); f2 = f.getCanonicalFile(); - assertTrue("Test 3: Incorrect File Returned.", f2 - .getCanonicalFile().compareTo(f.getCanonicalFile()) == 0); + assertEquals("Test 3: Incorrect File Returned.", 0, f2 + .getCanonicalFile().compareTo(f.getCanonicalFile())); // Test for when long directory/file names in Windows String osName = System.getProperty("os.name", "unknown"); @@ -796,9 +796,9 @@ dir.mkdir(); f = new File(dir, "longfilename.tst"); f2 = f.getCanonicalFile(); - assertTrue("Test 4: Incorrect File Returned.", - f2.getCanonicalFile().compareTo( - f.getCanonicalFile()) == 0); + assertEquals("Test 4: Incorrect File Returned.", + 0, f2.getCanonicalFile().compareTo( + f.getCanonicalFile())); FileOutputStream fos = new FileOutputStream(f); fos.close(); f2 = new File(testdir + slash + "longdi~1" + slash @@ -996,8 +996,8 @@ f = new File(System.getProperty("user.dir"), "tempfile1.tmp"); File f2 = new File(System.getProperty("user.dir"), "tempfile2.tmp"); File f3 = new File(System.getProperty("user.dir"), "/a/tempfile.tmp"); - assertTrue("Incorrect File Returned", f.getParentFile().compareTo( - f2.getParentFile()) == 0); + assertEquals("Incorrect File Returned", 0, f.getParentFile().compareTo( + f2.getParentFile())); assertTrue("Incorrect File Returned", f.getParentFile().compareTo( f3.getParentFile()) != 0); f.delete(); @@ -1148,8 +1148,8 @@ + "lModTest.tst"); f.delete(); long lastModifiedTime = f.lastModified(); - assertTrue("LastModified Time Should Have Returned 0.", - lastModifiedTime == 0); + assertEquals("LastModified Time Should Have Returned 0.", + 0, lastModifiedTime); FileOutputStream fos = new FileOutputStream(f); fos.close(); f.setLastModified(315550800000L); @@ -1170,7 +1170,7 @@ try { File f = new File(System.getProperty("user.dir"), platformId + "input.tst"); - assertTrue("File Length Should Have Returned 0.", f.length() == 0); + assertEquals("File Length Should Have Returned 0.", 0, f.length()); FileOutputStream fos = new FileOutputStream(f); fos.write(fileString.getBytes()); fos.close(); @@ -1214,9 +1214,8 @@ String[] files = { "mtzz1.xx", "mtzz2.xx", "mtzz3.yy", "mtzz4.yy" }; try { - assertTrue( - "Method list() Should Have Returned An Array Of Length 0.", - dir.list().length == 0); + assertEquals("Method list() Should Have Returned An Array Of Length 0.", + 0, dir.list().length); File file = new File(dir, "notADir.tst"); try { @@ -1264,7 +1263,7 @@ if (check[i] == false) checkCount++; } - assertTrue("Invalid file returned in listing", checkCount == 0); + assertEquals("Invalid file returned in listing", 0, checkCount); for (int i = 0; i < files.length; i++) { File f = new File(dir, files[i]); @@ -1314,8 +1313,8 @@ String[] files = { "1.tst", "2.tst", "3.tst", "" }; try { - assertTrue("listFiles Should Return An Array Of Length 0.", dir - .listFiles().length == 0); + assertEquals("listFiles Should Return An Array Of Length 0.", 0, dir + .listFiles().length); File file = new File(dir, "notADir.tst"); try { @@ -1341,8 +1340,8 @@ // Test to make sure that only the 3 files that were created are // listed. - assertTrue("Incorrect Number Of Files Returned.", - flist.length == 3); + assertEquals("Incorrect Number Of Files Returned.", + 3, flist.length); // Test to make sure that listFiles can read hidden files. boolean onUnix = File.separatorChar == '/'; @@ -1363,8 +1362,8 @@ fos.close(); } flist = dir.listFiles(); - assertTrue("Incorrect Number Of Files Returned.", - flist.length == 4); + assertEquals("Incorrect Number Of Files Returned.", + 4, flist.length); // Checking to make sure the correct files were are listed in // the array. @@ -1384,7 +1383,7 @@ if (check[i] == false) checkCount++; } - assertTrue("Invalid file returned in listing", checkCount == 0); + assertEquals("Invalid file returned in listing", 0, checkCount); if (onWindows) { Runtime r = Runtime.getRuntime(); @@ -1453,8 +1452,8 @@ File dir1 = null; String[] files = { "1.tst", "2.tst", "3.tst" }; try { - assertTrue("listFiles Should Return An Array Of Length 0.", baseDir - .listFiles(dirFilter).length == 0); + assertEquals("listFiles Should Return An Array Of Length 0.", 0, baseDir + .listFiles(dirFilter).length); File file = new File(baseDir, "notADir.tst"); try { @@ -1493,12 +1492,12 @@ // Test to see if the correct number of directories are returned. File[] directories = baseDir.listFiles(dirFilter); - assertTrue("Incorrect Number Of Directories Returned.", - directories.length == 1); + assertEquals("Incorrect Number Of Directories Returned.", + 1, directories.length); // Test to see if the directory was saved with the correct name. - assertTrue("Incorrect Directory Returned.", directories[0] - .compareTo(dir1) == 0); + assertEquals("Incorrect Directory Returned.", 0, directories[0] + .compareTo(dir1)); // Test to see if the correct number of files are returned. File[] flist = baseDir.listFiles(fileFilter); @@ -1523,7 +1522,7 @@ if (check[i] == false) checkCount++; } - assertTrue("Invalid file returned in listing", checkCount == 0); + assertEquals("Invalid file returned in listing", 0, checkCount); for (int i = 0; i < files.length; i++) { File f = new File(baseDir, files[i]); @@ -1583,8 +1582,8 @@ String[] files = { "1.tst", "2.tst", "3.tmp" }; try { - assertTrue("listFiles Should Return An Array Of Length 0.", dir - .listFiles(tstFilter).length == 0); + assertEquals("listFiles Should Return An Array Of Length 0.", 0, dir + .listFiles(tstFilter).length); File file = new File(dir, "notADir.tst"); try { @@ -1622,15 +1621,15 @@ // Tests to see if the correct number of files were returned. File[] flist = dir.listFiles(tstFilter); - assertTrue("Incorrect Number Of Files Passed Through tstFilter.", - flist.length == 2); + assertEquals("Incorrect Number Of Files Passed Through tstFilter.", + 2, flist.length); for (int i = 0; i < flist.length; i++) assertTrue("File Should Not Have Passed The tstFilter.", flist[i].getPath().endsWith(".tst")); flist = dir.listFiles(tmpFilter); - assertTrue("Incorrect Number Of Files Passed Through tmpFilter.", - flist.length == 1); + assertEquals("Incorrect Number Of Files Passed Through tmpFilter.", + 1, flist.length); assertTrue("File Should Not Have Passed The tmpFilter.", flist[0] .getPath().endsWith(".tmp")); @@ -1700,8 +1699,8 @@ */ flist = dir.list(filter); - assertTrue("Array Of Length 0 Should Have Returned.", - flist.length == 0); + assertEquals("Array Of Length 0 Should Have Returned.", + 0, flist.length); try { for (int i = 0; i < files.length; i++) { @@ -1738,7 +1737,7 @@ if (check[i] == false) checkCount++; } - assertTrue("Invalid file returned in listing", checkCount == 0); + assertEquals("Invalid file returned in listing", 0, checkCount); for (int i = 0; i < files.length; i++) { File f = new File(dir, files[i]); @@ -1765,8 +1764,8 @@ boolean onUnix = File.separatorChar == '/'; boolean onWindows = File.separatorChar == '\\'; if (onUnix) { - assertTrue("Incorrect Number Of Root Directories.", - roots.length == 1); + assertEquals("Incorrect Number Of Root Directories.", + 1, roots.length); String fileLoc = roots[0].getPath(); assertTrue("Incorrect Root Directory Returned.", fileLoc .startsWith(slash)); Index: modules/luni/src/test/java/tests/api/java/io/FilterOutputStreamTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/io/FilterOutputStreamTest.java.orig 2006-04-16 15:17:59.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/io/FilterOutputStreamTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -51,7 +51,7 @@ os = new java.io.FilterOutputStream(bos); os.write(fileString.getBytes(), 0, 500); os.flush(); - assertTrue("Bytes not written after flush", bos.size() == 500); + assertEquals("Bytes not written after flush", 500, bos.size()); os.close(); } catch (java.io.IOException e) { fail("Close test failed : " + e.getMessage()); @@ -68,7 +68,7 @@ os = new java.io.FilterOutputStream(bos); os.write(fileString.getBytes(), 0, 500); os.flush(); - assertTrue("Bytes not written after flush", bos.size() == 500); + assertEquals("Bytes not written after flush", 500, bos.size()); os.close(); } catch (java.io.IOException e) { fail("Flush test failed : " + e.getMessage()); @@ -131,7 +131,7 @@ os.write('t'); bis = new java.io.ByteArrayInputStream(bos.toByteArray()); os.flush(); - assertTrue("Byte not written after flush", bis.available() == 1); + assertEquals("Byte not written after flush", 1, bis.available()); byte[] wbytes = new byte[1]; bis.read(wbytes, 0, 1); assertTrue("Incorrect byte written", wbytes[0] == 't'); Index: modules/luni/src/test/java/tests/api/java/io/LineNumberInputStreamTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/io/LineNumberInputStreamTest.java.orig 2006-04-16 15:17:59.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/io/LineNumberInputStreamTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -55,19 +55,19 @@ */ public void test_getLineNumber() { // Test for method int java.io.LineNumberInputStream.getLineNumber() - assertTrue("New stream returned line number other than zero", lnis - .getLineNumber() == 0); + assertEquals("New stream returned line number other than zero", 0, lnis + .getLineNumber()); try { lnis.read(); lnis.read(); } catch (IOException e) { fail("Exception during getLineNumber test : " + e.getMessage()); } - assertTrue("stream returned incorrect line number after read", lnis - .getLineNumber() == 1); + assertEquals("stream returned incorrect line number after read", 1, lnis + .getLineNumber()); lnis.setLineNumber(89); - assertTrue("stream returned incorrect line number after set", lnis - .getLineNumber() == 89); + assertEquals("stream returned incorrect line number after set", 89, lnis + .getLineNumber()); } /** @@ -79,7 +79,7 @@ lnis.mark(40); lnis.skip(4); lnis.reset(); - assertTrue("Failed to mark", lnis.getLineNumber() == 0); + assertEquals("Failed to mark", 0, lnis.getLineNumber()); assertTrue("Failed to mark", lnis.read() == '0'); } catch (IOException e) { fail("Exception during mark test : " + e.getMessage()); @@ -134,7 +134,7 @@ lnis.mark(40); lnis.skip(4); lnis.reset(); - assertTrue("Failed to reset", lnis.getLineNumber() == 0); + assertEquals("Failed to reset", 0, lnis.getLineNumber()); assertTrue("Failed to reset", lnis.read() == '0'); lnis.reset(); } catch (IOException e) { @@ -158,7 +158,7 @@ public void test_setLineNumberI() { // Test for method void java.io.LineNumberInputStream.setLineNumber(int) lnis.setLineNumber(89); - assertTrue("Failed to set line number", lnis.getLineNumber() == 89); + assertEquals("Failed to set line number", 89, lnis.getLineNumber()); } /** @@ -168,8 +168,8 @@ // Test for method long java.io.LineNumberInputStream.skip(long) try { lnis.skip(4); - assertTrue("Skip failed to increment lineNumber", lnis - .getLineNumber() == 2); + assertEquals("Skip failed to increment lineNumber", 2, lnis + .getLineNumber()); } catch (IOException e) { fail("Exception during skip test : " + 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 15:18:06.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/io/LineNumberReaderTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -31,7 +31,7 @@ public void test_ConstructorLjava_io_Reader() { // Test for method java.io.LineNumberReader(java.io.Reader) lnr = new LineNumberReader(new StringReader(text), 4092); - assertTrue("Failed to create reader", lnr.getLineNumber() == 0); + assertEquals("Failed to create reader", 0, lnr.getLineNumber()); } /** @@ -40,7 +40,7 @@ public void test_ConstructorLjava_io_ReaderI() { // Test for method java.io.LineNumberReader(java.io.Reader, int) lnr = new LineNumberReader(new StringReader(text)); - assertTrue("Failed to create reader", lnr.getLineNumber() == 0); + assertEquals("Failed to create reader", 0, lnr.getLineNumber()); } /** @@ -49,8 +49,8 @@ public void test_getLineNumber() { // Test for method int java.io.LineNumberReader.getLineNumber() lnr = new LineNumberReader(new StringReader(text)); - assertTrue("Returned incorrect line number--expected 0, got ", lnr - .getLineNumber() == 0); + assertEquals("Returned incorrect line number--expected 0, got ", 0, lnr + .getLineNumber()); try { lnr.readLine(); lnr.readLine(); @@ -97,8 +97,8 @@ } try { lnr.read(); - assertTrue("Read failed to inc lineNumber", - lnr.getLineNumber() == 1); + assertEquals("Read failed to inc lineNumber", + 1, lnr.getLineNumber()); } catch (IOException e) { fail("Exception during read test:" + e.getMessage()); } @@ -119,7 +119,7 @@ } catch (IOException e) { fail("Exception during read test : " + e.getMessage()); } - assertTrue("Read failed to inc lineNumber", lnr.getLineNumber() == 2); + assertEquals("Read failed to inc lineNumber", 2, lnr.getLineNumber()); } /** @@ -128,7 +128,7 @@ public void test_readLine() { // Test for method java.lang.String java.io.LineNumberReader.readLine() lnr = new LineNumberReader(new StringReader(text)); - assertTrue("Returned incorrect line number", lnr.getLineNumber() == 0); + assertEquals("Returned incorrect line number", 0, lnr.getLineNumber()); String line = null; try { lnr.readLine(); @@ -147,7 +147,7 @@ public void test_reset() { // Test for method void java.io.LineNumberReader.reset() lnr = new LineNumberReader(new StringReader(text)); - assertTrue("Returned incorrect line number", lnr.getLineNumber() == 0); + assertEquals("Returned incorrect line number", 0, lnr.getLineNumber()); String line = null; try { lnr.mark(100); @@ -167,7 +167,7 @@ // Test for method void java.io.LineNumberReader.setLineNumber(int) lnr = new LineNumberReader(new StringReader(text)); lnr.setLineNumber(1001); - assertTrue("set incorrect line number", lnr.getLineNumber() == 1001); + assertEquals("set incorrect line number", 1001, lnr.getLineNumber()); } /** 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 15:18:06.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/io/ObjectInputStreamTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -227,7 +227,7 @@ oos.close(); ois = new ObjectInputStream(new ByteArrayInputStream(bao .toByteArray())); - assertTrue("Read incorrect bytes", ois.available() == 10); + assertEquals("Read incorrect bytes", 10, ois.available()); ois.close(); } catch (IOException e) { fail("Exception serializing data : " + e.getMessage()); @@ -339,7 +339,7 @@ oos.close(); ois = new ObjectInputStream(new ByteArrayInputStream(bao .toByteArray())); - assertTrue("Read incorrect byte value", ois.readByte() == 127); + assertEquals("Read incorrect byte value", 127, ois.readByte()); ois.close(); } catch (IOException e) { fail("Exception serializing data : " + e.getMessage()); @@ -599,8 +599,8 @@ oos.close(); ois = new ObjectInputStream(new ByteArrayInputStream(bao .toByteArray())); - assertTrue("Read incorrect unsignedByte value", ois - .readUnsignedByte() == 255); + assertEquals("Read incorrect unsignedByte value", 255, ois + .readUnsignedByte()); ois.close(); } catch (IOException e) { fail("Exception serializing data : " + e.getMessage()); @@ -617,8 +617,8 @@ oos.close(); ois = new ObjectInputStream(new ByteArrayInputStream(bao .toByteArray())); - assertTrue("Read incorrect unsignedShort value", ois - .readUnsignedShort() == 65535); + assertEquals("Read incorrect unsignedShort value", 65535, ois + .readUnsignedShort()); ois.close(); } 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 15:18:06.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/io/ObjectOutputStreamTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -799,7 +799,7 @@ oos.close(); ois = new ObjectInputStream(new ByteArrayInputStream(bao .toByteArray())); - assertTrue("Wrote incorrect byte value", ois.readByte() == 127); + assertEquals("Wrote incorrect byte value", 127, ois.readByte()); } catch (IOException e) { fail("Exception serializing data : " + e.getMessage()); } @@ -1010,7 +1010,7 @@ oos.close(); ois = new ObjectInputStream(new ByteArrayInputStream(bao .toByteArray())); - assertTrue("Wrote incorrect short value", ois.readShort() == 127); + assertEquals("Wrote incorrect short value", 127, ois.readShort()); } 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 15:18:06.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/io/ObjectStreamFieldTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -65,8 +65,8 @@ // java.io.ObjectStreamField.compareTo(java.lang.Object) assertTrue("Object compared to int did not return > 0", holaField .compareTo(hamField) > 0); - assertTrue("Int compared to itself did not return 0", hamField - .compareTo(hamField) == 0); + assertEquals("Int compared to itself did not return 0", 0, hamField + .compareTo(hamField)); assertTrue("(Int)ham compared to (Int)sam did not return < 0", hamField .compareTo(samField) < 0); } @@ -89,12 +89,12 @@ osfArray = osc.getFields(); assertTrue("getOffset did not return reasonable values", osfArray[0] .getOffset() != osfArray[1].getOffset()); - assertTrue("getOffset for osfArray[0].getOffset() did not return 0", - osfArray[0].getOffset() == 0); - assertTrue("osfArray[1].getOffset() did not return 8", osfArray[1] - .getOffset() == 8); - assertTrue("osfArray[2].getOffset() did not return 12", osfArray[2] - .getOffset() == 12); + assertEquals("getOffset for osfArray[0].getOffset() did not return 0", + 0, osfArray[0].getOffset()); + assertEquals("osfArray[1].getOffset() did not return 8", 8, osfArray[1] + .getOffset()); + assertEquals("osfArray[2].getOffset() did not return 12", 12, osfArray[2] + .getOffset()); } /** Index: modules/luni/src/test/java/tests/api/java/io/PipedInputStreamTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/io/PipedInputStreamTest.java.orig 2006-04-16 15:17:59.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/io/PipedInputStreamTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -146,8 +146,8 @@ pis = new PipedInputStream(); pos = new PipedOutputStream(); try { - assertTrue("Non-conected pipe returned non-zero available bytes", - pis.available() == 0); + assertEquals("Non-conected pipe returned non-zero available bytes", + 0, pis.available()); } catch (IOException e) { fail("IOException getting avail bytes : " + e.getMessage()); } 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 15:18:06.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/io/PrintStreamTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -121,7 +121,7 @@ os = new java.io.PrintStream(bos); os.print(fileString.substring(0, 501)); os.flush(); - assertTrue("Bytes not written after flush.", bos.size() == 501); + assertEquals("Bytes not written after flush.", 501, bos.size()); bos.close(); } catch (java.io.IOException e) { fail("Flush test failed with IOException: " + e.toString()); @@ -147,9 +147,8 @@ } catch (NullPointerException ex) { r = 1; } - assertTrue( - "expected null Pointer Exception for print(char[]) not thrown", - r == 1); + assertEquals("expected null Pointer Exception for print(char[]) not thrown", + 1, r); os = new java.io.PrintStream(bos, true); char[] sc = new char[4000]; Index: modules/luni/src/test/java/tests/api/java/io/PushbackReaderTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/io/PushbackReaderTest.java.orig 2006-04-16 15:17:59.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/io/PushbackReaderTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -203,8 +203,8 @@ numSkipped += pReader2.skip(10); numSkipped += pReader2.skip(10); numSkipped += pReader2.skip(10); - assertTrue("Did not skip correct number of characters", - numSkipped == 7); + assertEquals("Did not skip correct number of characters", + 7, numSkipped); numSkipped = 0; numSkipped += pReader.skip(2); pReader.unread('i'); @@ -223,9 +223,9 @@ numSkipped += pReader.skip(1); numSkipped += pReader.skip(1); numSkipped += pReader.skip(1); - assertTrue("Failed to skip all characters", numSkipped == 6); + assertEquals("Failed to skip all characters", 6, numSkipped); long nextSkipped = pReader.skip(1); - assertTrue("skipped empty reader", nextSkipped == 0); + assertEquals("skipped empty reader", 0, nextSkipped); } catch (IOException e) { fail("Failed to skip more characters" + e); } 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 15:18:06.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/io/RandomAccessFileTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -46,7 +46,7 @@ raf = new java.io.RandomAccessFile(f, "rw"); raf.write(20); raf.seek(0); - assertTrue("Incorrect int read/written", raf.read() == 20); + assertEquals("Incorrect int read/written", 20, raf.read()); raf.close(); } catch (Exception e) { fail("Exception during constructor test: " + e.toString()); @@ -107,8 +107,8 @@ try { raf = new java.io.RandomAccessFile(fileName, "rw"); raf.write(fileString.getBytes(), 0, 1000); - assertTrue("Incorrect filePointer returned", - raf.getFilePointer() == 1000); + assertEquals("Incorrect filePointer returned", + 1000, raf.getFilePointer()); } catch (java.io.IOException e) { fail("getFilePointer test threw an IOException : " + e.getMessage()); } @@ -216,7 +216,7 @@ raf = new java.io.RandomAccessFile(fileName, "rw"); raf.writeByte(127); raf.seek(0); - assertTrue("Incorrect bytes read/written", raf.readByte() == 127); + assertEquals("Incorrect bytes read/written", 127, raf.readByte()); raf.close(); } catch (java.io.IOException e) { fail("readByte test threw an IOException : " + e.getMessage()); @@ -400,8 +400,8 @@ raf = new java.io.RandomAccessFile(fileName, "rw"); raf.writeByte(-1); raf.seek(0); - assertTrue("Incorrect byte read/written", - raf.readUnsignedByte() == 255); + assertEquals("Incorrect byte read/written", + 255, raf.readUnsignedByte()); raf.close(); } catch (java.io.IOException e) { fail("readUnsignedByte test threw an IOException : " @@ -418,8 +418,8 @@ raf = new java.io.RandomAccessFile(fileName, "rw"); raf.writeShort(-1); raf.seek(0); - assertTrue("Incorrect byte read/written", - raf.readUnsignedShort() == 65535); + assertEquals("Incorrect byte read/written", + 65535, raf.readUnsignedShort()); raf.close(); } catch (java.io.IOException e) { fail("readUnsignedShort test threw an IOException : " + e.getMessage()); @@ -451,8 +451,8 @@ raf = new java.io.RandomAccessFile(fileName, "rw"); raf.write(fileString.getBytes(), 0, fileString.length()); raf.seek(12); - assertTrue("Seek failed to set filePointer", - raf.getFilePointer() == 12); + assertEquals("Seek failed to set filePointer", + 12, raf.getFilePointer()); } catch (java.io.IOException e) { fail("seek test threw an IOException : " + e.getMessage()); } @@ -560,7 +560,7 @@ raf = new java.io.RandomAccessFile(fileName, "rw"); raf.writeByte(127); raf.seek(0); - assertTrue("Incorrect byte read/written", raf.readByte() == 127); + assertEquals("Incorrect byte read/written", 127, raf.readByte()); raf.close(); } catch (java.io.IOException e) { fail("Write test threw an IOException : " + e.getMessage()); 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 15:18:06.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/io/SerializationStressTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -439,7 +439,7 @@ oos.writeByte(127); oos.close(); ois = new ObjectInputStream(loadStream()); - assertTrue("Wrote incorrect byte value", ois.readByte() == 127); + assertEquals("Wrote incorrect byte value", 127, ois.readByte()); } catch (IOException e) { fail("IOException serializing data : " + e.getMessage()); } @@ -556,7 +556,7 @@ oos.writeShort(127); oos.close(); ois = new ObjectInputStream(loadStream()); - assertTrue("Wrote incorrect short value", ois.readShort() == 127); + assertEquals("Wrote incorrect short value", 127, ois.readShort()); } catch (IOException e) { fail("IOException serializing data : " + e.getMessage()); } @@ -591,8 +591,8 @@ available2 = ois.available(); obj2 = ois.readObject(); - assertTrue("available returned incorrect value", available1 == 0); - assertTrue("available returned incorrect value", available2 == 0); + assertEquals("available returned incorrect value", 0, available1); + assertEquals("available returned incorrect value", 0, available2); assertTrue("available caused incorrect reading", FOO.equals(obj1)); assertTrue("available returned incorrect value", FOO.equals(obj2)); @@ -656,7 +656,7 @@ Class[] resolvedClasses = ((ObjectInputStreamSubclass) ois) .resolvedClasses(); - assertTrue("missing resolved", resolvedClasses.length == 3); + assertEquals("missing resolved", 3, resolvedClasses.length); assertTrue("resolved class 1", resolvedClasses[0] == Object[].class); assertTrue("resolved class 2", resolvedClasses[1] == Integer.class); assertTrue("resolved class 3", resolvedClasses[2] == Number.class); @@ -681,7 +681,7 @@ ois = new ObjectInputStreamSubclass(loadStream()); assertEquals("Wrong result from readObject()", "R", ois.readObject() ); - assertTrue("Wrong result from readByte()", ois.readByte() == 24); + assertEquals("Wrong result from readByte()", 24, ois.readByte()); ois.close(); } catch (IOException e1) { fail("IOException : " + e1.getMessage()); 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 15:18:06.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/io/StreamTokenizerTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -81,9 +81,8 @@ st.ordinaryChar('/'); st.commentChar('*'); try { - assertTrue( - "nextTokent() did not return the character / skiping the comments starting with *", - st.nextToken() == 47); + assertEquals("nextTokent() did not return the character / skiping the comments starting with *", + 47, st.nextToken()); assertTrue("the next token returned should be the digit 8", st .nextToken() == StreamTokenizer.TT_NUMBER && st.nval == 8.0); @@ -135,12 +134,12 @@ public void test_lineno() { setTest("d\n 8\n"); try { - assertTrue("the lineno should be 1", st.lineno() == 1); + assertEquals("the lineno should be 1", 1, st.lineno()); st.nextToken(); st.nextToken(); - assertTrue("the lineno should be 2", st.lineno() == 2); + assertEquals("the lineno should be 2", 2, st.lineno()); st.nextToken(); - assertTrue("the next line no should be 3", st.lineno() == 3); + assertEquals("the next line no should be 3", 3, st.lineno()); } catch (IOException e) { fail( "IOException occured while trying to read an input stream - constructor"); 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 15:18:06.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/io/StringBufferInputStreamTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -33,8 +33,8 @@ */ public void test_available() { // Test for method int java.io.StringBufferInputStream.available() - assertTrue("Returned incorrect number of available bytes", sbis - .available() == 11); + assertEquals("Returned incorrect number of available bytes", 11, sbis + .available()); } /** @@ -63,7 +63,7 @@ public void test_reset() { // Test for method void java.io.StringBufferInputStream.reset() long s = sbis.skip(6); - assertTrue("Unable to skip correct umber of chars", s == 6); + assertEquals("Unable to skip correct umber of chars", 6, s); sbis.reset(); assertTrue("Failed to reset", sbis.read() == 'H'); } @@ -74,7 +74,7 @@ public void test_skipJ() { // Test for method long java.io.StringBufferInputStream.skip(long) long s = sbis.skip(6); - assertTrue("Unable to skip correct umber of chars", s == 6); + assertEquals("Unable to skip correct umber of chars", 6, s); assertTrue("Skip positioned at incorrect char", sbis.read() == 'W'); } Index: modules/luni/src/test/java/tests/api/java/io/StringReaderTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/io/StringReaderTest.java.orig 2006-04-16 15:17:59.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/io/StringReaderTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -126,7 +126,7 @@ } catch (IOException e) { r = 1; } - assertTrue("Expected IOException not thrown in read()", r == 1); + assertEquals("Expected IOException not thrown in read()", 1, r); } catch (IOException e) { fail("IOException during ready test : " + e.getMessage()); } Index: modules/luni/src/test/java/tests/api/java/lang/ArrayIndexOutOfBoundsExceptionTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/lang/ArrayIndexOutOfBoundsExceptionTest.java.orig 2006-04-16 15:17:59.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/lang/ArrayIndexOutOfBoundsExceptionTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -32,7 +32,7 @@ } catch (ArrayIndexOutOfBoundsException e) { r = 1; } - assertTrue("failed to generate ArrayIndexOutOfBoundsException", r == 1); + assertEquals("failed to generate ArrayIndexOutOfBoundsException", 1, r); } /** @@ -64,7 +64,7 @@ } catch (ArrayIndexOutOfBoundsException e) { r = 1; } - assertTrue("failed to generate ArrayIndexOutOfBoundsException", r == 1); + assertEquals("failed to generate ArrayIndexOutOfBoundsException", 1, r); } 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 15:18:06.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/lang/BooleanTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -104,8 +104,8 @@ // Test for method int java.lang.Boolean.hashCode() // Known values. See comments in java.lang.Boolean.hashCode(). - assertTrue("Incorrect hash for true Boolean.", t.hashCode() == 1231); - assertTrue("Incorrect hash for false Boolean.", f.hashCode() == 1237); + assertEquals("Incorrect hash for true Boolean.", 1231, t.hashCode()); + assertEquals("Incorrect hash for false Boolean.", 1237, f.hashCode()); } /** 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 15:18:06.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/lang/ByteTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -58,8 +58,8 @@ (byte) 2)) < 0); assertTrue("Comparison failed", new Byte((byte) 1).compareTo(new Byte( (byte) -2)) > 0); - assertTrue("Comparison failed", new Byte((byte) 1).compareTo(new Byte( - (byte) 1)) == 0); + assertEquals("Comparison failed", 0, new Byte((byte) 1).compareTo(new Byte( + (byte) 1))); } /** @@ -71,8 +71,8 @@ .compareTo((Object) new Byte((byte) 2)) < 0); assertTrue("Comparison failed", new Byte((byte) 1) .compareTo((Object) new Byte((byte) -2)) > 0); - assertTrue("Comparison failed", new Byte((byte) 1) - .compareTo((Object) new Byte((byte) 1)) == 0); + assertEquals("Comparison failed", 0, new Byte((byte) 1) + .compareTo((Object) new Byte((byte) 1))); try { new Byte((byte) 1).compareTo(new Object()); } catch (ClassCastException e) { @@ -179,8 +179,8 @@ */ public void test_hashCode() { // Test for method int java.lang.Byte.hashCode() - assertTrue("Incorrect hash returned", - new Byte((byte) 127).hashCode() == 127); + assertEquals("Incorrect hash returned", + 127, new Byte((byte) 127).hashCode()); } /** @@ -188,8 +188,8 @@ */ public void test_intValue() { // Test for method int java.lang.Byte.intValue() - assertTrue("Returned incorrect int value", new Byte((byte) 127) - .intValue() == 127); + assertEquals("Returned incorrect int value", 127, new Byte((byte) 127) + .intValue()); } /** @@ -197,8 +197,8 @@ */ public void test_longValue() { // Test for method long java.lang.Byte.longValue() - assertTrue("Returned incorrect long value", new Byte((byte) 127) - .longValue() == 127L); + assertEquals("Returned incorrect long value", 127L, new Byte((byte) 127) + .longValue()); } /** @@ -211,7 +211,7 @@ byte bn = Byte.parseByte("-128"); assertTrue("Invalid parse of byte", b == (byte) 127 && (bn == (byte) -128)); - assertTrue("Returned incorrect value for 0", Byte.parseByte("0") == 0); + assertEquals("Returned incorrect value for 0", 0, Byte.parseByte("0")); assertTrue("Returned incorrect value for most negative value", Byte .parseByte("-128") == (byte) 0x80); assertTrue("Returned incorrect value for most positive value", Byte @@ -254,15 +254,15 @@ byte bn = Byte.parseByte("-128", 10); assertTrue("Invalid parse of dec byte", b == (byte) 127 && (bn == (byte) -128)); - assertTrue("Failed to parse hex value", Byte.parseByte("A", 16) == 10); - assertTrue("Returned incorrect value for 0 hex", Byte - .parseByte("0", 16) == 0); + assertEquals("Failed to parse hex value", 10, Byte.parseByte("A", 16)); + assertEquals("Returned incorrect value for 0 hex", 0, Byte + .parseByte("0", 16)); assertTrue("Returned incorrect value for most negative value hex", Byte .parseByte("-80", 16) == (byte) 0x80); assertTrue("Returned incorrect value for most positive value hex", Byte .parseByte("7f", 16) == 0x7f); - assertTrue("Returned incorrect value for 0 decimal", Byte.parseByte( - "0", 10) == 0); + assertEquals("Returned incorrect value for 0 decimal", 0, Byte.parseByte( + "0", 10)); assertTrue("Returned incorrect value for most negative value decimal", Byte.parseByte("-128", 10) == (byte) 0x80); assertTrue("Returned incorrect value for most positive value decimal", @@ -355,14 +355,14 @@ public void test_valueOfLjava_lang_String() { // Test for method java.lang.Byte // java.lang.Byte.valueOf(java.lang.String) - assertTrue("Returned incorrect byte", - Byte.valueOf("0").byteValue() == 0); - assertTrue("Returned incorrect byte", - Byte.valueOf("127").byteValue() == 127); - assertTrue("Returned incorrect byte", - Byte.valueOf("-127").byteValue() == -127); - assertTrue("Returned incorrect byte", - Byte.valueOf("-128").byteValue() == -128); + assertEquals("Returned incorrect byte", + 0, Byte.valueOf("0").byteValue()); + assertEquals("Returned incorrect byte", + 127, Byte.valueOf("127").byteValue()); + assertEquals("Returned incorrect byte", + -127, Byte.valueOf("-127").byteValue()); + assertEquals("Returned incorrect byte", + -128, Byte.valueOf("-128").byteValue()); try { Byte.valueOf("128"); @@ -379,20 +379,20 @@ public void test_valueOfLjava_lang_StringI() { // Test for method java.lang.Byte // java.lang.Byte.valueOf(java.lang.String, int) - assertTrue("Returned incorrect byte", - Byte.valueOf("A", 16).byteValue() == 10); - assertTrue("Returned incorrect byte", Byte.valueOf("127", 10) - .byteValue() == 127); - assertTrue("Returned incorrect byte", Byte.valueOf("-127", 10) - .byteValue() == -127); - assertTrue("Returned incorrect byte", Byte.valueOf("-128", 10) - .byteValue() == -128); - assertTrue("Returned incorrect byte", Byte.valueOf("7f", 16) - .byteValue() == 127); - assertTrue("Returned incorrect byte", Byte.valueOf("-7f", 16) - .byteValue() == -127); - assertTrue("Returned incorrect byte", Byte.valueOf("-80", 16) - .byteValue() == -128); + assertEquals("Returned incorrect byte", + 10, Byte.valueOf("A", 16).byteValue()); + assertEquals("Returned incorrect byte", 127, Byte.valueOf("127", 10) + .byteValue()); + assertEquals("Returned incorrect byte", -127, Byte.valueOf("-127", 10) + .byteValue()); + assertEquals("Returned incorrect byte", -128, Byte.valueOf("-128", 10) + .byteValue()); + assertEquals("Returned incorrect byte", 127, Byte.valueOf("7f", 16) + .byteValue()); + assertEquals("Returned incorrect byte", -127, Byte.valueOf("-7f", 16) + .byteValue()); + assertEquals("Returned incorrect byte", -128, Byte.valueOf("-80", 16) + .byteValue()); try { Byte.valueOf("128", 10); 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 15:18:06.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/lang/CharacterTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -45,9 +45,9 @@ Character y = new Character('b'); Character z = new Character('d'); - assertTrue("Returned false for same Character", c.compareTo(c) == 0); - assertTrue("Returned false for identical Character", - c.compareTo(x) == 0); + assertEquals("Returned false for same Character", 0, c.compareTo(c)); + assertEquals("Returned false for identical Character", + 0, c.compareTo(x)); assertTrue("Returned other than less than for lesser char", c .compareTo(y) > 0); assertTrue("Returned other than greater than for greater char", c @@ -60,8 +60,8 @@ public void test_compareToLjava_lang_Object() { // Test for method int java.lang.Character.compareTo(java.lang.Object) Character c = new Character('c'); - assertTrue("Returned false for same Character", - c.compareTo((Object) c) == 0); + assertEquals("Returned false for same Character", + 0, c.compareTo((Object) c)); try { c.compareTo(new Object()); } catch (ClassCastException e) { @@ -77,8 +77,8 @@ */ public void test_digitCI() { // Test for method int java.lang.Character.digit(char, int) - assertTrue("Returned incorrect digit", Character.digit('1', 10) == 1); - assertTrue("Returned incorrect digit", Character.digit('F', 16) == 15); + assertEquals("Returned incorrect digit", 1, Character.digit('1', 10)); + assertEquals("Returned incorrect digit", 15, Character.digit('F', 16)); } /** @@ -120,18 +120,18 @@ */ public void test_getNumericValueC() { // Test for method int java.lang.Character.getNumericValue(char) - assertTrue("Returned incorrect numeric value 1", Character - .getNumericValue('1') == 1); - assertTrue("Returned incorrect numeric value 2", Character - .getNumericValue('F') == 15); - assertTrue("Returned incorrect numeric value 3", Character - .getNumericValue('\u221e') == -1); - assertTrue("Returned incorrect numeric value 4", Character - .getNumericValue('\u00be') == -2); - assertTrue("Returned incorrect numeric value 5", Character - .getNumericValue('\u2182') == 10000); - assertTrue("Returned incorrect numeric value 6", Character - .getNumericValue('\uff12') == 2); + assertEquals("Returned incorrect numeric value 1", 1, Character + .getNumericValue('1')); + assertEquals("Returned incorrect numeric value 2", 15, Character + .getNumericValue('F')); + assertEquals("Returned incorrect numeric value 3", -1, Character + .getNumericValue('\u221e')); + assertEquals("Returned incorrect numeric value 4", -2, Character + .getNumericValue('\u00be')); + assertEquals("Returned incorrect numeric value 5", 10000, Character + .getNumericValue('\u2182')); + assertEquals("Returned incorrect numeric value 6", 2, Character + .getNumericValue('\uff12')); } /** @@ -160,9 +160,9 @@ assertTrue("Returned incorrect type for: \u2029", Character .getType('\u2029') == Character.PARAGRAPH_SEPARATOR); - assertTrue("Wrong constant for FORMAT", Character.FORMAT == 16); - assertTrue("Wrong constant for PRIVATE_USE", - Character.PRIVATE_USE == 18); + assertEquals("Wrong constant for FORMAT", 16, Character.FORMAT); + assertEquals("Wrong constant for PRIVATE_USE", + 18, Character.PRIVATE_USE); } /** @@ -170,8 +170,8 @@ */ public void test_hashCode() { // Test for method int java.lang.Character.hashCode() - assertTrue("Incorrect hash returned", - new Character('Y').hashCode() == 89); + assertEquals("Incorrect hash returned", + 89, new Character('Y').hashCode()); } /** Index: modules/luni/src/test/java/tests/api/java/lang/ClassTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/lang/ClassTest.java.orig 2006-04-16 15:18:06.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/lang/ClassTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -180,8 +180,8 @@ */ public void test_getClasses() { // Test for method java.lang.Class [] java.lang.Class.getClasses() - assertTrue("Incorrect class array returned", ClassTest.class - .getClasses().length == 2); + assertEquals("Incorrect class array returned", 2, ClassTest.class + .getClasses().length); } /** @@ -424,8 +424,8 @@ try { java.lang.reflect.Constructor[] c = TestClass.class .getConstructors(); - assertTrue("Incorrect number of constructors returned", - c.length == 1); + assertEquals("Incorrect number of constructors returned", + 1, c.length); } catch (Exception e) { fail("Exception during getDeclaredConstructor test:" + e.toString()); @@ -438,8 +438,8 @@ public void test_getDeclaredClasses() { // Test for method java.lang.Class [] // java.lang.Class.getDeclaredClasses() - assertTrue("Incorrect class array returned", ClassTest.class - .getClasses().length == 2); + assertEquals("Incorrect class array returned", 2, ClassTest.class + .getClasses().length); } /** @@ -473,8 +473,8 @@ try { java.lang.reflect.Constructor[] c = TestClass.class .getDeclaredConstructors(); - assertTrue("Incorrect number of constructors returned", - c.length == 2); + assertEquals("Incorrect number of constructors returned", + 2, c.length); } catch (Exception e) { fail("Exception during getDeclaredConstructor test:" + e.toString()); @@ -490,8 +490,8 @@ try { java.lang.reflect.Field f = TestClass.class .getDeclaredField("pubField"); - assertTrue("Returned incorrect field", - f.getInt(new TestClass()) == 2); + assertEquals("Returned incorrect field", + 2, f.getInt(new TestClass())); } catch (Exception e) { fail("Exception getting fields : " + e.getMessage()); } @@ -505,10 +505,10 @@ // java.lang.Class.getDeclaredFields() try { java.lang.reflect.Field[] f = TestClass.class.getDeclaredFields(); - assertTrue("Returned incorrect number of fields", f.length == 4); + assertEquals("Returned incorrect number of fields", 4, f.length); f = SubTestClass.class.getDeclaredFields(); // Declared fields do not include inherited - assertTrue("Returned incorrect number of fields", f.length == 0); + assertEquals("Returned incorrect number of fields", 0, f.length); } catch (Exception e) { fail("Exception getting fields : " + e.getMessage()); } @@ -525,8 +525,8 @@ try { java.lang.reflect.Method m = TestClass.class.getDeclaredMethod( "pubMethod", new Class[0]); - assertTrue("Returned incorrect method", ((Integer) (m.invoke( - new TestClass(), new Class[0]))).intValue() == 2); + assertEquals("Returned incorrect method", 2, ((Integer) (m.invoke( + new TestClass(), new Class[0]))).intValue()); m = TestClass.class.getDeclaredMethod("privMethod", new Class[0]); try { // Invoking private non-sub, non-package @@ -548,9 +548,9 @@ // java.lang.Class.getDeclaredMethods() try { java.lang.reflect.Method[] m = TestClass.class.getDeclaredMethods(); - assertTrue("Returned incorrect number of methods", m.length == 3); + assertEquals("Returned incorrect number of methods", 3, m.length); m = SubTestClass.class.getDeclaredMethods(); - assertTrue("Returned incorrect number of methods", m.length == 0); + assertEquals("Returned incorrect number of methods", 0, m.length); } catch (Exception e) { fail("Exception getting methods : " + e.getMessage()); } @@ -572,8 +572,8 @@ // java.lang.Class.getField(java.lang.String) try { java.lang.reflect.Field f = TestClass.class.getField("pubField"); - assertTrue("Returned incorrect field", - f.getInt(new TestClass()) == 2); + assertEquals("Returned incorrect field", + 2, f.getInt(new TestClass())); try { f = TestClass.class.getField("privField"); } catch (NoSuchFieldException e) { @@ -612,8 +612,8 @@ Class[] interfaces; List interfaceList; interfaces = java.lang.Object.class.getInterfaces(); - assertTrue("Incorrect interface list for Object", - interfaces.length == 0); + assertEquals("Incorrect interface list for Object", + 0, interfaces.length); interfaceList = Arrays.asList(java.util.Vector.class.getInterfaces()); assertTrue("Incorrect interface list for Vector", interfaceList .contains(java.lang.Cloneable.class) @@ -630,8 +630,8 @@ try { java.lang.reflect.Method m = TestClass.class.getMethod("pubMethod", new Class[0]); - assertTrue("Returned incorrect method", ((Integer) (m.invoke( - new TestClass(), new Class[0]))).intValue() == 2); + assertEquals("Returned incorrect method", 2, ((Integer) (m.invoke( + new TestClass(), new Class[0]))).intValue()); try { m = TestClass.class.getMethod("privMethod", new Class[0]); } catch (NoSuchMethodException e) { @@ -795,7 +795,7 @@ str != null); try { assertTrue("Cannot read single byte", str.read() != -1); - assertTrue("Cannot read multiple bytes", str.read(new byte[5]) == 5); + assertEquals("Cannot read multiple bytes", 5, str.read(new byte[5])); str.close(); } catch (IOException e) { fail("Exception while closing resource stream 1."); @@ -806,8 +806,8 @@ assertTrue("Can't find resource", str2 != null); try { assertTrue("Cannot read single byte", str2.read() != -1); - assertTrue("Cannot read multiple bytes", - str2.read(new byte[5]) == 5); + assertEquals("Cannot read multiple bytes", + 5, str2.read(new byte[5])); str2.close(); } catch (IOException e) { fail("IOException while closing resource stream 2 : " @@ -1011,9 +1011,8 @@ } catch (Exception e) { r = 1; } - assertTrue( - "Exception for instantiating a newInstance with no default constructor is not thrown", - r == 1); + assertEquals("Exception for instantiating a newInstance with no default constructor is not thrown", + 1, r); // There needs to be considerably more testing here. } Index: modules/luni/src/test/java/tests/api/java/lang/DoubleTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/lang/DoubleTest.java.orig 2006-04-16 15:17:59.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/lang/DoubleTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -290,8 +290,8 @@ public void test_ConstructorD() { // Test for method java.lang.Double(double) Double d = new Double(39089.88888888888888888888888888888888); - assertTrue("Created incorrect double", - d.doubleValue() == 39089.88888888888888888888888888888888); + assertEquals("Created incorrect double", + 39089.88888888888888888888888888888888, d.doubleValue()); } /** @@ -301,8 +301,8 @@ // Test for method java.lang.Double(java.lang.String) Double d = new Double("39089.88888888888888888888888888888888"); - assertTrue("Created incorrect double", - d.doubleValue() == 39089.88888888888888888888888888888888); + assertEquals("Created incorrect double", + 39089.88888888888888888888888888888888, d.doubleValue()); } /** @@ -371,9 +371,8 @@ */ public void test_doubleValue() { // Test for method double java.lang.Double.doubleValue() - assertTrue( - "Incorrect double value returned", - new Double(999999999999999.9999999999999).doubleValue() == 999999999999999.9999999999999); + assertEquals("Incorrect double value returned", + 999999999999999.9999999999999, new Double(999999999999999.9999999999999).doubleValue()); } /** @@ -422,8 +421,8 @@ assertTrue("Invalid hash for equal but not identical doubles ", d .hashCode() == dd.hashCode()); } - assertTrue("Magic assumption hasCode (0.0) = 0 failed", new Double(0.0) - .hashCode() == 0); + assertEquals("Magic assumption hasCode (0.0) = 0 failed", 0, new Double(0.0) + .hashCode()); } /** @@ -432,7 +431,7 @@ public void test_intValue() { // Test for method int java.lang.Double.intValue() Double d = new Double(1923311.47712); - assertTrue("Returned incorrect int value", d.intValue() == 1923311); + assertEquals("Returned incorrect int value", 1923311, d.intValue()); } /** @@ -499,15 +498,15 @@ public void test_longValue() { // Test for method long java.lang.Double.longValue() Double d = new Double(1923311.47712); - assertTrue("Returned incorrect long value", d.longValue() == 1923311); + assertEquals("Returned incorrect long value", 1923311, d.longValue()); } /** * @tests java.lang.Double#parseDouble(java.lang.String) */ public void test_parseDoubleLjava_lang_String() { - assertTrue("Incorrect double returned, expected zero.", Double - .parseDouble("2.4703282292062327208828439643411e-324") == 0.0); + assertEquals("Incorrect double returned, expected zero.", 0.0, Double + .parseDouble("2.4703282292062327208828439643411e-324")); assertTrue( "Incorrect double returned, expected minimum double.", Double.parseDouble("2.4703282292062327208828439643412e-324") == Double.MIN_VALUE); @@ -663,7 +662,7 @@ public void test_shortValue() { // Test for method short java.lang.Double.shortValue() Double d = new Double(1923311.47712); - assertTrue("Returned incorrect short value", d.shortValue() == 22767); + assertEquals("Returned incorrect short value", 22767, d.shortValue()); } /** 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 15:18:06.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/lang/IntegerTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -27,7 +27,7 @@ public void test_ConstructorI() { // Test for method java.lang.Integer(int) Integer i = new Integer(-89000); - assertTrue("Incorrect Integer created", i.intValue() == -89000); + assertEquals("Incorrect Integer created", -89000, i.intValue()); } /** @@ -36,7 +36,7 @@ public void test_ConstructorLjava_lang_String() { // Test for method java.lang.Integer(java.lang.String) Integer i = new Integer("65000"); - assertTrue("Created incorrect Integer", i.intValue() == 65000); + assertEquals("Created incorrect Integer", 65000, i.intValue()); } /** @@ -44,10 +44,10 @@ */ public void test_byteValue() { // Test for method byte java.lang.Integer.byteValue() - assertTrue("Returned incorrect byte value", new Integer(65535) - .byteValue() == -1); - assertTrue("Returned incorrect byte value", new Integer(127) - .byteValue() == 127); + assertEquals("Returned incorrect byte value", -1, new Integer(65535) + .byteValue()); + assertEquals("Returned incorrect byte value", 127, new Integer(127) + .byteValue()); } /** @@ -57,8 +57,8 @@ // Test for method int java.lang.Integer.compareTo(java.lang.Integer) assertTrue("-2 compared to 1 gave non-negative answer", new Integer(-2) .compareTo(new Integer(1)) < 0); - assertTrue("-2 compared to -2 gave non-zero answer", new Integer(-2) - .compareTo(new Integer(-2)) == 0); + assertEquals("-2 compared to -2 gave non-zero answer", 0, new Integer(-2) + .compareTo(new Integer(-2))); assertTrue("3 compared to 2 gave non-positive answer", new Integer(3) .compareTo(new Integer(2)) > 0); } @@ -70,8 +70,8 @@ // Test for method int java.lang.Integer.compareTo(java.lang.Object) assertTrue("-2 compared to 1 gave non-negative answer", new Integer(-2) .compareTo((Object) new Integer(1)) < 0); - assertTrue("-2 compared to -2 gave non-zero answer", new Integer(-2) - .compareTo((Object) new Integer(-2)) == 0); + assertEquals("-2 compared to -2 gave non-zero answer", 0, new Integer(-2) + .compareTo((Object) new Integer(-2))); assertTrue("3 compared to 2 gave non-positive answer", new Integer(3) .compareTo((Object) new Integer(2)) > 0); try { @@ -90,19 +90,19 @@ public void test_decodeLjava_lang_String() { // Test for method java.lang.Integer // java.lang.Integer.decode(java.lang.String) - assertTrue("Failed for 132233", - Integer.decode("132233").intValue() == 132233); - assertTrue("Failed for 07654321", - Integer.decode("07654321").intValue() == 07654321); + assertEquals("Failed for 132233", + 132233, Integer.decode("132233").intValue()); + assertEquals("Failed for 07654321", + 07654321, Integer.decode("07654321").intValue()); assertTrue("Failed for #1234567", Integer.decode("#1234567").intValue() == 0x1234567); assertTrue("Failed for 0xdAd", Integer.decode("0xdAd").intValue() == 0xdad); - assertTrue("Failed for -23", Integer.decode("-23").intValue() == -23); - assertTrue("Returned incorrect value for 0 decimal", Integer - .decode("0").intValue() == 0); - assertTrue("Returned incorrect value for 0 hex", Integer.decode("0x0") - .intValue() == 0); + assertEquals("Failed for -23", -23, Integer.decode("-23").intValue()); + assertEquals("Returned incorrect value for 0 decimal", 0, Integer + .decode("0").intValue()); + assertEquals("Returned incorrect value for 0 hex", 0, Integer.decode("0x0") + .intValue()); assertTrue("Returned incorrect value for most negative value decimal", Integer.decode("-2147483648").intValue() == 0x80000000); assertTrue("Returned incorrect value for most negative value hex", @@ -173,10 +173,10 @@ */ public void test_doubleValue() { // Test for method double java.lang.Integer.doubleValue() - assertTrue("Returned incorrect double value", new Integer(2147483647) - .doubleValue() == 2147483647.0); - assertTrue("Returned incorrect double value", new Integer(-2147483647) - .doubleValue() == -2147483647.0); + assertEquals("Returned incorrect double value", 2147483647.0, new Integer(2147483647) + .doubleValue()); + assertEquals("Returned incorrect double value", -2147483647.0, new Integer(-2147483647) + .doubleValue()); } /** @@ -265,7 +265,7 @@ // Test for method int java.lang.Integer.intValue() Integer i = new Integer(8900); - assertTrue("Returned incorrect int value", i.intValue() == 8900); + assertEquals("Returned incorrect int value", 8900, i.intValue()); } /** @@ -274,7 +274,7 @@ public void test_longValue() { // Test for method long java.lang.Integer.longValue() Integer i = new Integer(8900); - assertTrue("Returned incorrect long value", i.longValue() == 8900L); + assertEquals("Returned incorrect long value", 8900L, i.longValue()); } /** @@ -284,8 +284,8 @@ // Test for method int java.lang.Integer.parseInt(java.lang.String) int i = Integer.parseInt("-8900"); - assertTrue("Returned incorrect int", i == -8900); - assertTrue("Returned incorrect value for 0", Integer.parseInt("0") == 0); + assertEquals("Returned incorrect int", -8900, i); + assertEquals("Returned incorrect value for 0", 0, Integer.parseInt("0")); assertTrue("Returned incorrect value for most negative value", Integer .parseInt("-2147483648") == 0x80000000); assertTrue("Returned incorrect value for most positive value", Integer @@ -324,20 +324,20 @@ */ public void test_parseIntLjava_lang_StringI() { // Test for method int java.lang.Integer.parseInt(java.lang.String, int) - assertTrue("Parsed dec val incorrectly", - Integer.parseInt("-8000", 10) == -8000); - assertTrue("Parsed hex val incorrectly", - Integer.parseInt("FF", 16) == 255); - assertTrue("Parsed oct val incorrectly", - Integer.parseInt("20", 8) == 16); - assertTrue("Returned incorrect value for 0 hex", Integer.parseInt("0", - 16) == 0); + assertEquals("Parsed dec val incorrectly", + -8000, Integer.parseInt("-8000", 10)); + assertEquals("Parsed hex val incorrectly", + 255, Integer.parseInt("FF", 16)); + assertEquals("Parsed oct val incorrectly", + 16, Integer.parseInt("20", 8)); + assertEquals("Returned incorrect value for 0 hex", 0, Integer.parseInt("0", + 16)); assertTrue("Returned incorrect value for most negative value hex", Integer.parseInt("-80000000", 16) == 0x80000000); assertTrue("Returned incorrect value for most positive value hex", Integer.parseInt("7fffffff", 16) == 0x7fffffff); - assertTrue("Returned incorrect value for 0 decimal", Integer.parseInt( - "0", 10) == 0); + assertEquals("Returned incorrect value for 0 decimal", 0, Integer.parseInt( + "0", 10)); assertTrue("Returned incorrect value for most negative value decimal", Integer.parseInt("-2147483648", 10) == 0x80000000); assertTrue("Returned incorrect value for most positive value decimal", @@ -406,7 +406,7 @@ public void test_shortValue() { // Test for method short java.lang.Integer.shortValue() Integer i = new Integer(2147450880); - assertTrue("Returned incorrect long value", i.shortValue() == -32768); + assertEquals("Returned incorrect long value", -32768, i.shortValue()); } /** @@ -525,8 +525,8 @@ public void test_valueOfLjava_lang_String() { // Test for method java.lang.Integer // java.lang.Integer.valueOf(java.lang.String) - assertTrue("Returned incorrect int", Integer.valueOf("8888888") - .intValue() == 8888888); + assertEquals("Returned incorrect int", 8888888, Integer.valueOf("8888888") + .intValue()); assertTrue("Returned incorrect int", Integer.valueOf("2147483647") .intValue() == Integer.MAX_VALUE); assertTrue("Returned incorrect int", Integer.valueOf("-2147483648") @@ -557,19 +557,19 @@ public void test_valueOfLjava_lang_StringI() { // Test for method java.lang.Integer // java.lang.Integer.valueOf(java.lang.String, int) - assertTrue("Returned incorrect int for hex string", Integer.valueOf( - "FF", 16).intValue() == 255); - assertTrue("Returned incorrect int for oct string", Integer.valueOf( - "20", 8).intValue() == 16); - assertTrue("Returned incorrect int for bin string", Integer.valueOf( - "100", 2).intValue() == 4); - - assertTrue("Returned incorrect int for - hex string", Integer.valueOf( - "-FF", 16).intValue() == -255); - assertTrue("Returned incorrect int for - oct string", Integer.valueOf( - "-20", 8).intValue() == -16); - assertTrue("Returned incorrect int for - bin string", Integer.valueOf( - "-100", 2).intValue() == -4); + assertEquals("Returned incorrect int for hex string", 255, Integer.valueOf( + "FF", 16).intValue()); + assertEquals("Returned incorrect int for oct string", 16, Integer.valueOf( + "20", 8).intValue()); + assertEquals("Returned incorrect int for bin string", 4, Integer.valueOf( + "100", 2).intValue()); + + assertEquals("Returned incorrect int for - hex string", -255, Integer.valueOf( + "-FF", 16).intValue()); + assertEquals("Returned incorrect int for - oct string", -16, Integer.valueOf( + "-20", 8).intValue()); + assertEquals("Returned incorrect int for - bin string", -4, Integer.valueOf( + "-100", 2).intValue()); assertTrue("Returned incorrect int", Integer.valueOf("2147483647", 10) .intValue() == Integer.MAX_VALUE); assertTrue("Returned incorrect int", Integer.valueOf("-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 15:18:06.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/lang/LongTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -27,7 +27,7 @@ // Test for method java.lang.Long(long) Long l = new Long(-8900000006L); - assertTrue("Created incorrect Long", l.longValue() == -8900000006L); + assertEquals("Created incorrect Long", -8900000006L, l.longValue()); } /** @@ -37,7 +37,7 @@ // Test for method java.lang.Long(java.lang.String) Long l = new Long("-8900000006"); - assertTrue("Created incorrect Long", l.longValue() == -8900000006L); + assertEquals("Created incorrect Long", -8900000006L, l.longValue()); } /** @@ -46,9 +46,9 @@ public void test_byteValue() { // Test for method byte java.lang.Long.byteValue() Long l = new Long(127); - assertTrue("Returned incorrect byte value", l.byteValue() == 127); - assertTrue("Returned incorrect byte value", new Long(Long.MAX_VALUE) - .byteValue() == -1); + assertEquals("Returned incorrect byte value", 127, l.byteValue()); + assertEquals("Returned incorrect byte value", -1, new Long(Long.MAX_VALUE) + .byteValue()); } /** @@ -58,8 +58,8 @@ // Test for method int java.lang.Long.compareTo(java.lang.Long) assertTrue("-2 compared to 1 gave non-negative answer", new Long(-2L) .compareTo(new Long(1L)) < 0); - assertTrue("-2 compared to -2 gave non-zero answer", new Long(-2L) - .compareTo(new Long(-2L)) == 0); + assertEquals("-2 compared to -2 gave non-zero answer", 0, new Long(-2L) + .compareTo(new Long(-2L))); assertTrue("3 compared to 2 gave non-positive answer", new Long(3L) .compareTo(new Long(2L)) > 0); } @@ -71,8 +71,8 @@ // Test for method int java.lang.Long.compareTo(java.lang.Object) assertTrue("-2 compared to 1 gave non-negative answer", new Long(-2L) .compareTo((Object) new Long(1L)) < 0); - assertTrue("-2 compared to -2 gave non-zero answer", new Long(-2L) - .compareTo((Object) new Long(-2L)) == 0); + assertEquals("-2 compared to -2 gave non-zero answer", 0, new Long(-2L) + .compareTo((Object) new Long(-2L))); assertTrue("3 compared to 2 gave non-positive answer", new Long(3L) .compareTo((Object) new Long(2L)) > 0); try { @@ -91,14 +91,14 @@ public void test_decodeLjava_lang_String() { // Test for method java.lang.Long // java.lang.Long.decode(java.lang.String) - assertTrue("Returned incorrect value for hex string", Long.decode( - "0xFF").longValue() == 255L); - assertTrue("Returned incorrect value for dec string", Long.decode( - "-89000").longValue() == -89000L); - assertTrue("Returned incorrect value for 0 decimal", Long.decode("0") - .longValue() == 0); - assertTrue("Returned incorrect value for 0 hex", Long.decode("0x0") - .longValue() == 0); + assertEquals("Returned incorrect value for hex string", 255L, Long.decode( + "0xFF").longValue()); + assertEquals("Returned incorrect value for dec string", -89000L, Long.decode( + "-89000").longValue()); + assertEquals("Returned incorrect value for 0 decimal", 0, Long.decode("0") + .longValue()); + assertEquals("Returned incorrect value for 0 hex", 0, Long.decode("0x0") + .longValue()); assertTrue( "Returned incorrect value for most negative value decimal", Long.decode("-9223372036854775808").longValue() == 0x8000000000000000L); @@ -177,8 +177,8 @@ public void test_doubleValue() { // Test for method double java.lang.Long.doubleValue() Long l = new Long(10000000); - assertTrue("Returned incorrect double value", - l.doubleValue() == 10000000.0); + assertEquals("Returned incorrect double value", + 10000000.0, l.doubleValue()); } @@ -270,9 +270,9 @@ public void test_intValue() { // Test for method int java.lang.Long.intValue() Long l = new Long(100000); - assertTrue("Returned incorrect int value", l.intValue() == 100000); - assertTrue("Returned incorrect int value", new Long(Long.MAX_VALUE) - .intValue() == -1); + assertEquals("Returned incorrect int value", 100000, l.intValue()); + assertEquals("Returned incorrect int value", -1, new Long(Long.MAX_VALUE) + .intValue()); } /** @@ -281,8 +281,8 @@ public void test_longValue() { // Test for method long java.lang.Long.longValue() Long l = new Long(89000000005L); - assertTrue("Returned incorrect long value", - l.longValue() == 89000000005L); + assertEquals("Returned incorrect long value", + 89000000005L, l.longValue()); } /** @@ -292,8 +292,8 @@ // Test for method long java.lang.Long.parseLong(java.lang.String) long l = Long.parseLong("89000000005"); - assertTrue("Parsed to incorrect long value", l == 89000000005L); - assertTrue("Returned incorrect value for 0", Long.parseLong("0") == 0); + assertEquals("Parsed to incorrect long value", 89000000005L, l); + assertEquals("Returned incorrect value for 0", 0, Long.parseLong("0")); assertTrue("Returned incorrect value for most negative value", Long .parseLong("-9223372036854775808") == 0x8000000000000000L); assertTrue("Returned incorrect value for most positive value", Long @@ -323,21 +323,21 @@ */ public void test_parseLongLjava_lang_StringI() { // Test for method long java.lang.Long.parseLong(java.lang.String, int) - assertTrue("Returned incorrect value", - Long.parseLong("100000000", 10) == 100000000L); - assertTrue("Returned incorrect value from hex string", Long.parseLong( - "FFFFFFFFF", 16) == 68719476735L); + assertEquals("Returned incorrect value", + 100000000L, Long.parseLong("100000000", 10)); + assertEquals("Returned incorrect value from hex string", 68719476735L, Long.parseLong( + "FFFFFFFFF", 16)); assertTrue("Returned incorrect value from octal string: " + Long.parseLong("77777777777"), Long.parseLong("77777777777", 8) == 8589934591L); - assertTrue("Returned incorrect value for 0 hex", Long - .parseLong("0", 16) == 0); + assertEquals("Returned incorrect value for 0 hex", 0, Long + .parseLong("0", 16)); assertTrue("Returned incorrect value for most negative value hex", Long .parseLong("-8000000000000000", 16) == 0x8000000000000000L); assertTrue("Returned incorrect value for most positive value hex", Long .parseLong("7fffffffffffffff", 16) == 0x7fffffffffffffffL); - assertTrue("Returned incorrect value for 0 decimal", Long.parseLong( - "0", 10) == 0); + assertEquals("Returned incorrect value for 0 decimal", 0, Long.parseLong( + "0", 10)); assertTrue( "Returned incorrect value for most negative value decimal", Long.parseLong("-9223372036854775808", 10) == 0x8000000000000000L); @@ -408,9 +408,9 @@ public void test_shortValue() { // Test for method short java.lang.Long.shortValue() Long l = new Long(10000); - assertTrue("Returned incorrect short value", l.shortValue() == 10000); - assertTrue("Returned incorrect short value", new Long(Long.MAX_VALUE) - .shortValue() == -1); + assertEquals("Returned incorrect short value", 10000, l.shortValue()); + assertEquals("Returned incorrect short value", -1, new Long(Long.MAX_VALUE) + .shortValue()); } /** @@ -516,8 +516,8 @@ public void test_valueOfLjava_lang_String() { // Test for method java.lang.Long // java.lang.Long.valueOf(java.lang.String) - assertTrue("Returned incorrect value", Long.valueOf("100000000") - .longValue() == 100000000L); + assertEquals("Returned incorrect value", 100000000L, Long.valueOf("100000000") + .longValue()); assertTrue("Returned incorrect value", Long.valueOf( "9223372036854775807").longValue() == Long.MAX_VALUE); assertTrue("Returned incorrect value", Long.valueOf( @@ -561,10 +561,10 @@ public void test_valueOfLjava_lang_StringI() { // Test for method java.lang.Long // java.lang.Long.valueOf(java.lang.String, int) - assertTrue("Returned incorrect value", Long.valueOf("100000000", 10) - .longValue() == 100000000L); - assertTrue("Returned incorrect value from hex string", Long.valueOf( - "FFFFFFFFF", 16).longValue() == 68719476735L); + assertEquals("Returned incorrect value", 100000000L, Long.valueOf("100000000", 10) + .longValue()); + assertEquals("Returned incorrect value from hex string", 68719476735L, Long.valueOf( + "FFFFFFFFF", 16).longValue()); assertTrue("Returned incorrect value from octal string: " + Long.valueOf("77777777777", 8).toString(), Long.valueOf( "77777777777", 8).longValue() == 8589934591L); Index: modules/luni/src/test/java/tests/api/java/lang/MathTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/lang/MathTest.java.orig 2006-04-16 15:17:59.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/lang/MathTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -118,8 +118,10 @@ */ public void test_ceilD() { // Test for method double java.lang.Math.ceil(double) - assertTrue("Incorrect ceiling for double", Math.ceil(78.89) == 79); - assertTrue("Incorrect ceiling for double", Math.ceil(-78.89) == -78); + assertEquals("Incorrect ceiling for double", + 79, Math.ceil(78.89), 0); + assertEquals("Incorrect ceiling for double", + -78, Math.ceil(-78.89), 0); } /** @@ -127,8 +129,8 @@ */ public void test_cosD() { // Test for method double java.lang.Math.cos(double) - assertTrue("Incorrect answer", Math.cos(0) == 1.0); - assertTrue("Incorrect answer", Math.cos(1) == 0.5403023058681398); + assertEquals("Incorrect answer", 1.0, Math.cos(0)); + assertEquals("Incorrect answer", 0.5403023058681398, Math.cos(1)); } /** @@ -148,8 +150,10 @@ */ public void test_floorD() { // Test for method double java.lang.Math.floor(double) - assertTrue("Incorrect floor for double", Math.floor(78.89) == 78); - assertTrue("Incorrect floor for double", Math.floor(-78.89) == -79); + assertEquals("Incorrect floor for double", + 78, Math.floor(78.89), 0); + assertEquals("Incorrect floor for double", + -79, Math.floor(-78.89), 0); } /** @@ -157,8 +161,8 @@ */ public void test_IEEEremainderDD() { // Test for method double java.lang.Math.IEEEremainder(double, double) - assertTrue("Incorrect remainder returned", - Math.IEEEremainder(1.0, 1.0) == 0.0); + assertEquals("Incorrect remainder returned", + 0.0, Math.IEEEremainder(1.0, 1.0)); assertTrue("Incorrect remainder returned", Math.IEEEremainder(1.32, 89.765) >= 1.4705063220631647E-2 || Math.IEEEremainder(1.32, 89.765) >= 1.4705063220631649E-2); @@ -182,12 +186,12 @@ */ public void test_maxDD() { // Test for method double java.lang.Math.max(double, double) - assertTrue("Incorrect double max value", Math.max(-1908897.6000089, - 1908897.6000089) == 1908897.6000089); - assertTrue("Incorrect double max value", - Math.max(2.0, 1908897.6000089) == 1908897.6000089); - assertTrue("Incorrect double max value", Math.max(-2.0, - -1908897.6000089) == -2.0); + assertEquals("Incorrect double max value", 1908897.6000089, Math.max(-1908897.6000089, + 1908897.6000089)); + assertEquals("Incorrect double max value", + 1908897.6000089, Math.max(2.0, 1908897.6000089)); + assertEquals("Incorrect double max value", -2.0, Math.max(-2.0, + -1908897.6000089)); } @@ -209,11 +213,11 @@ */ public void test_maxII() { // Test for method int java.lang.Math.max(int, int) - assertTrue("Incorrect int max value", - Math.max(-19088976, 19088976) == 19088976); - assertTrue("Incorrect int max value", - Math.max(20, 19088976) == 19088976); - assertTrue("Incorrect int max value", Math.max(-20, -19088976) == -20); + assertEquals("Incorrect int max value", + 19088976, Math.max(-19088976, 19088976)); + assertEquals("Incorrect int max value", + 19088976, Math.max(20, 19088976)); + assertEquals("Incorrect int max value", -20, Math.max(-20, -19088976)); } /** @@ -221,12 +225,12 @@ */ public void test_maxJJ() { // Test for method long java.lang.Math.max(long, long) - assertTrue("Incorrect long max value", Math.max(-19088976000089L, - 19088976000089L) == 19088976000089L); - assertTrue("Incorrect long max value", - Math.max(20, 19088976000089L) == 19088976000089L); - assertTrue("Incorrect long max value", - Math.max(-20, -19088976000089L) == -20); + assertEquals("Incorrect long max value", 19088976000089L, Math.max(-19088976000089L, + 19088976000089L)); + assertEquals("Incorrect long max value", + 19088976000089L, Math.max(20, 19088976000089L)); + assertEquals("Incorrect long max value", + -20, Math.max(-20, -19088976000089L)); } /** @@ -234,12 +238,12 @@ */ public void test_minDD() { // Test for method double java.lang.Math.min(double, double) - assertTrue("Incorrect double min value", Math.min(-1908897.6000089, - 1908897.6000089) == -1908897.6000089); - assertTrue("Incorrect double min value", - Math.min(2.0, 1908897.6000089) == 2.0); - assertTrue("Incorrect double min value", Math.min(-2.0, - -1908897.6000089) == -1908897.6000089); + assertEquals("Incorrect double min value", -1908897.6000089, Math.min(-1908897.6000089, + 1908897.6000089)); + assertEquals("Incorrect double min value", + 2.0, Math.min(2.0, 1908897.6000089)); + assertEquals("Incorrect double min value", -1908897.6000089, Math.min(-2.0, + -1908897.6000089)); } /** @@ -260,11 +264,11 @@ */ public void test_minII() { // Test for method int java.lang.Math.min(int, int) - assertTrue("Incorrect int min value", - Math.min(-19088976, 19088976) == -19088976); - assertTrue("Incorrect int min value", Math.min(20, 19088976) == 20); - assertTrue("Incorrect int min value", - Math.min(-20, -19088976) == -19088976); + assertEquals("Incorrect int min value", + -19088976, Math.min(-19088976, 19088976)); + assertEquals("Incorrect int min value", 20, Math.min(20, 19088976)); + assertEquals("Incorrect int min value", + -19088976, Math.min(-20, -19088976)); } @@ -273,12 +277,12 @@ */ public void test_minJJ() { // Test for method long java.lang.Math.min(long, long) - assertTrue("Incorrect long min value", Math.min(-19088976000089L, - 19088976000089L) == -19088976000089L); - assertTrue("Incorrect long min value", - Math.min(20, 19088976000089L) == 20); - assertTrue("Incorrect long min value", - Math.min(-20, -19088976000089L) == -19088976000089L); + assertEquals("Incorrect long min value", -19088976000089L, Math.min(-19088976000089L, + 19088976000089L)); + assertEquals("Incorrect long min value", + 20, Math.min(20, 19088976000089L)); + assertEquals("Incorrect long min value", + -19088976000089L, Math.min(-20, -19088976000089L)); } /** @@ -290,8 +294,8 @@ (long) Math.pow(2, 8) == 256l); assertTrue("pow returned incorrect value", Math.pow(2, -8) == 0.00390625d); - assertTrue("Incorrect root returned1", Math.sqrt(Math.pow(Math.sqrt(2), - 4)) == 2); + assertEquals("Incorrect root returned1", + 2, Math.sqrt(Math.pow(Math.sqrt(2), 4)), 0); } /** @@ -299,12 +303,12 @@ */ public void test_rintD() { // Test for method double java.lang.Math.rint(double) - assertTrue("Failed to round properly - up to odd", - Math.rint(2.9) == 3.0); + assertEquals("Failed to round properly - up to odd", + 3.0, Math.rint(2.9)); assertTrue("Failed to round properly - NaN", Double.isNaN(Math .rint(Double.NaN))); - assertTrue("Failed to round properly down to even", - Math.rint(2.1) == 2.0); + assertEquals("Failed to round properly down to even", + 2.0, Math.rint(2.1)); assertTrue("Failed to round properly " + 2.5 + " to even", Math .rint(2.5) == 2.0); } @@ -314,7 +318,7 @@ */ public void test_roundD() { // Test for method long java.lang.Math.round(double) - assertTrue("Incorrect rounding of a float", Math.round(-90.89d) == -91); + assertEquals("Incorrect rounding of a float", -91, Math.round(-90.89d)); } /** @@ -322,7 +326,7 @@ */ public void test_roundF() { // Test for method int java.lang.Math.round(float) - assertTrue("Incorrect rounding of a float", Math.round(-90.89f) == -91); + assertEquals("Incorrect rounding of a float", -91, Math.round(-90.89f)); } /** @@ -330,8 +334,8 @@ */ public void test_sinD() { // Test for method double java.lang.Math.sin(double) - assertTrue("Incorrect answer", Math.sin(0) == 0.0); - assertTrue("Incorrect answer", Math.sin(1) == 0.8414709848078965); + assertEquals("Incorrect answer", 0.0, Math.sin(0)); + assertEquals("Incorrect answer", 0.8414709848078965, Math.sin(1)); } /** @@ -339,7 +343,7 @@ */ public void test_sqrtD() { // Test for method double java.lang.Math.sqrt(double) - assertTrue("Incorrect root returned2", Math.sqrt(49) == 7); + assertEquals("Incorrect root returned2", 7, Math.sqrt(49), 0); } /** @@ -347,8 +351,8 @@ */ public void test_tanD() { // Test for method double java.lang.Math.tan(double) - assertTrue("Incorrect answer", Math.tan(0) == 0.0); - assertTrue("Incorrect answer", Math.tan(1) == 1.5574077246549023); + assertEquals("Incorrect answer", 0.0, Math.tan(0)); + assertEquals("Incorrect answer", 1.5574077246549023, Math.tan(1)); } @@ -357,10 +361,10 @@ */ public void test_random() { // There isn't a place for these tests so just stick them here - assertTrue("Wrong value E", - Double.doubleToLongBits(Math.E) == 4613303445314885481L); - assertTrue("Wrong value PI", - Double.doubleToLongBits(Math.PI) == 4614256656552045848L); + assertEquals("Wrong value E", + 4613303445314885481L, Double.doubleToLongBits(Math.E)); + assertEquals("Wrong value PI", + 4614256656552045848L, Double.doubleToLongBits(Math.PI)); for (int i = 500; i >= 0; i--) { double d = Math.random(); 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 15:18:06.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/lang/ShortTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -48,10 +48,10 @@ */ public void test_byteValue() { // Test for method byte java.lang.Short.byteValue() - assertTrue("Returned incorrect byte value", new Short(Short.MIN_VALUE) - .byteValue() == 0); - assertTrue("Returned incorrect byte value", new Short(Short.MAX_VALUE) - .byteValue() == -1); + assertEquals("Returned incorrect byte value", 0, new Short(Short.MIN_VALUE) + .byteValue()); + assertEquals("Returned incorrect byte value", -1, new Short(Short.MAX_VALUE) + .byteValue()); } /** @@ -69,8 +69,8 @@ "Should have returned positive value when compared to lesser short", s.compareTo(x) > 0); x = new Short((short) 1); - assertTrue("Should have returned zero when compared to equal short", s - .compareTo(x) == 0); + assertEquals("Should have returned zero when compared to equal short", 0, s + .compareTo(x)); x = "5"; try { s.compareTo(x); @@ -97,8 +97,8 @@ "Should have returned positive value when compared to lesser short", s.compareTo(x) > 0); x = new Short((short) 1); - assertTrue("Should have returned zero when compared to equal short", s - .compareTo(x) == 0); + assertEquals("Should have returned zero when compared to equal short", 0, s + .compareTo(x)); } /** @@ -174,10 +174,10 @@ */ public void test_doubleValue() { // Test for method double java.lang.Short.doubleValue() - assertTrue("Returned incorrect double value", - new Short(Short.MIN_VALUE).doubleValue() == -32768.0); - assertTrue("Returned incorrect double value", - new Short(Short.MAX_VALUE).doubleValue() == 32767.0); + assertEquals("Returned incorrect double value", + -32768.0, new Short(Short.MIN_VALUE).doubleValue()); + assertEquals("Returned incorrect double value", + 32767.0, new Short(Short.MAX_VALUE).doubleValue()); } /** @@ -218,10 +218,10 @@ */ public void test_intValue() { // Test for method int java.lang.Short.intValue() - assertTrue("Returned incorrect int value", new Short(Short.MIN_VALUE) - .intValue() == -32768); - assertTrue("Returned incorrect int value", new Short(Short.MAX_VALUE) - .intValue() == 32767); + assertEquals("Returned incorrect int value", -32768, new Short(Short.MIN_VALUE) + .intValue()); + assertEquals("Returned incorrect int value", 32767, new Short(Short.MAX_VALUE) + .intValue()); } /** @@ -229,10 +229,10 @@ */ public void test_longValue() { // Test for method long java.lang.Short.longValue() - assertTrue("Returned incorrect long value", new Short(Short.MIN_VALUE) - .longValue() == -32768); - assertTrue("Returned incorrect long value", new Short(Short.MAX_VALUE) - .longValue() == 32767); + assertEquals("Returned incorrect long value", -32768, new Short(Short.MIN_VALUE) + .longValue()); + assertEquals("Returned incorrect long value", 32767, new Short(Short.MAX_VALUE) + .longValue()); } /** @@ -245,7 +245,7 @@ assertTrue("Incorrect parse of short", sp == (short) 32746 && (sn == (short) -32746)); - assertTrue("Returned incorrect value for 0", Short.parseShort("0") == 0); + assertEquals("Returned incorrect value for 0", 0, Short.parseShort("0")); assertTrue("Returned incorrect value for most negative value", Short .parseShort("-32768") == (short) 0x8000); assertTrue("Returned incorrect value for most positive value", Short @@ -277,28 +277,28 @@ // Test for method short java.lang.Short.parseShort(java.lang.String, // int) boolean aThrow = true; - assertTrue("Incorrectly parsed hex string", - Short.parseShort("FF", 16) == 255); - assertTrue("Incorrectly parsed oct string", - Short.parseShort("20", 8) == 16); - assertTrue("Incorrectly parsed dec string", - Short.parseShort("20", 10) == 20); - assertTrue("Incorrectly parsed bin string", - Short.parseShort("100", 2) == 4); - assertTrue("Incorrectly parsed -hex string", Short - .parseShort("-FF", 16) == -255); - assertTrue("Incorrectly parsed -oct string", - Short.parseShort("-20", 8) == -16); - assertTrue("Incorrectly parsed -bin string", Short - .parseShort("-100", 2) == -4); - assertTrue("Returned incorrect value for 0 hex", Short.parseShort("0", - 16) == 0); + assertEquals("Incorrectly parsed hex string", + 255, Short.parseShort("FF", 16)); + assertEquals("Incorrectly parsed oct string", + 16, Short.parseShort("20", 8)); + assertEquals("Incorrectly parsed dec string", + 20, Short.parseShort("20", 10)); + assertEquals("Incorrectly parsed bin string", + 4, Short.parseShort("100", 2)); + assertEquals("Incorrectly parsed -hex string", -255, Short + .parseShort("-FF", 16)); + assertEquals("Incorrectly parsed -oct string", + -16, Short.parseShort("-20", 8)); + assertEquals("Incorrectly parsed -bin string", -4, Short + .parseShort("-100", 2)); + assertEquals("Returned incorrect value for 0 hex", 0, Short.parseShort("0", + 16)); assertTrue("Returned incorrect value for most negative value hex", Short.parseShort("-8000", 16) == (short) 0x8000); assertTrue("Returned incorrect value for most positive value hex", Short.parseShort("7fff", 16) == 0x7fff); - assertTrue("Returned incorrect value for 0 decimal", Short.parseShort( - "0", 10) == 0); + assertEquals("Returned incorrect value for 0 decimal", 0, Short.parseShort( + "0", 10)); assertTrue("Returned incorrect value for most negative value decimal", Short.parseShort("-32768", 10) == (short) 0x8000); assertTrue("Returned incorrect value for most positive value decimal", @@ -406,10 +406,10 @@ public void test_valueOfLjava_lang_String() { // Test for method java.lang.Short // java.lang.Short.valueOf(java.lang.String) - assertTrue("Returned incorrect short", Short.valueOf("-32768") - .shortValue() == -32768); - assertTrue("Returned incorrect short", Short.valueOf("32767") - .shortValue() == 32767); + assertEquals("Returned incorrect short", -32768, Short.valueOf("-32768") + .shortValue()); + assertEquals("Returned incorrect short", 32767, Short.valueOf("32767") + .shortValue()); } /** @@ -419,20 +419,20 @@ // Test for method java.lang.Short // java.lang.Short.valueOf(java.lang.String, int) boolean aThrow = true; - assertTrue("Incorrectly parsed hex string", Short.valueOf("FF", 16) - .shortValue() == 255); - assertTrue("Incorrectly parsed oct string", Short.valueOf("20", 8) - .shortValue() == 16); - assertTrue("Incorrectly parsed dec string", Short.valueOf("20", 10) - .shortValue() == 20); - assertTrue("Incorrectly parsed bin string", Short.valueOf("100", 2) - .shortValue() == 4); - assertTrue("Incorrectly parsed -hex string", Short.valueOf("-FF", 16) - .shortValue() == -255); - assertTrue("Incorrectly parsed -oct string", Short.valueOf("-20", 8) - .shortValue() == -16); - assertTrue("Incorrectly parsed -bin string", Short.valueOf("-100", 2) - .shortValue() == -4); + assertEquals("Incorrectly parsed hex string", 255, Short.valueOf("FF", 16) + .shortValue()); + assertEquals("Incorrectly parsed oct string", 16, Short.valueOf("20", 8) + .shortValue()); + assertEquals("Incorrectly parsed dec string", 20, Short.valueOf("20", 10) + .shortValue()); + assertEquals("Incorrectly parsed bin string", 4, Short.valueOf("100", 2) + .shortValue()); + assertEquals("Incorrectly parsed -hex string", -255, Short.valueOf("-FF", 16) + .shortValue()); + assertEquals("Incorrectly parsed -oct string", -16, Short.valueOf("-20", 8) + .shortValue()); + assertEquals("Incorrectly parsed -bin string", -4, Short.valueOf("-100", 2) + .shortValue()); assertTrue("Did not decode 32767 correctly", Short.valueOf("32767", 10) .shortValue() == (short) 32767); assertTrue("Did not decode -32767 correctly", Short.valueOf("-32767", Index: modules/luni/src/test/java/tests/api/java/lang/StrictMathTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/lang/StrictMathTest.java.orig 2006-04-16 15:17:59.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/lang/StrictMathTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -114,9 +114,10 @@ */ public void test_ceilD() { // Test for method double java.lang.StrictMath.ceil(double) - assertTrue("Incorrect ceiling for double", StrictMath.ceil(78.89) == 79); - assertTrue("Incorrect ceiling for double", - StrictMath.ceil(-78.89) == -78); + assertEquals("Incorrect ceiling for double", + 79, StrictMath.ceil(78.89), 0.0); + assertEquals("Incorrect ceiling for double", + -78, StrictMath.ceil(-78.89), 0.0); } /** @@ -146,9 +147,10 @@ */ public void test_floorD() { // Test for method double java.lang.StrictMath.floor(double) - assertTrue("Incorrect floor for double", StrictMath.floor(78.89) == 78); - assertTrue("Incorrect floor for double", - StrictMath.floor(-78.89) == -79); + assertEquals("Incorrect floor for double", + 78, StrictMath.floor(78.89), 0.0); + assertEquals("Incorrect floor for double", + -79, StrictMath.floor(-78.89), 0.0); } /** @@ -157,8 +159,8 @@ public void test_IEEEremainderDD() { // Test for method double java.lang.StrictMath.IEEEremainder(double, // double) - assertTrue("Incorrect remainder returned", StrictMath.IEEEremainder( - 1.0, 1.0) == 0.0); + assertEquals("Incorrect remainder returned", 0.0, StrictMath.IEEEremainder( + 1.0, 1.0)); assertTrue( "Incorrect remainder returned", StrictMath.IEEEremainder(1.32, 89.765) >= 1.4705063220631647E-2 @@ -184,12 +186,12 @@ */ public void test_maxDD() { // Test for method double java.lang.StrictMath.max(double, double) - assertTrue("Incorrect double max value", StrictMath.max( - -1908897.6000089, 1908897.6000089) == 1908897.6000089); - assertTrue("Incorrect double max value", StrictMath.max(2.0, - 1908897.6000089) == 1908897.6000089); - assertTrue("Incorrect double max value", StrictMath.max(-2.0, - -1908897.6000089) == -2.0); + assertEquals("Incorrect double max value", 1908897.6000089, StrictMath.max( + -1908897.6000089, 1908897.6000089)); + assertEquals("Incorrect double max value", 1908897.6000089, StrictMath.max(2.0, + 1908897.6000089)); + assertEquals("Incorrect double max value", -2.0, StrictMath.max(-2.0, + -1908897.6000089)); } @@ -211,12 +213,12 @@ */ public void test_maxII() { // Test for method int java.lang.StrictMath.max(int, int) - assertTrue("Incorrect int max value", StrictMath.max(-19088976, - 19088976) == 19088976); - assertTrue("Incorrect int max value", - StrictMath.max(20, 19088976) == 19088976); - assertTrue("Incorrect int max value", - StrictMath.max(-20, -19088976) == -20); + assertEquals("Incorrect int max value", 19088976, StrictMath.max(-19088976, + 19088976)); + assertEquals("Incorrect int max value", + 19088976, StrictMath.max(20, 19088976)); + assertEquals("Incorrect int max value", + -20, StrictMath.max(-20, -19088976)); } /** @@ -224,12 +226,12 @@ */ public void test_maxJJ() { // Test for method long java.lang.StrictMath.max(long, long) - assertTrue("Incorrect long max value", StrictMath.max(-19088976000089L, - 19088976000089L) == 19088976000089L); - assertTrue("Incorrect long max value", StrictMath.max(20, - 19088976000089L) == 19088976000089L); - assertTrue("Incorrect long max value", StrictMath.max(-20, - -19088976000089L) == -20); + assertEquals("Incorrect long max value", 19088976000089L, StrictMath.max(-19088976000089L, + 19088976000089L)); + assertEquals("Incorrect long max value", 19088976000089L, StrictMath.max(20, + 19088976000089L)); + assertEquals("Incorrect long max value", -20, StrictMath.max(-20, + -19088976000089L)); } /** @@ -237,12 +239,12 @@ */ public void test_minDD() { // Test for method double java.lang.StrictMath.min(double, double) - assertTrue("Incorrect double min value", StrictMath.min( - -1908897.6000089, 1908897.6000089) == -1908897.6000089); - assertTrue("Incorrect double min value", StrictMath.min(2.0, - 1908897.6000089) == 2.0); - assertTrue("Incorrect double min value", StrictMath.min(-2.0, - -1908897.6000089) == -1908897.6000089); + assertEquals("Incorrect double min value", -1908897.6000089, StrictMath.min( + -1908897.6000089, 1908897.6000089)); + assertEquals("Incorrect double min value", 2.0, StrictMath.min(2.0, + 1908897.6000089)); + assertEquals("Incorrect double min value", -1908897.6000089, StrictMath.min(-2.0, + -1908897.6000089)); } /** @@ -263,12 +265,12 @@ */ public void test_minII() { // Test for method int java.lang.StrictMath.min(int, int) - assertTrue("Incorrect int min value", StrictMath.min(-19088976, - 19088976) == -19088976); - assertTrue("Incorrect int min value", - StrictMath.min(20, 19088976) == 20); - assertTrue("Incorrect int min value", - StrictMath.min(-20, -19088976) == -19088976); + assertEquals("Incorrect int min value", -19088976, StrictMath.min(-19088976, + 19088976)); + assertEquals("Incorrect int min value", + 20, StrictMath.min(20, 19088976)); + assertEquals("Incorrect int min value", + -19088976, StrictMath.min(-20, -19088976)); } @@ -277,12 +279,12 @@ */ public void test_minJJ() { // Test for method long java.lang.StrictMath.min(long, long) - assertTrue("Incorrect long min value", StrictMath.min(-19088976000089L, - 19088976000089L) == -19088976000089L); - assertTrue("Incorrect long min value", StrictMath.min(20, - 19088976000089L) == 20); - assertTrue("Incorrect long min value", StrictMath.min(-20, - -19088976000089L) == -19088976000089L); + assertEquals("Incorrect long min value", -19088976000089L, StrictMath.min(-19088976000089L, + 19088976000089L)); + assertEquals("Incorrect long min value", 20, StrictMath.min(20, + 19088976000089L)); + assertEquals("Incorrect long min value", -19088976000089L, StrictMath.min(-20, + -19088976000089L)); } /** @@ -301,12 +303,12 @@ */ public void test_rintD() { // Test for method double java.lang.StrictMath.rint(double) - assertTrue("Failed to round properly - up to odd", - StrictMath.rint(2.9) == 3.0); + assertEquals("Failed to round properly - up to odd", + 3.0, StrictMath.rint(2.9)); assertTrue("Failed to round properly - NaN", Double.isNaN(StrictMath .rint(Double.NaN))); - assertTrue("Failed to round properly down to even", StrictMath - .rint(2.1) == 2.0); + assertEquals("Failed to round properly down to even", 2.0, StrictMath + .rint(2.1)); assertTrue("Failed to round properly " + 2.5 + " to even", StrictMath .rint(2.5) == 2.0); } @@ -316,8 +318,8 @@ */ public void test_roundD() { // Test for method long java.lang.StrictMath.round(double) - assertTrue("Incorrect rounding of a float", - StrictMath.round(-90.89d) == -91); + assertEquals("Incorrect rounding of a float", + -91, StrictMath.round(-90.89d)); } /** @@ -325,8 +327,8 @@ */ public void test_roundF() { // Test for method int java.lang.StrictMath.round(float) - assertTrue("Incorrect rounding of a float", - StrictMath.round(-90.89f) == -91); + assertEquals("Incorrect rounding of a float", + -91, StrictMath.round(-90.89f)); } /** @@ -343,9 +345,9 @@ */ public void test_sqrtD() { // Test for method double java.lang.StrictMath.sqrt(double) - assertTrue("Incorrect root returned1", StrictMath.sqrt(StrictMath.pow( - StrictMath.sqrt(2), 4)) == 2); - assertTrue("Incorrect root returned2", StrictMath.sqrt(49) == 7); + assertEquals("Incorrect root returned1", + 2, StrictMath.sqrt(StrictMath.pow(StrictMath.sqrt(2), 4)), 0.0); + assertEquals("Incorrect root returned2", 7, StrictMath.sqrt(49), 0.0); } /** @@ -364,10 +366,10 @@ */ public void test_random() { // There isn't a place for these tests so just stick them here - assertTrue("Wrong value E", - Double.doubleToLongBits(StrictMath.E) == 4613303445314885481L); - assertTrue("Wrong value PI", - Double.doubleToLongBits(StrictMath.PI) == 4614256656552045848L); + assertEquals("Wrong value E", + 4613303445314885481L, Double.doubleToLongBits(StrictMath.E)); + assertEquals("Wrong value PI", + 4614256656552045848L, Double.doubleToLongBits(StrictMath.PI)); for (int i = 500; i >= 0; i--) { double d = StrictMath.random(); 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 15:18:06.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/lang/StringBufferTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -34,8 +34,8 @@ public void test_ConstructorI() { // Test for method java.lang.StringBuffer(int) StringBuffer sb = new StringBuffer(8); - assertTrue("Newly constructed buffer is of incorrect length", sb - .length() == 0); + assertEquals("Newly constructed buffer is of incorrect length", 0, sb + .length()); } /** @@ -81,9 +81,9 @@ char[] buf1 = { 'H', 'e', 'l', 'l', 'o' }; char[] buf2 = { 'W', 'o', 'r', 'l', 'd' }; sb.append(buf1, 0, buf1.length); - assertTrue("Buffer is invalid length after append", sb.length() == 5); + assertEquals("Buffer is invalid length after append", 5, sb.length()); sb.append(buf2, 0, buf2.length); - assertTrue("Buffer is invalid length after append", sb.length() == 10); + assertEquals("Buffer is invalid length after append", 10, sb.length()); assertTrue("Buffer contains invalid chars", (sb.toString() .equals("HelloWorld"))); } @@ -98,9 +98,9 @@ char buf1 = 'H'; char buf2 = 'W'; sb.append(buf1); - assertTrue("Buffer is invalid length after append", sb.length() == 1); + assertEquals("Buffer is invalid length after append", 1, sb.length()); sb.append(buf2); - assertTrue("Buffer is invalid length after append", sb.length() == 2); + assertEquals("Buffer is invalid length after append", 2, sb.length()); assertTrue("Buffer contains invalid chars", (sb.toString().equals("HW"))); } @@ -113,7 +113,7 @@ // java.lang.StringBuffer.append(double) StringBuffer sb = new StringBuffer(); sb.append(Double.MAX_VALUE); - assertTrue("Buffer is invalid length after append", sb.length() == 22); + assertEquals("Buffer is invalid length after append", 22, sb.length()); assertEquals("Buffer contains invalid characters", "1.7976931348623157E308", sb.toString()); } @@ -141,9 +141,9 @@ // java.lang.StringBuffer.append(int) StringBuffer sb = new StringBuffer(); sb.append(9000); - assertTrue("Buffer is invalid length after append", sb.length() == 4); + assertEquals("Buffer is invalid length after append", 4, sb.length()); sb.append(1000); - assertTrue("Buffer is invalid length after append", sb.length() == 8); + assertEquals("Buffer is invalid length after append", 8, sb.length()); assertEquals("Buffer contains invalid characters", "90001000", sb.toString()); } @@ -158,7 +158,7 @@ StringBuffer sb = new StringBuffer(); long t = 927654321098L; sb.append(t); - assertTrue("Buffer is of invlaid length", sb.length() == 12); + assertEquals("Buffer is of invlaid length", 12, sb.length()); assertEquals("Buffer contains invalid characters", "927654321098", sb.toString()); } @@ -188,9 +188,9 @@ String buf1 = "Hello"; String buf2 = "World"; sb.append(buf1); - assertTrue("Buffer is invalid length after append", sb.length() == 5); + assertEquals("Buffer is invalid length after append", 5, sb.length()); sb.append(buf2); - assertTrue("Buffer is invalid length after append", sb.length() == 10); + assertEquals("Buffer is invalid length after append", 10, sb.length()); assertTrue("Buffer contains invalid chars", (sb.toString() .equals("HelloWorld"))); } @@ -203,9 +203,9 @@ // java.lang.StringBuffer.append(boolean) StringBuffer sb = new StringBuffer(); sb.append(false); - assertTrue("Buffer is invalid length after append", sb.length() == 5); + assertEquals("Buffer is invalid length after append", 5, sb.length()); sb.append(true); - assertTrue("Buffer is invalid length after append", sb.length() == 9); + assertEquals("Buffer is invalid length after append", 9, sb.length()); assertTrue("Buffer is invalid length after append", (sb.toString() .equals("falsetrue"))); } @@ -216,7 +216,7 @@ public void test_capacity() { // Test for method int java.lang.StringBuffer.capacity() StringBuffer sb = new StringBuffer(10); - assertTrue("Returned incorrect capacity", sb.capacity() == 10); + assertEquals("Returned incorrect capacity", 10, sb.capacity()); sb.ensureCapacity(100); assertTrue("Returned incorrect capacity", sb.capacity() >= 100); } @@ -458,7 +458,7 @@ */ public void test_length() { // Test for method int java.lang.StringBuffer.length() - assertTrue("Incorrect length returned", testBuffer.length() == 21); + assertEquals("Incorrect length returned", 21, testBuffer.length()); } /** @@ -559,11 +559,11 @@ public void test_setLengthI() { // Test for method void java.lang.StringBuffer.setLength(int) testBuffer.setLength(1000); - assertTrue("Failed to increase length", testBuffer.length() == 1000); + assertEquals("Failed to increase length", 1000, testBuffer.length()); assertTrue("Increase in length trashed buffer", testBuffer.toString() .startsWith("This is a test buffer")); testBuffer.setLength(2); - assertTrue("Failed to decrease length", testBuffer.length() == 2); + assertEquals("Failed to decrease length", 2, testBuffer.length()); assertEquals("Decrease in length failed", "Th", 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 15:18:06.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/lang/StringTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -186,8 +186,8 @@ public void test_compareToLjava_lang_Object() { // Test for method int java.lang.String.compareTo(java.lang.Object) String s = "VV"; - assertTrue("Comparison failed for same strings", s - .compareTo((Object) s) == 0); + assertEquals("Comparison failed for same strings", 0, s + .compareTo((Object) s)); try { s.compareTo(new Object()); } catch (ClassCastException e) { @@ -204,8 +204,8 @@ // Test for method int java.lang.String.compareTo(java.lang.String) assertTrue("Returned incorrect value for first < second", "aaaaab" .compareTo("aaaaac") < 0); - assertTrue("Returned incorrect value for first = second", "aaaaac" - .compareTo("aaaaac") == 0); + assertEquals("Returned incorrect value for first = second", 0, "aaaaac" + .compareTo("aaaaac")); assertTrue("Returned incorrect value for first > second", "aaaaac" .compareTo("aaaaab") > 0); assertTrue("Considered case to not be of importance", !("A" @@ -220,27 +220,27 @@ // java.lang.String.compareToIgnoreCase(java.lang.String) assertTrue("Returned incorrect value for first < second", "aaaaab" .compareToIgnoreCase("aaaaac") < 0); - assertTrue("Returned incorrect value for first = second", "aaaaac" - .compareToIgnoreCase("aaaaac") == 0); + assertEquals("Returned incorrect value for first = second", 0, "aaaaac" + .compareToIgnoreCase("aaaaac")); assertTrue("Returned incorrect value for first > second", "aaaaac" .compareToIgnoreCase("aaaaab") > 0); - assertTrue("Considered case to not be of importance", "A" - .compareToIgnoreCase("a") == 0); + assertEquals("Considered case to not be of importance", 0, "A" + .compareToIgnoreCase("a")); assertTrue("0xbf should not compare = to 'ss'", "\u00df" .compareToIgnoreCase("ss") != 0); - assertTrue("0x130 should compare = to 'i'", "\u0130" - .compareToIgnoreCase("i") == 0); - assertTrue("0x131 should compare = to 'i'", "\u0131" - .compareToIgnoreCase("i") == 0); + assertEquals("0x130 should compare = to 'i'", 0, "\u0130" + .compareToIgnoreCase("i")); + assertEquals("0x131 should compare = to 'i'", 0, "\u0131" + .compareToIgnoreCase("i")); Locale defLocale = Locale.getDefault(); try { Locale.setDefault(new Locale("tr", "")); - assertTrue("Locale tr: 0x130 should compare = to 'i'", "\u0130" - .compareToIgnoreCase("i") == 0); - assertTrue("Locale tr: 0x131 should compare = to 'i'", "\u0131" - .compareToIgnoreCase("i") == 0); + assertEquals("Locale tr: 0x130 should compare = to 'i'", 0, "\u0130" + .compareToIgnoreCase("i")); + assertEquals("Locale tr: 0x131 should compare = to 'i'", 0, "\u0131" + .compareToIgnoreCase("i")); } finally { Locale.setDefault(defLocale); } @@ -394,7 +394,7 @@ String result = null; try { result = new String(bytes, "8859_1"); - assertTrue("Wrong char length", result.length() == 1); + assertEquals("Wrong char length", 1, result.length()); assertTrue("Wrong char value", result.charAt(0) == (char) i); } catch (java.io.UnsupportedEncodingException e) { } @@ -508,7 +508,7 @@ */ public void test_indexOfI() { // Test for method int java.lang.String.indexOf(int) - assertTrue("Invalid index returned", 1 == hw1.indexOf('e')); + assertEquals("Invalid index returned", 1, hw1.indexOf('e')); } @@ -517,7 +517,7 @@ */ public void test_indexOfII() { // Test for method int java.lang.String.indexOf(int, int) - assertTrue("Invalid character index returned", 5 == hw1.indexOf('W', 2)); + assertEquals("Invalid character index returned", 5, hw1.indexOf('W', 2)); } @@ -537,10 +537,10 @@ // Test for method int java.lang.String.indexOf(java.lang.String, int) assertTrue("Failed to find string", hw1.indexOf("World", 0) > 0); assertTrue("Found string outside index", !(hw1.indexOf("Hello", 6) > 0)); - assertTrue("Did not accept valid negative starting position", hello1 - .indexOf("", -5) == 0); - assertTrue("Reported wrong error code", hello1.indexOf("", 5) == 5); - assertTrue("Wrong for empty in empty", "".indexOf("", 0) == 0); + assertEquals("Did not accept valid negative starting position", 0, hello1 + .indexOf("", -5)); + assertEquals("Reported wrong error code", 5, hello1.indexOf("", 5)); + assertEquals("Wrong for empty in empty", 0, "".indexOf("", 0)); } /** @@ -557,9 +557,9 @@ */ public void test_lastIndexOfI() { // Test for method int java.lang.String.lastIndexOf(int) - assertTrue("Failed to return correct index", hw1.lastIndexOf('W') == 5); - assertTrue("Returned index for non-existent char", - hw1.lastIndexOf('Z') == -1); + assertEquals("Failed to return correct index", 5, hw1.lastIndexOf('W')); + assertEquals("Returned index for non-existent char", + -1, hw1.lastIndexOf('Z')); } @@ -568,12 +568,12 @@ */ public void test_lastIndexOfII() { // Test for method int java.lang.String.lastIndexOf(int, int) - assertTrue("Failed to return correct index", - hw1.lastIndexOf('W', 6) == 5); - assertTrue("Returned index for char out of specified range", hw1 - .lastIndexOf('W', 4) == -1); - assertTrue("Returned index for non-existent char", hw1.lastIndexOf('Z', - 9) == -1); + assertEquals("Failed to return correct index", + 5, hw1.lastIndexOf('W', 6)); + assertEquals("Returned index for char out of specified range", -1, hw1 + .lastIndexOf('W', 4)); + assertEquals("Returned index for non-existent char", -1, hw1.lastIndexOf('Z', + 9)); } @@ -582,9 +582,9 @@ */ public void test_lastIndexOfLjava_lang_String() { // Test for method int java.lang.String.lastIndexOf(java.lang.String) - assertTrue("Returned incorrect index", hw1.lastIndexOf("World") == 5); - assertTrue("Found String outside of index", hw1 - .lastIndexOf("HeKKKKKKKK") == -1); + assertEquals("Returned incorrect index", 5, hw1.lastIndexOf("World")); + assertEquals("Found String outside of index", -1, hw1 + .lastIndexOf("HeKKKKKKKK")); } /** @@ -593,13 +593,13 @@ public void test_lastIndexOfLjava_lang_StringI() { // Test for method int java.lang.String.lastIndexOf(java.lang.String, // int) - assertTrue("Returned incorrect index", hw1.lastIndexOf("World", 9) == 5); + assertEquals("Returned incorrect index", 5, hw1.lastIndexOf("World", 9)); int result = hw1.lastIndexOf("Hello", 2); assertTrue("Found String outside of index: " + result, result == 0); - assertTrue("Reported wrong error code", - hello1.lastIndexOf("", -5) == -1); - assertTrue("Did not accept valid large starting position", hello1 - .lastIndexOf("", 5) == 5); + assertEquals("Reported wrong error code", + -1, hello1.lastIndexOf("", -5)); + assertEquals("Did not accept valid large starting position", 5, hello1 + .lastIndexOf("", 5)); } /** @@ -607,7 +607,7 @@ */ public void test_length() { // Test for method int java.lang.String.length() - assertTrue("Invalid length returned", comp11.length() == 11); + assertEquals("Invalid length returned", 11, comp11.length()); } /** 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 15:18:06.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/lang/SystemTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -238,8 +238,8 @@ // java.lang.System.identityHashCode(java.lang.Object) Object o = new Object(); String s = "Gabba"; - assertTrue("Nonzero returned for null", - System.identityHashCode(null) == 0); + assertEquals("Nonzero returned for null", + 0, System.identityHashCode(null)); assertTrue("Nonequal has returned for Object", System .identityHashCode(o) == o.hashCode()); assertTrue("Same as usual hash returned for String", System Index: modules/luni/src/test/java/tests/api/java/lang/ThreadGroupTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/lang/ThreadGroupTest.java.orig 2006-04-16 15:18:06.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/lang/ThreadGroupTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -195,8 +195,8 @@ for (int i = 0; i < subgroups.size(); i++) { ThreadGroup child = (ThreadGroup) subgroups.elementAt(i); - assertTrue("Destroyed child can't have children", child - .activeCount() == 0); + assertEquals("Destroyed child can't have children", 0, child + .activeCount()); boolean passed = false; try { child.destroy(); @@ -597,8 +597,8 @@ + " was not running when it was killed", isResumed[i]); } - assertTrue("Method destroy must have problems", - testRoot.activeCount() == 0); + assertEquals("Method destroy must have problems", + 0, testRoot.activeCount()); } @@ -674,7 +674,7 @@ parentMaxPrio = current.getParent().getMaxPriority(); ThreadGroup[] children = groups(current); - assertTrue("Can only have 1 subgroup", children.length == 1); + assertEquals("Can only have 1 subgroup", 1, children.length); current = children[0]; assertTrue( "Had to be 1 unit smaller than parent's priority in iteration=" @@ -795,8 +795,8 @@ assertTrue("Thread should be dead by now", passed); - assertTrue("Method destroy (or wipeAllThreads) must have problems", - testRoot.activeCount() == 0); + assertEquals("Method destroy (or wipeAllThreads) must have problems", + 0, testRoot.activeCount()); } @@ -848,8 +848,8 @@ } assertTrue("All threads should be suspended", passed); - assertTrue("Method destroy (or wipeAllThreads) must have problems", - testRoot.activeCount() == 0); + assertEquals("Method destroy (or wipeAllThreads) must have problems", + 0, testRoot.activeCount()); } 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 15:18:06.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/lang/ThreadTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -281,8 +281,8 @@ public void test_countStackFrames() { // Test for method int java.lang.Thread.countStackFrames() // SM. - assertTrue("Test failed.", - Thread.currentThread().countStackFrames() == 0); + assertEquals("Test failed.", + 0, Thread.currentThread().countStackFrames()); } /** Index: modules/luni/src/test/java/tests/api/java/lang/reflect/ArrayTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/lang/reflect/ArrayTest.java.orig 2006-04-16 15:17:59.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/lang/reflect/ArrayTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -34,8 +34,8 @@ } catch (Exception e) { fail("Exception during get test : " + e.getMessage()); } - assertTrue("Get returned incorrect value", - ((Integer) ret).intValue() == 1); + assertEquals("Get returned incorrect value", + 1, ((Integer) ret).intValue()); try { ret = Array.get(new Object(), 0); } catch (IllegalArgumentException e) { @@ -107,7 +107,7 @@ } catch (Exception e) { fail("Exception during get test : " + e.getMessage()); } - assertTrue("Get returned incorrect value", ret == 1); + assertEquals("Get returned incorrect value", 1, ret); try { ret = Array.getByte(new Object(), 0); } catch (IllegalArgumentException e) { @@ -143,7 +143,7 @@ } catch (Exception e) { fail("Exception during get test : " + e.getMessage()); } - assertTrue("Get returned incorrect value", ret == 1); + assertEquals("Get returned incorrect value", 1, ret); try { ret = Array.getChar(new Object(), 0); } catch (IllegalArgumentException e) { @@ -179,7 +179,7 @@ } catch (Exception e) { fail("Exception during get test : " + e.getMessage()); } - assertTrue("Get returned incorrect value", ret == 1); + assertEquals("Get returned incorrect value", 1, ret, 0.0); try { ret = Array.getDouble(new Object(), 0); } catch (IllegalArgumentException e) { @@ -216,7 +216,7 @@ } catch (Exception e) { fail("Exception during get test : " + e.getMessage()); } - assertTrue("Get returned incorrect value", ret == 1); + assertEquals("Get returned incorrect value", 1, ret, 0.0); try { ret = Array.getFloat(new Object(), 0); } catch (IllegalArgumentException e) { @@ -252,7 +252,7 @@ } catch (Exception e) { fail("Exception during get test : " + e.getMessage()); } - assertTrue("Get returned incorrect value", ret == 1); + assertEquals("Get returned incorrect value", 1, ret); try { ret = Array.getInt(new Object(), 0); } catch (IllegalArgumentException e) { @@ -282,9 +282,9 @@ // java.lang.reflect.Array.getLength(java.lang.Object) long[] x = { 1 }; - assertTrue("Returned incorrect length", Array.getLength(x) == 1); - assertTrue("Returned incorrect length", Array - .getLength(new Object[10000]) == 10000); + assertEquals("Returned incorrect length", 1, Array.getLength(x)); + assertEquals("Returned incorrect length", 10000, Array + .getLength(new Object[10000])); try { Array.getLength(new Object()); } catch (IllegalArgumentException e) { @@ -308,7 +308,7 @@ } catch (Exception e) { fail("Exception during get test : " + e.getMessage()); } - assertTrue("Get returned incorrect value", ret == 1); + assertEquals("Get returned incorrect value", 1, ret); try { ret = Array.getLong(new Object(), 0); } catch (IllegalArgumentException e) { @@ -344,7 +344,7 @@ } catch (Exception e) { fail("Exception during get test : " + e.getMessage()); } - assertTrue("Get returned incorrect value", ret == 1); + assertEquals("Get returned incorrect value", 1, ret); try { ret = Array.getShort(new Object(), 0); } catch (IllegalArgumentException e) { @@ -376,7 +376,7 @@ int[] y = { 2 }; x = (int[][]) Array.newInstance(int[].class, y); - assertTrue("Failed to instantiate array properly", x.length == 2); + assertEquals("Failed to instantiate array properly", 2, x.length); } @@ -389,7 +389,7 @@ int[] x; x = (int[]) Array.newInstance(int.class, 100); - assertTrue("Failed to instantiate array properly", x.length == 100); + assertEquals("Failed to instantiate array properly", 100, x.length); } /** @@ -406,8 +406,8 @@ } catch (Exception e) { fail("Exception during get test : " + e.getMessage()); } - assertTrue("Get returned incorrect value", ((Integer) Array.get(x, 0)) - .intValue() == 1); + assertEquals("Get returned incorrect value", 1, ((Integer) Array.get(x, 0)) + .intValue()); try { Array.set(new Object(), 0, new Object()); } catch (IllegalArgumentException e) { @@ -487,7 +487,7 @@ } catch (Exception e) { fail("Exception during get test : " + e.getMessage()); } - assertTrue("Get returned incorrect value", Array.getByte(x, 0) == 1); + assertEquals("Get returned incorrect value", 1, Array.getByte(x, 0)); try { Array.setByte(new Object(), 0, (byte) 9); } catch (IllegalArgumentException e) { @@ -522,7 +522,7 @@ } catch (Exception e) { fail("Exception during get test : " + e.getMessage()); } - assertTrue("Get returned incorrect value", Array.getChar(x, 0) == 1); + assertEquals("Get returned incorrect value", 1, Array.getChar(x, 0)); try { Array.setChar(new Object(), 0, (char) 9); } catch (IllegalArgumentException e) { @@ -557,7 +557,7 @@ } catch (Exception e) { fail("Exception during get test : " + e.getMessage()); } - assertTrue("Get returned incorrect value", Array.getDouble(x, 0) == 1); + assertEquals("Get returned incorrect value", 1, Array.getDouble(x, 0), 0.0); try { Array.setDouble(new Object(), 0, (double) 9); } catch (IllegalArgumentException e) { @@ -592,7 +592,7 @@ } catch (Exception e) { fail("Exception during get test : " + e.getMessage()); } - assertTrue("Get returned incorrect value", Array.getFloat(x, 0) == 1); + assertEquals("Get returned incorrect value", 1, Array.getFloat(x, 0), 0.0); try { Array.setFloat(new Object(), 0, (float) 9); } catch (IllegalArgumentException e) { @@ -627,7 +627,7 @@ } catch (Exception e) { fail("Exception during get test : " + e.getMessage()); } - assertTrue("Get returned incorrect value", Array.getInt(x, 0) == 1); + assertEquals("Get returned incorrect value", 1, Array.getInt(x, 0)); try { Array.setInt(new Object(), 0, (int) 9); } catch (IllegalArgumentException e) { @@ -662,7 +662,7 @@ } catch (Exception e) { fail("Exception during get test : " + e.getMessage()); } - assertTrue("Get returned incorrect value", Array.getLong(x, 0) == 1); + assertEquals("Get returned incorrect value", 1, Array.getLong(x, 0)); try { Array.setLong(new Object(), 0, (long) 9); } catch (IllegalArgumentException e) { @@ -697,7 +697,7 @@ } catch (Exception e) { fail("Exception during get test : " + e.getMessage()); } - assertTrue("Get returned incorrect value", Array.getShort(x, 0) == 1); + assertEquals("Get returned incorrect value", 1, Array.getShort(x, 0)); try { Array.setShort(new Object(), 0, (short) 9); } catch (IllegalArgumentException e) { Index: modules/luni/src/test/java/tests/api/java/lang/reflect/ConstructorTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/lang/reflect/ConstructorTest.java.orig 2006-04-16 15:17:59.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/lang/reflect/ConstructorTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -97,8 +97,8 @@ } catch (Exception e) { fail("Exception during test : " + e.getMessage()); } - assertTrue("Returned exception list of incorrect length", - exceptions.length == 1); + assertEquals("Returned exception list of incorrect length", + 1, exceptions.length); assertTrue("Returned incorrect exception", exceptions[0].equals(ex)); } @@ -177,7 +177,7 @@ fail("Exception during getParameterTypes test:" + e.toString()); } - assertTrue("Incorrect parameter returned", types.length == 0); + assertEquals("Incorrect parameter returned", 0, types.length); Class[] parms = null; try { @@ -208,7 +208,7 @@ } catch (Exception e) { fail("Failed to create instance : " + e.getMessage()); } - assertTrue("improper instance created", test.check() == 99); + assertEquals("improper instance created", 99, test.check()); } /** 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 15:18:06.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/lang/reflect/FieldTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -125,8 +125,8 @@ f = x.getClass().getDeclaredField("doubleSField"); f.set(x, new Double(1.0)); val = (Double) f.get(x); - assertTrue("Returned incorrect double field value", val - .doubleValue() == 1.0); + assertEquals("Returned incorrect double field value", 1.0, val + .doubleValue()); // Try a get on a private field try { @@ -818,7 +818,7 @@ } catch (Exception e) { fail("Exception during set test : " + e.getMessage()); } - assertTrue("Returned incorrect double field value", val == 1.0); + assertEquals("Returned incorrect double field value", 1.0, val); try { try { f = x.getClass().getDeclaredField("booleanField"); @@ -840,7 +840,7 @@ f = x.getClass().getDeclaredField("doubleSField"); f.set(x, new Double(1.0)); val = f.getDouble(x); - assertTrue("Returned incorrect double field value", val == 1.0); + assertEquals("Returned incorrect double field value", 1.0, val); } catch (Exception e) { fail("Exception during setDouble test: " + e.toString()); } @@ -904,7 +904,7 @@ } catch (Exception e) { fail("Exception during setByte test : " + e.getMessage()); } - assertTrue("Returned incorrect float field value", val == 1); + assertEquals("Returned incorrect float field value", 1, val); try { try { f = x.getClass().getDeclaredField("booleanField"); @@ -945,7 +945,7 @@ } catch (Exception e) { fail("Exception during setChar test : " + e.getMessage()); } - assertTrue("Returned incorrect float field value", val == 1); + assertEquals("Returned incorrect float field value", 1, val); try { try { f = x.getClass().getDeclaredField("booleanField"); @@ -986,7 +986,7 @@ } catch (Exception e) { fail("Exception during setDouble test: " + e.toString()); } - assertTrue("Returned incorrect double field value", val == 1.0); + assertEquals("Returned incorrect double field value", 1.0, val); try { try { f = x.getClass().getDeclaredField("booleanField"); @@ -1027,7 +1027,7 @@ } catch (Exception e) { fail("Exception during setFloat test : " + e.getMessage()); } - assertTrue("Returned incorrect float field value", val == 1); + assertEquals("Returned incorrect float field value", 1, val); try { try { f = x.getClass().getDeclaredField("booleanField"); @@ -1067,7 +1067,7 @@ } catch (Exception e) { fail("Exception during setInteger test: " + e.toString()); } - assertTrue("Returned incorrect int field value", val == 1); + assertEquals("Returned incorrect int field value", 1, val); try { try { f = x.getClass().getDeclaredField("booleanField"); @@ -1107,7 +1107,7 @@ } catch (Exception e) { fail("Exception during setLong test : " + e.getMessage()); } - assertTrue("Returned incorrect long field value", val == 1); + assertEquals("Returned incorrect long field value", 1, val); try { try { f = x.getClass().getDeclaredField("booleanField"); @@ -1147,7 +1147,7 @@ } catch (Exception e) { fail("Exception during setShort test : " + e.getMessage()); } - assertTrue("Returned incorrect short field value", val == 1); + assertEquals("Returned incorrect short field value", 1, val); try { try { f = x.getClass().getDeclaredField("booleanField"); 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 15:18:06.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/lang/reflect/MethodTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -188,14 +188,14 @@ try { Method mth = TestMethod.class.getMethod("voidMethod", new Class[0]); Class[] ex = mth.getExceptionTypes(); - assertTrue("Returned incorrect number of exceptions", - ex.length == 1); + assertEquals("Returned incorrect number of exceptions", + 1, ex.length); assertTrue("Returned incorrect exception type", ex[0] .equals(IllegalArgumentException.class)); mth = TestMethod.class.getMethod("intMethod", new Class[0]); ex = mth.getExceptionTypes(); - assertTrue("Returned incorrect number of exceptions", - ex.length == 0); + assertEquals("Returned incorrect number of exceptions", + 0, ex.length); } catch (Exception e) { fail("Exception during getExceptionTypes: " + e.toString()); } @@ -291,7 +291,7 @@ fail("Exception during getParameterTypes test: " + e.toString()); } - assertTrue("Returned incorrect parameterTypes", parms.length == 0); + assertEquals("Returned incorrect parameterTypes", 0, parms.length); try { mth = cl.getMethod("parmTest", plist); parms = mth.getParameterTypes(); @@ -425,8 +425,8 @@ } catch (Exception e) { fail("Exception during invoke test : " + e.getMessage()); } - assertTrue("Invoke returned incorrect value", ((Integer) ret) - .intValue() == 1); + assertEquals("Invoke returned incorrect value", 1, ((Integer) ret) + .intValue()); // Get and invoke an instance method try { @@ -440,8 +440,8 @@ } catch (Exception e) { fail("Exception during invoke test : " + e.getMessage()); } - assertTrue("Invoke returned incorrect value", ((Integer) ret) - .intValue() == 1); + assertEquals("Invoke returned incorrect value", 1, ((Integer) ret) + .intValue()); // Get and attempt to invoke a private method try { 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 15:18:06.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/net/DatagramPacketTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -41,7 +41,7 @@ dp = new DatagramPacket("Hello".getBytes(), 5); assertEquals("Created incorrect packet", "Hello", new String(dp.getData(), 0, dp.getData().length)); - assertTrue("Wrong length", dp.getLength() == 5); + assertEquals("Wrong length", 5, dp.getLength()); } catch (Exception e) { fail("Exception during Constructor test: " + e.toString()); } @@ -55,8 +55,8 @@ dp = new DatagramPacket("Hello".getBytes(), 2, 3); 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); + assertEquals("Wrong length", 3, dp.getLength()); + assertEquals("Wrong offset", 2, dp.getOffset()); } catch (Exception e) { fail("Exception during Constructor test: " + e.toString()); } @@ -73,8 +73,8 @@ assertTrue("Created incorrect packet", dp.getAddress().equals( InetAddress.getLocalHost()) && dp.getPort() == 0); - assertTrue("Wrong length", dp.getLength() == 3); - assertTrue("Wrong offset", dp.getOffset() == 2); + assertEquals("Wrong length", 3, dp.getLength()); + assertEquals("Wrong offset", 2, dp.getOffset()); } catch (Exception e) { fail("Exception during Constructor test: " + e.toString()); } @@ -93,7 +93,7 @@ assertTrue("Created incorrect packet", dp.getAddress().equals( InetAddress.getLocalHost()) && dp.getPort() == 0); - assertTrue("Wrong length", dp.getLength() == 5); + assertEquals("Wrong length", 5, dp.getLength()); } catch (Exception e) { fail("Exception during Constructor test: " + e.toString()); } @@ -133,7 +133,7 @@ // Test for method int java.net.DatagramPacket.getLength() dp = new DatagramPacket("Hello".getBytes(), 5); - assertTrue("Incorrect length returned", dp.getLength() == 5); + assertEquals("Incorrect length returned", 5, dp.getLength()); } /** @@ -141,7 +141,7 @@ */ public void test_getOffset() { dp = new DatagramPacket("Hello".getBytes(), 3, 2); - assertTrue("Incorrect length returned", dp.getOffset() == 3); + assertEquals("Incorrect length returned", 3, dp.getOffset()); } /** @@ -152,7 +152,7 @@ try { dp = new DatagramPacket("Hello".getBytes(), 5, InetAddress .getLocalHost(), 1000); - assertTrue("Incorrect port returned", dp.getPort() == 1000); + assertEquals("Incorrect port returned", 1000, dp.getPort()); } catch (Exception e) { fail("Exception during getPort test : " + e.getMessage()); } @@ -265,7 +265,7 @@ // Test for method void java.net.DatagramPacket.setLength(int) dp = new DatagramPacket("Hello".getBytes(), 5); dp.setLength(1); - assertTrue("Failed to set packet length", dp.getLength() == 1); + assertEquals("Failed to set packet length", 1, dp.getLength()); } /** @@ -277,7 +277,7 @@ dp = new DatagramPacket("Hello".getBytes(), 5, InetAddress .getLocalHost(), 1000); dp.setPort(2000); - assertTrue("Port not set", dp.getPort() == 2000); + assertEquals("Port not set", 2000, dp.getPort()); } catch (Exception e) { fail("Exception during setPort test : " + e.getMessage()); } @@ -366,7 +366,7 @@ assertTrue("Socket address not set correctly (2)", theAddress .equals(new InetSocketAddress(thePacket.getAddress(), thePacket.getPort()))); - assertTrue("Offset not set correctly", thePacket.getOffset() == 1); + assertEquals("Offset not set correctly", 1, thePacket.getOffset()); } catch (Exception e) { fail("Exception during constructor test(2):" + e.toString()); } Index: modules/luni/src/test/java/tests/api/java/net/DatagramSocketTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/net/DatagramSocketTest.java.orig 2006-04-16 15:18:06.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/net/DatagramSocketTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -558,7 +558,7 @@ ds.connect(inetAddress, portNumber); ds.disconnect(); assertNull("Incorrect InetAddress", ds.getInetAddress()); - assertTrue("Incorrect Port", ds.getPort() == -1); + assertEquals("Incorrect Port", -1, ds.getPort()); } catch (Exception e) { fail("Exception during test : " + e.getMessage()); } @@ -575,7 +575,7 @@ ds.connect(inetAddress, portNumber); ds.disconnect(); assertNull("Incorrect InetAddress", ds.getInetAddress()); - assertTrue("Incorrect Port", ds.getPort() == -1); + assertEquals("Incorrect Port", -1, ds.getPort()); } catch (Exception e) { fail("Exception during test : " + e.getMessage()); } @@ -658,8 +658,8 @@ try { int portNumber = Support_PortManager.getNextPort(); DatagramSocket theSocket = new DatagramSocket(portNumber); - assertTrue("Expected -1 for remote port as not connected", - theSocket.getPort() == -1); + assertEquals("Expected -1 for remote port as not connected", + -1, theSocket.getPort()); // now connect the socket and validate that we get the right port theSocket.connect(InetAddress.getLocalHost(), portNumber); @@ -711,7 +711,7 @@ int portNumber = Support_PortManager.getNextPort(); ds = new java.net.DatagramSocket(portNumber); ds.setSoTimeout(100); - assertTrue("Returned incorrect timeout", ds.getSoTimeout() == 100); + assertEquals("Returned incorrect timeout", 100, ds.getSoTimeout()); ensureExceptionThrownIfOptionIsUnsupportedOnOS(SO_TIMEOUT); } catch (Exception e) { handleException(e, SO_TIMEOUT); Index: modules/luni/src/test/java/tests/api/java/net/HttpURLConnectionTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/net/HttpURLConnectionTest.java.orig 2006-04-16 15:17:59.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/net/HttpURLConnectionTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -40,7 +40,7 @@ */ public void test_getResponseCode() { try { - assertTrue("Wrong response", uc.getResponseCode() == 200); + assertEquals("Wrong response", 200, uc.getResponseCode()); } catch (IOException e) { fail("Unexpected exception : " + e.getMessage()); } 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 15:18:06.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/net/JarURLConnectionTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -112,14 +112,14 @@ } catch (IOException e) { exception = 1; } - assertTrue("Did not throw exception on connect", exception == 1); + assertEquals("Did not throw exception on connect", 1, exception); exception = 0; try { connection.getJarFile(); } catch (IOException e) { exception = 1; } - assertTrue("Did not throw exception after connect", exception == 1); + assertEquals("Did not throw exception after connect", 1, exception); File resources = Support_Resources.createTempFolder(); try { Support_Resources.copyFile(resources, null, "hyts_att.jar"); Index: modules/luni/src/test/java/tests/api/java/net/ServerSocketTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/net/ServerSocketTest.java.orig 2006-04-16 15:18:06.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/net/ServerSocketTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -292,7 +292,7 @@ int portNumber = Support_PortManager.getNextPort(); s = new ServerSocket(portNumber); s.setSoTimeout(100); - assertTrue("Returned incorrect sotimeout", s.getSoTimeout() == 100); + assertEquals("Returned incorrect sotimeout", 100, s.getSoTimeout()); } catch (Exception e) { fail("Exception during getSoTimeout test : " + e.getMessage()); } @@ -321,7 +321,7 @@ s.accept(); } catch (java.io.InterruptedIOException e) { try { - assertTrue("Set incorrect sotimeout", s.getSoTimeout() == 100); + assertEquals("Set incorrect sotimeout", 100, s.getSoTimeout()); return; } catch (Exception x) { fail("Exception during setSOTimeout: " + e.toString()); Index: modules/luni/src/test/java/tests/api/java/net/SocketTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/net/SocketTest.java.orig 2006-04-16 15:18:06.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/net/SocketTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -589,7 +589,7 @@ int portNumber = Support_PortManager.getNextPort(); s = new Socket(InetAddress.getLocalHost(), sport, null, portNumber); s.setSoLinger(true, 200); - assertTrue("Returned incorrect linger", s.getSoLinger() == 200); + assertEquals("Returned incorrect linger", 200, s.getSoLinger()); ensureExceptionThrownIfOptionIsUnsupportedOnOS(SO_LINGER); s.setSoLinger(false, 0); } catch (Exception e) { @@ -640,7 +640,7 @@ int sport = startServer("SServer getSoTimeout"); s = new Socket(InetAddress.getLocalHost(), sport); s.setSoTimeout(100); - assertTrue("Returned incorrect sotimeout", s.getSoTimeout() == 100); + assertEquals("Returned incorrect sotimeout", 100, s.getSoTimeout()); ensureExceptionThrownIfOptionIsUnsupportedOnOS(SO_TIMEOUT); } catch (Exception e) { handleException(e, SO_TIMEOUT); @@ -738,7 +738,7 @@ int portNumber = Support_PortManager.getNextPort(); s = new Socket(InetAddress.getLocalHost(), sport, null, portNumber); s.setSoLinger(true, 500); - assertTrue("Set incorrect linger", s.getSoLinger() == 500); + assertEquals("Set incorrect linger", 500, s.getSoLinger()); ensureExceptionThrownIfOptionIsUnsupportedOnOS(SO_LINGER); s.setSoLinger(false, 0); } catch (Exception e) { @@ -756,7 +756,7 @@ int portNumber = Support_PortManager.getNextPort(); s = new Socket(InetAddress.getLocalHost(), sport, null, portNumber); s.setSoTimeout(100); - assertTrue("Set incorrect sotimeout", s.getSoTimeout() == 100); + assertEquals("Set incorrect sotimeout", 100, s.getSoTimeout()); ensureExceptionThrownIfOptionIsUnsupportedOnOS(SO_TIMEOUT); } catch (Exception e) { handleException(e, SO_TIMEOUT); @@ -1806,12 +1806,12 @@ connector.start(); theSocket.setSoTimeout(100); Thread.sleep(10); - assertTrue("Socket option not set during connect: 10 ", theSocket - .getSoTimeout() == 100); + assertEquals("Socket option not set during connect: 10 ", 100, theSocket + .getSoTimeout()); Thread.sleep(50); theSocket.setSoTimeout(200); - assertTrue("Socket option not set during connect: 50 ", theSocket - .getSoTimeout() == 200); + assertEquals("Socket option not set during connect: 50 ", 200, theSocket + .getSoTimeout()); Thread.sleep(5000); theSocket.close(); } catch (Exception e) { 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 15:18:06.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/net/URITest.java 2006-04-16 15:18:06.000000000 +0100 @@ -256,7 +256,7 @@ assertNull("wrong userinfo", uri.getUserInfo()); assertNull("wrong hostname", uri.getHost()); assertNull("wrong authority", uri.getAuthority()); - assertTrue("wrong port number", uri.getPort() == -1); + assertEquals("wrong port number", -1, uri.getPort()); assertNull("wrong path", uri.getPath()); assertNull("wrong query", uri.getQuery()); assertNull("wrong fragment", uri.getFragment()); @@ -352,7 +352,7 @@ "qu?er#y", "frag#me?nt"); assertEquals("wrong userinfo", "us:e@r", uri.getUserInfo()); assertEquals("wrong hostname", "hostname", uri.getHost()); - assertTrue("wrong port number", uri.getPort() == 85); + assertEquals("wrong port number", 85, uri.getPort()); assertEquals("wrong path", "/file/dir#/qu?e/", uri.getPath()); assertEquals("wrong query", "qu?er#y", uri.getQuery()); assertEquals("wrong fragment", "frag#me?nt", uri.getFragment()); @@ -451,7 +451,7 @@ assertNull("wrong authority", uri.getUserInfo()); assertNull("wrong userinfo", uri.getUserInfo()); assertNull("wrong hostname", uri.getHost()); - assertTrue("wrong port number", uri.getPort() == -1); + assertEquals("wrong port number", -1, uri.getPort()); assertEquals("wrong path", "/p#a%E2%82%ACth", uri.getPath()); assertEquals("wrong query", "q^u%25ery", uri.getQuery()); assertEquals("wrong fragment", "f/r\u00DFag", uri.getFragment()); 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 15:18:06.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/net/URLConnectionTest.java 2006-04-16 15:23:14.000000000 +0100 @@ -270,7 +270,7 @@ assertEquals("yo2", uc.getRequestProperty("prop")); Map map = uc.getRequestProperties(); List props = (List) uc.getRequestProperties().get("prop"); - assertTrue(props.size() == 1); + assertEquals(1, props.size()); try { // the map should be unmodifiable @@ -293,7 +293,7 @@ JarURLConnection con1 = (JarURLConnection) fUrl1.openConnection(); map = con1.getRequestProperties(); assertNotNull(map); - assertTrue(map.size() == 0); + assertEquals(0, map.size()); try { // the map should be unmodifiable map.put("hi", "bye"); @@ -337,7 +337,7 @@ JarURLConnection con1 = (JarURLConnection) fUrl1.openConnection(); headers = con1.getHeaderFields(); assertNotNull(headers); - assertTrue(headers.size() == 0); + assertEquals(0, headers.size()); try { // the map should be unmodifiable headers.put("hi", "bye"); @@ -494,8 +494,8 @@ */ public void test_getIfModifiedSince() { uc.setIfModifiedSince(200); - assertTrue("Returned wrong ifModifiedSince value", uc - .getIfModifiedSince() == 200); + assertEquals("Returned wrong ifModifiedSince value", 200, uc + .getIfModifiedSince()); } /** 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 15:18:06.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/net/URLTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -95,7 +95,7 @@ "http", u.getProtocol()); assertEquals("u returns a wrong host", "www.yahoo1.com", u.getHost()); - assertTrue("u returns a wrong port", u.getPort() == 8080); + assertEquals("u returns a wrong port", 8080, u.getPort()); assertEquals("u returns a wrong file", "/dir1/dir2/test.cgi?point1.html", u.getFile()); assertEquals("u returns a wrong anchor", "anchor1", u.getRef()); @@ -106,7 +106,7 @@ "http", u1.getProtocol()); assertEquals("u1 returns a wrong host", "www.yahoo2.com", u1.getHost()); - assertTrue("u1 returns a wrong port", u1.getPort() == 9999); + assertEquals("u1 returns a wrong port", 9999, u1.getPort()); assertTrue("u1 returns a wrong file", u1.getFile().equals("")); assertNull("u1 returns a wrong anchor", u1.getRef()); @@ -117,7 +117,7 @@ "http", u2.getProtocol()); assertEquals("u2 returns a wrong host", "www.yahoo3.com", u2.getHost()); - assertTrue("u2 returns a wrong port", u2.getPort() == -1); + assertEquals("u2 returns a wrong port", -1, u2.getPort()); assertEquals("u2 returns a wrong file", "/dir1/dir2/test.cgi?point1.html", u2.getFile()); assertEquals("u2 returns a wrong anchor", @@ -130,7 +130,7 @@ ); assertEquals("u2a returns a wrong host", "www.yahoo3.com", u2a.getHost()); - assertTrue("u2a returns a wrong port", u2a.getPort() == -1); + assertEquals("u2a returns a wrong port", -1, u2a.getPort()); assertEquals("u2a returns a wrong file", "/dir1/dir2/test.cgi", u2a.getFile()); assertEquals("u2a returns a wrong anchor", @@ -142,7 +142,7 @@ "http", u3.getProtocol()); assertEquals("u3 returns a wrong host", "www.yahoo4.com", u3.getHost()); - assertTrue("u3 returns a wrong port", u3.getPort() == -1); + assertEquals("u3 returns a wrong port", -1, u3.getPort()); assertEquals("u3 returns a wrong file", "/", u3.getFile()); assertNull("u3 returns a wrong anchor", u3.getRef()); @@ -152,7 +152,7 @@ ); assertEquals("u3a returns a wrong host", "www.yahoo4.com", u3a.getHost()); - assertTrue("u3a returns a wrong port", u3a.getPort() == -1); + assertEquals("u3a returns a wrong port", -1, u3a.getPort()); assertEquals("u3a returns a wrong file", "/", u3a.getFile()); assertNull("u3a returns a wrong anchor", u3a.getRef()); @@ -162,7 +162,7 @@ ); assertEquals("u3b returns a wrong host", "www.yahoo4.com", u3b.getHost()); - assertTrue("u3b returns a wrong port", u3b.getPort() == -1); + assertEquals("u3b returns a wrong port", -1, u3b.getPort()); assertTrue("u3b returns a wrong file", u3b.getFile().equals("")); assertNull("u3b returns a wrong anchor", u3b.getRef()); @@ -173,7 +173,7 @@ "http", u4.getProtocol()); assertEquals("u4 returns a wrong host", "www.yahoo5.com", u4.getHost()); - assertTrue("u4 returns a wrong port", u4.getPort() == -1); + assertEquals("u4 returns a wrong port", -1, u4.getPort()); assertEquals("u4 returns a wrong file", "/di!@$%^&*()_+r1/di:::r2/test.cgi?point1.html", u4.getFile()); assertEquals("u4 returns a wrong anchor", @@ -183,7 +183,7 @@ 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); + assertEquals("u5 returns a wrong port", -1, u5.getPort()); assertEquals("u5 returns a wrong file", "/testing.tst", u5.getFile()); assertNull("u5 returns a wrong anchor", u5.getRef()); @@ -192,13 +192,13 @@ 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); + assertEquals("u5a returns a wrong port", -1, u5a.getPort()); assertEquals("u5a returns a wrong file", "testing.tst", u5a.getFile()); assertNull("u5a returns a wrong anchor", u5a.getRef()); URL u6 = new URL("http://host:/file"); - assertTrue("u6 return a wrong port", u6.getPort() == -1); + assertEquals("u6 return a wrong port", -1, u6.getPort()); URL u7 = new URL("file:../../file.txt"); assertTrue("u7 returns a wrong file: " + u7.getFile(), u7.getFile() @@ -330,7 +330,7 @@ "http", u1.getProtocol()); assertEquals("1 returns a wrong host", "www.yahoo.com", u1.getHost()); - assertTrue("1 returns a wrong port", u1.getPort() == -1); + assertEquals("1 returns a wrong port", -1, u1.getPort()); assertEquals("1 returns a wrong file", "/file.java", u1.getFile()); assertNull("1 returns a wrong anchor", u1.getRef()); @@ -340,7 +340,7 @@ "file", u1f.getProtocol()); assertEquals("1f returns a wrong host", "www.yahoo.com", u1f.getHost()); - assertTrue("1f returns a wrong port", u1f.getPort() == -1); + assertEquals("1f returns a wrong port", -1, u1f.getPort()); assertEquals("1f returns a wrong file", "/file.java", u1f.getFile()); assertNull("1f returns a wrong anchor", u1f.getRef()); @@ -350,7 +350,7 @@ "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); + assertEquals("3 returns a wrong port", -1, u1.getPort()); assertEquals("3 returns a wrong file", "/dir1/dir2/../file.java", u1.getFile()); assertNull("3 returns a wrong anchor", u1.getRef()); @@ -360,7 +360,7 @@ "http", u1.getProtocol()); assertTrue("3a returns a wrong host: " + u1.getHost(), u1.getHost() .equals("")); - assertTrue("3a returns a wrong port", u1.getPort() == -1); + assertEquals("3a returns a wrong port", -1, u1.getPort()); assertEquals("3a returns a wrong file", "dir1/dir2/../file.java", u1.getFile()); assertNull("3a returns a wrong anchor", u1.getRef()); @@ -371,7 +371,7 @@ "http", u1.getProtocol()); assertEquals("4 returns a wrong host", "www.apache.org", u1.getHost()); - assertTrue("4 returns a wrong port", u1.getPort() == -1); + assertEquals("4 returns a wrong port", -1, u1.getPort()); assertEquals("4 returns a wrong file", "/testing/file.java", u1.getFile()); assertNull("4 returns a wrong anchor", u1.getRef()); @@ -382,7 +382,7 @@ "file", u1f.getProtocol()); assertEquals("4f returns a wrong host", "www.apache.org", u1f.getHost()); - assertTrue("4f returns a wrong port", u1f.getPort() == -1); + assertEquals("4f returns a wrong port", -1, u1f.getPort()); assertEquals("4f returns a wrong file", "/testing/file.java", u1f.getFile()); assertNull("4f returns a wrong anchor", u1f.getRef()); @@ -392,7 +392,7 @@ 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); + assertEquals("4fa returns a wrong port", -1, u1f.getPort()); assertEquals("4fa returns a wrong file", "/testing/file.java", u1f.getFile()); assertNull("4fa returns a wrong anchor", u1f.getRef()); @@ -402,7 +402,7 @@ 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); + assertEquals("4fb returns a wrong port", -1, u1f.getPort()); assertEquals("4fb returns a wrong file", "testing/file.java", u1f.getFile()); assertNull("4fb returns a wrong anchor", u1f.getRef()); @@ -411,7 +411,7 @@ 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); + assertEquals("4fc returns a wrong port", -1, u1f.getPort()); assertEquals("4fc returns a wrong file", "file.java", u1f.getFile()); assertNull("4fc returns a wrong anchor", u1f.getRef()); @@ -420,7 +420,7 @@ assertEquals("4fd returns a wrong protocol", "file", u1f.getProtocol() ); assertTrue("4fd returns a wrong host", u1f.getHost().equals("")); - assertTrue("4fd returns a wrong port", u1f.getPort() == -1); + assertEquals("4fd returns a wrong port", -1, u1f.getPort()); assertTrue("4fd returns a wrong file", u1f.getFile().equals("")); assertNull("4fd returns a wrong anchor", u1f.getRef()); @@ -430,7 +430,7 @@ "http", u1.getProtocol()); assertEquals("5 returns a wrong host", "www.apache.org", u1.getHost()); - assertTrue("5 returns a wrong port", u1.getPort() == -1); + assertEquals("5 returns a wrong port", -1, u1.getPort()); assertEquals("5 returns a wrong file", "/file.java", u1.getFile()); assertNull("5 returns a wrong anchor", u1.getRef()); @@ -441,7 +441,7 @@ "file", u1f.getProtocol()); assertEquals("5f returns a wrong host", "www.apache.org", u1f.getHost()); - assertTrue("5f returns a wrong port", u1f.getPort() == -1); + assertEquals("5f returns a wrong port", -1, u1f.getPort()); assertEquals("5f returns a wrong file", "/file.java", u1f.getFile()); assertNull("5f returns a wrong anchor", u1f.getRef()); @@ -451,7 +451,7 @@ 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); + assertEquals("5fa returns a wrong port", -1, u1f.getPort()); assertEquals("5fa returns a wrong file", "/file.java", u1f.getFile()); assertNull("5fa returns a wrong anchor", u1f.getRef()); @@ -461,7 +461,7 @@ 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); + assertEquals("5fb returns a wrong port", -1, u1f.getPort()); assertEquals("5fb returns a wrong file", "file.java", u1f.getFile()); assertNull("5fb returns a wrong anchor", u1f.getRef()); @@ -472,7 +472,7 @@ "http", u1.getProtocol()); assertEquals("6 returns a wrong host", "www.apache.org", u1.getHost()); - assertTrue("6 returns a wrong port", u1.getPort() == -1); + assertEquals("6 returns a wrong port", -1, u1.getPort()); assertEquals("6 returns a wrong file", "/file.java", u1.getFile()); assertNull("6 returns a wrong anchor", u1.getRef()); @@ -483,7 +483,7 @@ "file", u1f.getProtocol()); assertEquals("6f returns a wrong host", "www.apache.org", u1f.getHost()); - assertTrue("6f returns a wrong port", u1f.getPort() == -1); + assertEquals("6f returns a wrong port", -1, u1f.getPort()); assertEquals("6f returns a wrong file", "/file.java", u1f.getFile()); assertNull("6f returns a wrong anchor", u1f.getRef()); @@ -494,7 +494,7 @@ "http", u1.getProtocol()); assertEquals("7 returns a wrong host", "www.apache.org", u1.getHost()); - assertTrue("7 returns a wrong port", u1.getPort() == 8000); + assertEquals("7 returns a wrong port", 8000, u1.getPort()); assertEquals("7 returns a wrong file", "/file.java", u1.getFile()); assertNull("7 returns a wrong anchor", u1.getRef()); @@ -582,7 +582,7 @@ "http", u1.getProtocol()); assertEquals("1 returns a wrong host", "www.yahoo.com", u1.getHost()); - assertTrue("1 returns a wrong port", u1.getPort() == -1); + assertEquals("1 returns a wrong port", -1, u1.getPort()); assertEquals("1 returns a wrong file", "/file.java", u1.getFile()); assertNull("1 returns a wrong anchor", u1.getRef()); @@ -592,7 +592,7 @@ 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); + assertEquals("2 returns a wrong port", -1, u1.getPort()); assertEquals("2 returns a wrong file", "/+/FILE0/test.java", u1.getFile()); assertNull("2 returns a wrong anchor", u1.getRef()); @@ -602,7 +602,7 @@ "http", u1.getProtocol()); assertEquals("3 returns a wrong host", "www.yahoo.com", u1.getHost()); - assertTrue("3 returns a wrong port", u1.getPort() == -1); + assertEquals("3 returns a wrong port", -1, u1.getPort()); assertEquals("3 returns a wrong file", "/dir1/dir2/../file.java", u1.getFile()); assertNull("3 returns a wrong anchor", u1.getRef()); @@ -663,7 +663,7 @@ "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); + assertEquals("SSS returns a wrong port", -1, u.getPort()); assertEquals("SSS returns a wrong file", "test.html", u.getFile()); assertTrue("SSS returns a wrong anchor: " + u.getRef(), u.getRef() @@ -686,7 +686,7 @@ "http", u.getProtocol()); assertEquals("SSIS returns a wrong host", "www.yahoo.com", u.getHost()); - assertTrue("SSIS returns a wrong port", u.getPort() == 8080); + assertEquals("SSIS returns a wrong port", 8080, u.getPort()); assertEquals("SSIS returns a wrong file", "test.html", u.getFile()); assertTrue("SSIS returns a wrong anchor: " + u.getRef(), u.getRef() @@ -710,7 +710,7 @@ ); assertEquals("SSISH1 returns a wrong host", "www.yahoo.com", u.getHost()); - assertTrue("SSISH1 returns a wrong port", u.getPort() == 8080); + assertEquals("SSISH1 returns a wrong port", 8080, u.getPort()); assertEquals("SSISH1 returns a wrong file", "test.html", u.getFile()); assertTrue("SSISH1 returns a wrong anchor: " + u.getRef(), u @@ -726,7 +726,7 @@ ); assertEquals("SSISH2 returns a wrong host", "www.yahoo.com", u.getHost()); - assertTrue("SSISH2 returns a wrong port", u.getPort() == 8080); + assertEquals("SSISH2 returns a wrong port", 8080, u.getPort()); assertEquals("SSISH2 returns a wrong file", "test.html", u.getFile()); assertTrue("SSISH2 returns a wrong anchor: " + u.getRef(), u @@ -850,7 +850,7 @@ + "/nettest.txt"); InputStream in = u.openStream(); byte[] buf = new byte[3]; - assertTrue("Incompete read 2", in.read(buf) == 3); + assertEquals("Incompete read 2", 3, in.read(buf)); in.close(); assertTrue("Returned incorrect data 2", buf[0] == 0x54 && buf[1] == 0x68 && buf[2] == 0x69); @@ -869,7 +869,7 @@ int result = in.read(buf); in.close(); test.delete(); - assertTrue("Incompete read 3", result == 3); + assertEquals("Incompete read 3", 3, result); assertTrue("Returned incorrect data 3", buf[0] == 0x55 && buf[1] == (byte) 0xaa && buf[2] == 0x14); } catch (java.io.IOException e) { @@ -977,7 +977,7 @@ assertTrue("return wrong port number " + u.getPort(), u.getPort() == 9999); u = new URL("http://member12.c++.com:9999/"); - assertTrue("return wrong port number", u.getPort() == 9999); + assertEquals("return wrong port number", 9999, u.getPort()); } catch (Exception e) { fail("Threw exception : " + e.getMessage()); } 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 15:18:06.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/util/ArrayListTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -53,7 +53,7 @@ public void test_ConstructorI() { // Test for method java.util.ArrayList(int) ArrayList al = new ArrayList(5); - assertTrue("Incorrect arrayList created", al.size() == 0); + assertEquals("Incorrect arrayList created", 0, al.size()); } /** @@ -108,8 +108,8 @@ // Test for method boolean java.util.ArrayList.addAll(int, // java.util.Collection) alist.addAll(50, alist); - assertTrue("Returned incorrect size after adding to existing list", - alist.size() == 200); + assertEquals("Returned incorrect size after adding to existing list", + 200, alist.size()); for (int i = 0; i < 50; i++) assertTrue("Manipulated elements < index", alist.get(i) == objArray[i]); @@ -150,8 +150,8 @@ assertTrue("Failed to add elements properly", l.get(i).equals( alist.get(i))); alist.addAll(alist); - assertTrue("Returned incorrect size after adding to existing list", - alist.size() == 200); + assertEquals("Returned incorrect size after adding to existing list", + 200, alist.size()); for (int i = 0; i < 100; i++) { assertTrue("Added to list in incorrect order", alist.get(i) .equals(l.get(i))); @@ -181,13 +181,13 @@ public void test_clear() { // Test for method void java.util.ArrayList.clear() alist.clear(); - assertTrue("List did not clear", alist.size() == 0); + assertEquals("List did not clear", 0, alist.size()); alist.add(null); alist.add(null); alist.add(null); alist.add("bam"); alist.clear(); - assertTrue("List with nulls did not clear", alist.size() == 0); + assertEquals("List with nulls did not clear", 0, alist.size()); /* * for (int i = 0; i < alist.size(); i++) assertNull("Failed to clear * list", alist.get(i)); @@ -289,10 +289,10 @@ */ public void test_indexOfLjava_lang_Object() { // Test for method int java.util.ArrayList.indexOf(java.lang.Object) - assertTrue("Returned incorrect index", - alist.indexOf(objArray[87]) == 87); - assertTrue("Returned index for invalid Object", alist - .indexOf(new Object()) == -1); + assertEquals("Returned incorrect index", + 87, alist.indexOf(objArray[87])); + assertEquals("Returned index for invalid Object", -1, alist + .indexOf(new Object())); alist.add(25, null); alist.add(50, null); assertTrue("Wrong indexOf for null. Wanted 25 got: " @@ -316,10 +316,10 @@ public void test_lastIndexOfLjava_lang_Object() { // Test for method int java.util.ArrayList.lastIndexOf(java.lang.Object) alist.add(new Integer(99)); - assertTrue("Returned incorrect index", - alist.lastIndexOf(objArray[99]) == 100); - assertTrue("Returned index for invalid Object", alist - .lastIndexOf(new Object()) == -1); + assertEquals("Returned incorrect index", + 100, alist.lastIndexOf(objArray[99])); + assertEquals("Returned index for invalid Object", -1, alist + .lastIndexOf(new Object())); alist.add(25, null); alist.add(50, null); assertTrue("Wrong lastIndexOf for null. Wanted 50 got: " @@ -332,8 +332,8 @@ public void test_removeI() { // Test for method java.lang.Object java.util.ArrayList.remove(int) alist.remove(10); - assertTrue("Failed to remove element", - alist.indexOf(objArray[10]) == -1); + assertEquals("Failed to remove element", + -1, alist.indexOf(objArray[10])); boolean exception = false; try { alist.remove(999); @@ -397,10 +397,10 @@ */ public void test_size() { // Test for method int java.util.ArrayList.size() - assertTrue("Returned incorrect size for exiting list", - alist.size() == 100); - assertTrue("Returned incorrect size for new list", new ArrayList() - .size() == 0); + assertEquals("Returned incorrect size for exiting list", + 100, alist.size()); + assertEquals("Returned incorrect size for new list", 0, new ArrayList() + .size()); } /** @@ -458,7 +458,7 @@ for (int i = 99; i > 24; i--) alist.remove(i); ((ArrayList) alist).trimToSize(); - assertTrue("Returned incorrect size after trim", alist.size() == 25); + assertEquals("Returned incorrect size after trim", 25, alist.size()); for (int i = 0; i < alist.size(); i++) assertTrue("Trimmed list contained incorrect elements", alist .get(i) == objArray[i]); Index: modules/luni/src/test/java/tests/api/java/util/ArraysTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/util/ArraysTest.java.orig 2006-04-16 15:18:06.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/util/ArraysTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -103,8 +103,8 @@ for (byte counter = 0; counter < arraySize; counter++) assertTrue("Binary search on byte[] answered incorrect position", Arrays.binarySearch(byteArray, counter) == counter); - assertTrue("Binary search succeeded for value not present in array 1", - Arrays.binarySearch(intArray, (byte) -1) == -1); + assertEquals("Binary search succeeded for value not present in array 1", + -1, Arrays.binarySearch(intArray, (byte) -1)); assertTrue( "Binary search succeeded for value not present in array 2", Arrays.binarySearch(intArray, (byte) arraySize) == -(arraySize + 1)); @@ -125,8 +125,8 @@ assertTrue( "Binary search on char[] answered incorrect position", Arrays.binarySearch(charArray, (char) (counter + 1)) == counter); - assertTrue("Binary search succeeded for value not present in array 1", - Arrays.binarySearch(charArray, '\u0000') == -1); + assertEquals("Binary search succeeded for value not present in array 1", + -1, Arrays.binarySearch(charArray, '\u0000')); assertTrue( "Binary search succeeded for value not present in array 2", Arrays.binarySearch(charArray, (char) (arraySize + 1)) == -(arraySize + 1)); @@ -141,8 +141,8 @@ assertTrue( "Binary search on double[] answered incorrect position", Arrays.binarySearch(doubleArray, (double) counter) == (double) counter); - assertTrue("Binary search succeeded for value not present in array 1", - Arrays.binarySearch(doubleArray, (double) -1) == -1); + assertEquals("Binary search succeeded for value not present in array 1", + -1, Arrays.binarySearch(doubleArray, (double) -1)); assertTrue( "Binary search succeeded for value not present in array 2", Arrays.binarySearch(doubleArray, (double) arraySize) == -(arraySize + 1)); @@ -161,8 +161,8 @@ int result = Arrays.binarySearch(specials, specials[i]); assertTrue(specials[i] + " invalid: " + result, result == i); } - assertTrue("-1d", Arrays.binarySearch(specials, -1d) == -4); - assertTrue("1d", Arrays.binarySearch(specials, 1d) == -8); + assertEquals("-1d", -4, Arrays.binarySearch(specials, -1d)); + assertEquals("1d", -8, Arrays.binarySearch(specials, 1d)); } @@ -175,8 +175,8 @@ assertTrue( "Binary search on float[] answered incorrect position", Arrays.binarySearch(floatArray, (float) counter) == (float) counter); - assertTrue("Binary search succeeded for value not present in array 1", - Arrays.binarySearch(floatArray, (float) -1) == -1); + assertEquals("Binary search succeeded for value not present in array 1", + -1, Arrays.binarySearch(floatArray, (float) -1)); assertTrue( "Binary search succeeded for value not present in array 2", Arrays.binarySearch(floatArray, (float) arraySize) == -(arraySize + 1)); @@ -195,8 +195,8 @@ int result = Arrays.binarySearch(specials, specials[i]); assertTrue(specials[i] + " invalid: " + result, result == i); } - assertTrue("-1f", Arrays.binarySearch(specials, -1f) == -4); - assertTrue("1f", Arrays.binarySearch(specials, 1f) == -8); + assertEquals("-1f", -4, Arrays.binarySearch(specials, -1f)); + assertEquals("1f", -8, Arrays.binarySearch(specials, 1f)); } /** @@ -207,8 +207,8 @@ for (int counter = 0; counter < arraySize; counter++) assertTrue("Binary search on int[] answered incorrect position", Arrays.binarySearch(intArray, counter) == counter); - assertTrue("Binary search succeeded for value not present in array 1", - Arrays.binarySearch(intArray, -1) == -1); + assertEquals("Binary search succeeded for value not present in array 1", + -1, Arrays.binarySearch(intArray, -1)); assertTrue("Binary search succeeded for value not present in array 2", Arrays.binarySearch(intArray, arraySize) == -(arraySize + 1)); for (int counter = 0; counter < arraySize; counter++) @@ -227,8 +227,8 @@ for (long counter = 0; counter < arraySize; counter++) assertTrue("Binary search on long[] answered incorrect position", Arrays.binarySearch(longArray, counter) == counter); - assertTrue("Binary search succeeded for value not present in array 1", - Arrays.binarySearch(longArray, (long) -1) == -1); + assertEquals("Binary search succeeded for value not present in array 1", + -1, Arrays.binarySearch(longArray, (long) -1)); assertTrue( "Binary search succeeded for value not present in array 2", Arrays.binarySearch(longArray, (long) arraySize) == -(arraySize + 1)); @@ -251,8 +251,8 @@ assertTrue( "Binary search on Object[] answered incorrect position", Arrays.binarySearch(objectArray, objArray[counter]) == counter); - assertTrue("Binary search succeeded for value not present in array 1", - Arrays.binarySearch(objectArray, new Integer(-1)) == -1); + assertEquals("Binary search succeeded for value not present in array 1", + -1, Arrays.binarySearch(objectArray, new Integer(-1))); assertTrue( "Binary search succeeded for value not present in array 2", Arrays.binarySearch(objectArray, new Integer(arraySize)) == -(arraySize + 1)); @@ -271,9 +271,8 @@ assertTrue( "Binary search succeeded for value not present in array 1", Arrays.binarySearch(objectArray, new Integer(-1), comp) == -(arraySize + 1)); - assertTrue( - "Binary search succeeded for value not present in array 2", - Arrays.binarySearch(objectArray, new Integer(arraySize), comp) == -1); + assertEquals("Binary search succeeded for value not present in array 2", + -1, Arrays.binarySearch(objectArray, new Integer(arraySize), comp)); for (int counter = 0; counter < arraySize; counter++) assertTrue( "Binary search on Object[] with custom comparator answered incorrect position", @@ -289,8 +288,8 @@ for (short counter = 0; counter < arraySize; counter++) assertTrue("Binary search on short[] answered incorrect position", Arrays.binarySearch(shortArray, counter) == counter); - assertTrue("Binary search succeeded for value not present in array 1", - Arrays.binarySearch(intArray, (short) -1) == -1); + assertEquals("Binary search succeeded for value not present in array 1", + -1, Arrays.binarySearch(intArray, (short) -1)); assertTrue( "Binary search succeeded for value not present in array 2", Arrays.binarySearch(intArray, (short) arraySize) == -(arraySize + 1)); @@ -337,7 +336,7 @@ } catch (IllegalArgumentException e) { result = 2; } - assertTrue("Wrong exception1", result == 2); + assertEquals("Wrong exception1", 2, result); try { Arrays.fill(new byte[2], -1, 1, (byte) 27); result = 0; @@ -346,7 +345,7 @@ } catch (IllegalArgumentException e) { result = 2; } - assertTrue("Wrong exception2", result == 1); + assertEquals("Wrong exception2", 1, result); try { Arrays.fill(new byte[2], 1, 4, (byte) 27); result = 0; @@ -355,7 +354,7 @@ } catch (IllegalArgumentException e) { result = 2; } - assertTrue("Wrong exception", result == 1); + assertEquals("Wrong exception", 1, result); } /** 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 15:18:06.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/util/BitSetTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -29,7 +29,7 @@ BitSet bs = new BitSet(); // Default size for a BitSet should be 64 elements; - assertTrue("Created BitSet of incorrect size", bs.size() == 64); + assertEquals("Created BitSet of incorrect size", 64, bs.size()); assertEquals("New BitSet had invalid string representation", "{}", bs .toString()); } @@ -42,14 +42,14 @@ BitSet bs = new BitSet(128); // Default size for a BitSet should be 64 elements; - assertTrue("Created BitSet of incorrect size", bs.size() == 128); + assertEquals("Created BitSet of incorrect size", 128, bs.size()); assertTrue("New BitSet had invalid string representation: " + bs.toString(), bs.toString().equals("{}")); // All BitSets are created with elements of multiples of 64 bs = new BitSet(89); - assertTrue("Failed to round BitSet element size", bs.size() == 128); + assertEquals("Failed to round BitSet element size", 128, bs.size()); try { bs = new BitSet(-9); @@ -196,7 +196,7 @@ initialSize = bs.size(); bs.set(0, initialSize); bs.clear(7, 64); - assertTrue("Failed to grow BitSet", bs.size() == 128); + assertEquals("Failed to grow BitSet", 128, bs.size()); for (int i = 0; i < 7; i++) assertTrue("Shouldn't have cleared bit " + i, bs.get(i)); for (int i = 7; i < 64; i++) @@ -449,7 +449,7 @@ // Try setting a bit on a 64 boundary bs.set(128); - assertTrue("Failed to grow BitSet", bs.size() == 192); + assertEquals("Failed to grow BitSet", 192, bs.size()); assertTrue("Failed to set bit", bs.get(128)); bs = new BitSet(64); @@ -510,7 +510,7 @@ // pos1 and pos2 is in the same bitset element, boundary testing bs = new BitSet(16); bs.set(7, 64); - assertTrue("Failed to grow BitSet", bs.size() == 128); + assertEquals("Failed to grow BitSet", 128, bs.size()); for (int i = 0; i < 7; i++) assertTrue("Shouldn't have set bit " + i, !bs.get(i)); for (int i = 7; i < 64; i++) @@ -641,7 +641,7 @@ // Try setting a bit on a 64 boundary bs.flip(128); - assertTrue("Failed to grow BitSet", bs.size() == 192); + assertEquals("Failed to grow BitSet", 192, bs.size()); assertTrue("Failed to flip bit", bs.get(128)); bs = new BitSet(64); @@ -657,16 +657,16 @@ } BitSet bs0 = new BitSet(0); - assertTrue("Test1: Wrong size", bs0.size() == 0); - assertTrue("Test1: Wrong length", bs0.length() == 0); + assertEquals("Test1: Wrong size", 0, bs0.size()); + assertEquals("Test1: Wrong length", 0, bs0.length()); bs0.flip(0); - assertTrue("Test2: Wrong size", bs0.size() == 64); - assertTrue("Test2: Wrong length", bs0.length() == 1); + assertEquals("Test2: Wrong size", 64, bs0.size()); + assertEquals("Test2: Wrong length", 1, bs0.length()); bs0.flip(63); - assertTrue("Test3: Wrong size", bs0.size() == 64); - assertTrue("Test3: Wrong length", bs0.length() == 64); + assertEquals("Test3: Wrong size", 64, bs0.size()); + assertEquals("Test3: Wrong length", 64, bs0.length()); eightbs.flip(7); assertTrue("Failed to flip bit 7", !eightbs.get(7)); @@ -706,7 +706,7 @@ bs.set(7); bs.set(10); bs.flip(7, 64); - assertTrue("Failed to grow BitSet", bs.size() == 128); + assertEquals("Failed to grow BitSet", 128, bs.size()); for (int i = 0; i < 7; i++) assertTrue("Shouldn't have flipped bit " + i, !bs.get(i)); assertTrue("Failed to flip bit 7", !bs.get(7)); @@ -825,8 +825,8 @@ assertTrue("Bit got flipped incorrectly ", eightbs.get(0)); BitSet bsnew = eightbs.get(2, 2); - assertTrue("BitSet retrieved incorrectly ", - bsnew.cardinality() == 0); + assertEquals("BitSet retrieved incorrectly ", + 0, bsnew.cardinality()); eightbs.set(10, 10); assertTrue("Bit got set incorrectly ", !eightbs.get(10)); @@ -951,7 +951,7 @@ bs = new BitSet(0); bs.andNot(bs2); - assertTrue("Incorrect size", bs.size() == 0); + assertEquals("Incorrect size", 0, bs.size()); } /** @@ -1005,7 +1005,7 @@ */ public void test_size() { // Test for method int java.util.BitSet.size() - assertTrue("Returned incorrect size", eightbs.size() == 64); + assertEquals("Returned incorrect size", 64, eightbs.size()); eightbs.set(129); assertTrue("Returned incorrect size", eightbs.size() >= 129); 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 15:18:06.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/util/CollectionsTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -477,7 +477,7 @@ Iterator i = l.iterator(); Object first = i.next(); assertTrue("Returned list consists of copies not refs", first == o); - assertTrue("Returned list of incorrect size", l.size() == 100); + assertEquals("Returned list of incorrect size", 100, l.size()); assertTrue("Contains", l.contains(o)); assertTrue("Contains null", !l.contains(null)); assertTrue("null nCopies contains", !Collections.nCopies(2, null) @@ -633,7 +633,7 @@ // java.util.Collections.singleton(java.lang.Object) Object o = new Object(); Set single = Collections.singleton(o); - assertTrue("Wrong size", single.size() == 1); + assertEquals("Wrong size", 1, single.size()); assertTrue("Contains", single.contains(o)); assertTrue("Contains null", !single.contains(null)); assertTrue("null nCopies contains", !Collections.singleton(null) 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 15:18:06.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/util/DateTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -148,16 +148,14 @@ Date d3 = new Date(someNumber + 1); Date d4 = new Date(someNumber - 1); Integer i = new Integer(0); - assertTrue("Comparing a date to itself did not answer zero", d1 - .compareTo((Object) d1) == 0); - assertTrue("Comparing equal dates did not answer zero", d1 - .compareTo((Object) d2) == 0); - assertTrue( - "date1.compareTo(date2), where date1 > date2, did not result in 1", - d1.compareTo((Object) d4) == 1); - assertTrue( - "date1.compareTo(date2), where date1 < date2, did not result in -1", - d1.compareTo((Object) d3) == -1); + assertEquals("Comparing a date to itself did not answer zero", 0, d1 + .compareTo((Object) d1)); + assertEquals("Comparing equal dates did not answer zero", 0, d1 + .compareTo((Object) d2)); + assertEquals("date1.compareTo(date2), where date1 > date2, did not result in 1", + 1, d1.compareTo((Object) d4)); + assertEquals("date1.compareTo(date2), where date1 < date2, did not result in -1", + -1, d1.compareTo((Object) d3)); try { d1.compareTo(i); } catch (ClassCastException e) { @@ -177,16 +175,14 @@ Date d2 = new Date(someNumber); Date d3 = new Date(someNumber + 1); Date d4 = new Date(someNumber - 1); - assertTrue("Comparing a date to itself did not answer zero", d1 - .compareTo(d1) == 0); - assertTrue("Comparing equal dates did not answer zero", d1 - .compareTo(d2) == 0); - assertTrue( - "date1.compareTo(date2), where date1 > date2, did not result in 1", - d1.compareTo(d4) == 1); - assertTrue( - "date1.compareTo(date2), where date1 < date2, did not result in -1", - d1.compareTo(d3) == -1); + assertEquals("Comparing a date to itself did not answer zero", 0, d1 + .compareTo(d1)); + assertEquals("Comparing equal dates did not answer zero", 0, d1 + .compareTo(d2)); + assertEquals("date1.compareTo(date2), where date1 > date2, did not result in 1", + 1, d1.compareTo(d4)); + assertEquals("date1.compareTo(date2), where date1 < date2, did not result in -1", + -1, d1.compareTo(d3)); } @@ -209,7 +205,7 @@ // Test for method int java.util.Date.getDate() Date d = new GregorianCalendar(1998, Calendar.OCTOBER, 13, 19, 9) .getTime(); - assertTrue("Returned incorrect date", d.getDate() == 13); + assertEquals("Returned incorrect date", 13, d.getDate()); } /** @@ -219,7 +215,7 @@ // Test for method int java.util.Date.getDay() Date d = new GregorianCalendar(1998, Calendar.OCTOBER, 13, 19, 9) .getTime(); - assertTrue("Returned incorrect day", d.getDay() == 2); + assertEquals("Returned incorrect day", 2, d.getDay()); } /** @@ -229,7 +225,7 @@ // Test for method int java.util.Date.getHours() Date d = new GregorianCalendar(1998, Calendar.OCTOBER, 13, 19, 9) .getTime(); - assertTrue("Returned incorrect hours", d.getHours() == 19); + assertEquals("Returned incorrect hours", 19, d.getHours()); } /** @@ -239,7 +235,7 @@ // Test for method int java.util.Date.getMinutes() Date d = new GregorianCalendar(1998, Calendar.OCTOBER, 13, 19, 9) .getTime(); - assertTrue("Returned incorrect minutes", d.getMinutes() == 9); + assertEquals("Returned incorrect minutes", 9, d.getMinutes()); } /** @@ -249,7 +245,7 @@ // Test for method int java.util.Date.getMonth() Date d = new GregorianCalendar(1998, Calendar.OCTOBER, 13, 19, 9) .getTime(); - assertTrue("Returned incorrect month", d.getMonth() == 9); + assertEquals("Returned incorrect month", 9, d.getMonth()); } /** @@ -259,7 +255,7 @@ // Test for method int java.util.Date.getSeconds() Date d = new GregorianCalendar(1998, Calendar.OCTOBER, 13, 19, 9) .getTime(); - assertTrue("Returned incorrect seconds", d.getSeconds() == 0); + assertEquals("Returned incorrect seconds", 0, d.getSeconds()); } /** @@ -269,8 +265,8 @@ // Test for method long java.util.Date.getTime() Date d1 = new Date(0); Date d2 = new Date(1900000); - assertTrue("Returned incorrect time", d2.getTime() == 1900000); - assertTrue("Returned incorrect time", d1.getTime() == 0); + assertEquals("Returned incorrect time", 1900000, d2.getTime()); + assertEquals("Returned incorrect time", 0, d1.getTime()); } /** @@ -288,7 +284,7 @@ // Test for method int java.util.Date.getYear() Date d = new GregorianCalendar(1998, Calendar.OCTOBER, 13, 19, 9) .getTime(); - assertTrue("Returned incorrect year", d.getYear() == 98); + assertEquals("Returned incorrect year", 98, d.getYear()); } /** @@ -298,8 +294,8 @@ // Test for method int java.util.Date.hashCode() Date d1 = new Date(0); Date d2 = new Date(1900000); - assertTrue("Returned incorrect hash", d2.hashCode() == 1900000); - assertTrue("Returned incorrect hash", d1.hashCode() == 0); + assertEquals("Returned incorrect hash", 1900000, d2.hashCode()); + assertEquals("Returned incorrect hash", 0, d1.hashCode()); } /** @@ -310,9 +306,9 @@ Date d = new Date(Date.parse("13 October 1998")); GregorianCalendar cal = new GregorianCalendar(); cal.setTime(d); - assertTrue("Parsed incorrect month", cal.get(Calendar.MONTH) == 9); - assertTrue("Parsed incorrect year", cal.get(Calendar.YEAR) == 1998); - assertTrue("Parsed incorrect date", cal.get(Calendar.DATE) == 13); + assertEquals("Parsed incorrect month", 9, cal.get(Calendar.MONTH)); + assertEquals("Parsed incorrect year", 1998, cal.get(Calendar.YEAR)); + assertEquals("Parsed incorrect date", 13, cal.get(Calendar.DATE)); d = new Date(Date.parse("Jan-12 1999")); assertTrue("Wrong parsed date 1", d.equals(new GregorianCalendar(1999, @@ -345,7 +341,7 @@ Date d = new GregorianCalendar(1998, Calendar.OCTOBER, 13, 19, 9) .getTime(); d.setDate(23); - assertTrue("Set incorrect date", d.getDate() == 23); + assertEquals("Set incorrect date", 23, d.getDate()); } /** @@ -356,7 +352,7 @@ Date d = new GregorianCalendar(1998, Calendar.OCTOBER, 13, 19, 9) .getTime(); d.setHours(23); - assertTrue("Set incorrect hours", d.getHours() == 23); + assertEquals("Set incorrect hours", 23, d.getHours()); } /** @@ -367,7 +363,7 @@ Date d = new GregorianCalendar(1998, Calendar.OCTOBER, 13, 19, 9) .getTime(); d.setMinutes(45); - assertTrue("Set incorrect mins", d.getMinutes() == 45); + assertEquals("Set incorrect mins", 45, d.getMinutes()); } /** @@ -378,7 +374,7 @@ Date d = new GregorianCalendar(1998, Calendar.OCTOBER, 13, 19, 9) .getTime(); d.setMonth(0); - assertTrue("Set incorrect month", d.getMonth() == 0); + assertEquals("Set incorrect month", 0, d.getMonth()); } /** @@ -389,7 +385,7 @@ Date d = new GregorianCalendar(1998, Calendar.OCTOBER, 13, 19, 9) .getTime(); d.setSeconds(13); - assertTrue("Set incorrect seconds", d.getSeconds() == 13); + assertEquals("Set incorrect seconds", 13, d.getSeconds()); } /** @@ -401,8 +397,8 @@ Date d2 = new Date(1900000); d1.setTime(900); d2.setTime(890000); - assertTrue("Returned incorrect time", d2.getTime() == 890000); - assertTrue("Returned incorrect time", d1.getTime() == 900); + assertEquals("Returned incorrect time", 890000, d2.getTime()); + assertEquals("Returned incorrect time", 900, d1.getTime()); } /** @@ -413,7 +409,7 @@ Date d = new GregorianCalendar(1998, Calendar.OCTOBER, 13, 19, 9) .getTime(); d.setYear(8); - assertTrue("Set incorrect year", d.getYear() == 8); + assertEquals("Set incorrect year", 8, d.getYear()); } /** Index: modules/luni/src/test/java/tests/api/java/util/GregorianCalendarTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/util/GregorianCalendarTest.java.orig 2006-04-16 15:17:59.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/util/GregorianCalendarTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -40,12 +40,12 @@ public void test_ConstructorIII() { // Test for method java.util.GregorianCalendar(int, int, int) GregorianCalendar gc = new GregorianCalendar(1972, Calendar.OCTOBER, 13); - assertTrue("Incorrect calendar constructed 1", - gc.get(Calendar.YEAR) == 1972); + assertEquals("Incorrect calendar constructed 1", + 1972, gc.get(Calendar.YEAR)); assertTrue("Incorrect calendar constructed 2", gc.get(Calendar.MONTH) == Calendar.OCTOBER); - assertTrue("Incorrect calendar constructed 3", gc - .get(Calendar.DAY_OF_MONTH) == 13); + assertEquals("Incorrect calendar constructed 3", 13, gc + .get(Calendar.DAY_OF_MONTH)); assertTrue("Incorrect calendar constructed 4", gc.getTimeZone().equals( TimeZone.getDefault())); } @@ -58,17 +58,17 @@ // Test for method java.util.GregorianCalendar(int, int, int, int, int) GregorianCalendar gc = new GregorianCalendar(1972, Calendar.OCTOBER, 13, 19, 9); - assertTrue("Incorrect calendar constructed", - gc.get(Calendar.YEAR) == 1972); + assertEquals("Incorrect calendar constructed", + 1972, gc.get(Calendar.YEAR)); assertTrue("Incorrect calendar constructed", gc.get(Calendar.MONTH) == Calendar.OCTOBER); - assertTrue("Incorrect calendar constructed", gc - .get(Calendar.DAY_OF_MONTH) == 13); - assertTrue("Incorrect calendar constructed", gc.get(Calendar.HOUR) == 7); - assertTrue("Incorrect calendar constructed", - gc.get(Calendar.AM_PM) == 1); - assertTrue("Incorrect calendar constructed", - gc.get(Calendar.MINUTE) == 9); + assertEquals("Incorrect calendar constructed", 13, gc + .get(Calendar.DAY_OF_MONTH)); + assertEquals("Incorrect calendar constructed", 7, gc.get(Calendar.HOUR)); + assertEquals("Incorrect calendar constructed", + 1, gc.get(Calendar.AM_PM)); + assertEquals("Incorrect calendar constructed", + 9, gc.get(Calendar.MINUTE)); assertTrue("Incorrect calendar constructed", gc.getTimeZone().equals( TimeZone.getDefault())); } @@ -82,19 +82,19 @@ // int) GregorianCalendar gc = new GregorianCalendar(1972, Calendar.OCTOBER, 13, 19, 9, 59); - assertTrue("Incorrect calendar constructed", - gc.get(Calendar.YEAR) == 1972); + assertEquals("Incorrect calendar constructed", + 1972, gc.get(Calendar.YEAR)); assertTrue("Incorrect calendar constructed", gc.get(Calendar.MONTH) == Calendar.OCTOBER); - assertTrue("Incorrect calendar constructed", gc - .get(Calendar.DAY_OF_MONTH) == 13); - assertTrue("Incorrect calendar constructed", gc.get(Calendar.HOUR) == 7); - assertTrue("Incorrect calendar constructed", - gc.get(Calendar.AM_PM) == 1); - assertTrue("Incorrect calendar constructed", - gc.get(Calendar.MINUTE) == 9); - assertTrue("Incorrect calendar constructed", - gc.get(Calendar.SECOND) == 59); + assertEquals("Incorrect calendar constructed", 13, gc + .get(Calendar.DAY_OF_MONTH)); + assertEquals("Incorrect calendar constructed", 7, gc.get(Calendar.HOUR)); + assertEquals("Incorrect calendar constructed", + 1, gc.get(Calendar.AM_PM)); + assertEquals("Incorrect calendar constructed", + 9, gc.get(Calendar.MINUTE)); + assertEquals("Incorrect calendar constructed", + 59, gc.get(Calendar.SECOND)); assertTrue("Incorrect calendar constructed", gc.getTimeZone().equals( TimeZone.getDefault())); } @@ -167,72 +167,72 @@ // Test for method void java.util.GregorianCalendar.add(int, int) GregorianCalendar gc1 = new GregorianCalendar(1998, 11, 6); gc1.add(GregorianCalendar.YEAR, 1); - assertTrue("Add failed to Increment", - gc1.get(GregorianCalendar.YEAR) == 1999); + assertEquals("Add failed to Increment", + 1999, gc1.get(GregorianCalendar.YEAR)); gc1 = new GregorianCalendar(1999, Calendar.JULY, 31); gc1.add(Calendar.MONTH, 7); - assertTrue("Wrong result year 1", gc1.get(Calendar.YEAR) == 2000); + assertEquals("Wrong result year 1", 2000, gc1.get(Calendar.YEAR)); assertTrue("Wrong result month 1", gc1.get(Calendar.MONTH) == Calendar.FEBRUARY); - assertTrue("Wrong result date 1", gc1.get(Calendar.DATE) == 29); + assertEquals("Wrong result date 1", 29, gc1.get(Calendar.DATE)); gc1.add(Calendar.YEAR, -1); - assertTrue("Wrong result year 2", gc1.get(Calendar.YEAR) == 1999); + assertEquals("Wrong result year 2", 1999, gc1.get(Calendar.YEAR)); assertTrue("Wrong result month 2", gc1.get(Calendar.MONTH) == Calendar.FEBRUARY); - assertTrue("Wrong result date 2", gc1.get(Calendar.DATE) == 28); + assertEquals("Wrong result date 2", 28, gc1.get(Calendar.DATE)); gc1 = new GregorianCalendar(TimeZone.getTimeZone("EST")); gc1.set(1999, Calendar.APRIL, 3, 16, 0); // day before DST change gc1.add(Calendar.MILLISECOND, 24 * 60 * 60 * 1000); - assertTrue("Wrong time after MILLISECOND change", gc1 - .get(Calendar.HOUR_OF_DAY) == 17); + assertEquals("Wrong time after MILLISECOND change", 17, gc1 + .get(Calendar.HOUR_OF_DAY)); gc1.set(1999, Calendar.APRIL, 3, 16, 0); // day before DST change gc1.add(Calendar.SECOND, 24 * 60 * 60); - assertTrue("Wrong time after SECOND change", gc1 - .get(Calendar.HOUR_OF_DAY) == 17); + assertEquals("Wrong time after SECOND change", 17, gc1 + .get(Calendar.HOUR_OF_DAY)); gc1.set(1999, Calendar.APRIL, 3, 16, 0); // day before DST change gc1.add(Calendar.MINUTE, 24 * 60); - assertTrue("Wrong time after MINUTE change", gc1 - .get(Calendar.HOUR_OF_DAY) == 17); + assertEquals("Wrong time after MINUTE change", 17, gc1 + .get(Calendar.HOUR_OF_DAY)); gc1.set(1999, Calendar.APRIL, 3, 16, 0); // day before DST change gc1.add(Calendar.HOUR, 24); - assertTrue("Wrong time after HOUR change", gc1 - .get(Calendar.HOUR_OF_DAY) == 17); + assertEquals("Wrong time after HOUR change", 17, gc1 + .get(Calendar.HOUR_OF_DAY)); gc1.set(1999, Calendar.APRIL, 3, 16, 0); // day before DST change gc1.add(Calendar.HOUR_OF_DAY, 24); - assertTrue("Wrong time after HOUR_OF_DAY change", gc1 - .get(Calendar.HOUR_OF_DAY) == 17); + assertEquals("Wrong time after HOUR_OF_DAY change", 17, gc1 + .get(Calendar.HOUR_OF_DAY)); gc1.set(1999, Calendar.APRIL, 3, 16, 0); // day before DST change gc1.add(Calendar.AM_PM, 2); - assertTrue("Wrong time after AM_PM change", gc1 - .get(Calendar.HOUR_OF_DAY) == 16); + assertEquals("Wrong time after AM_PM change", 16, gc1 + .get(Calendar.HOUR_OF_DAY)); gc1.set(1999, Calendar.APRIL, 3, 16, 0); // day before DST change gc1.add(Calendar.DATE, 1); - assertTrue("Wrong time after DATE change", gc1 - .get(Calendar.HOUR_OF_DAY) == 16); + assertEquals("Wrong time after DATE change", 16, gc1 + .get(Calendar.HOUR_OF_DAY)); gc1.set(1999, Calendar.APRIL, 3, 16, 0); // day before DST change gc1.add(Calendar.DAY_OF_YEAR, 1); - assertTrue("Wrong time after DAY_OF_YEAR change", gc1 - .get(Calendar.HOUR_OF_DAY) == 16); + assertEquals("Wrong time after DAY_OF_YEAR change", 16, gc1 + .get(Calendar.HOUR_OF_DAY)); gc1.set(1999, Calendar.APRIL, 3, 16, 0); // day before DST change gc1.add(Calendar.DAY_OF_WEEK, 1); - assertTrue("Wrong time after DAY_OF_WEEK change", gc1 - .get(Calendar.HOUR_OF_DAY) == 16); + assertEquals("Wrong time after DAY_OF_WEEK change", 16, gc1 + .get(Calendar.HOUR_OF_DAY)); gc1.set(1999, Calendar.APRIL, 3, 16, 0); // day before DST change gc1.add(Calendar.WEEK_OF_YEAR, 1); - assertTrue("Wrong time after WEEK_OF_YEAR change", gc1 - .get(Calendar.HOUR_OF_DAY) == 16); + assertEquals("Wrong time after WEEK_OF_YEAR change", 16, gc1 + .get(Calendar.HOUR_OF_DAY)); gc1.set(1999, Calendar.APRIL, 3, 16, 0); // day before DST change gc1.add(Calendar.WEEK_OF_MONTH, 1); - assertTrue("Wrong time after WEEK_OF_MONTH change", gc1 - .get(Calendar.HOUR_OF_DAY) == 16); + assertEquals("Wrong time after WEEK_OF_MONTH change", 16, gc1 + .get(Calendar.HOUR_OF_DAY)); gc1.set(1999, Calendar.APRIL, 3, 16, 0); // day before DST change gc1.add(Calendar.DAY_OF_WEEK_IN_MONTH, 1); - assertTrue("Wrong time after DAY_OF_WEEK_IN_MONTH change", gc1 - .get(Calendar.HOUR_OF_DAY) == 16); + assertEquals("Wrong time after DAY_OF_WEEK_IN_MONTH change", 16, gc1 + .get(Calendar.HOUR_OF_DAY)); gc1.clear(); gc1.set(2000, Calendar.APRIL, 1, 23, 0); @@ -269,26 +269,26 @@ GregorianCalendar gc4 = new GregorianCalendar(2000, 1, 1); GregorianCalendar gc5 = new GregorianCalendar(2000, 9, 9); GregorianCalendar gc6 = new GregorianCalendar(2000, 3, 3); - assertTrue("Wrong actual maximum value for DAY_OF_MONTH for Feb 1900", - gc1.getActualMaximum(Calendar.DAY_OF_MONTH) == 28); - assertTrue("Wrong actual maximum value for DAY_OF_MONTH for Feb 1996", - gc2.getActualMaximum(Calendar.DAY_OF_MONTH) == 29); - assertTrue("Wrong actual maximum value for DAY_OF_MONTH for Feb 1998", - gc3.getActualMaximum(Calendar.DAY_OF_MONTH) == 28); - assertTrue("Wrong actual maximum value for DAY_OF_MONTH for Feb 2000", - gc4.getActualMaximum(Calendar.DAY_OF_MONTH) == 29); - assertTrue("Wrong actual maximum value for DAY_OF_MONTH for Oct 2000", - gc5.getActualMaximum(Calendar.DAY_OF_MONTH) == 31); - assertTrue("Wrong actual maximum value for DAY_OF_MONTH for Apr 2000", - gc6.getActualMaximum(Calendar.DAY_OF_MONTH) == 30); + assertEquals("Wrong actual maximum value for DAY_OF_MONTH for Feb 1900", + 28, gc1.getActualMaximum(Calendar.DAY_OF_MONTH)); + assertEquals("Wrong actual maximum value for DAY_OF_MONTH for Feb 1996", + 29, gc2.getActualMaximum(Calendar.DAY_OF_MONTH)); + assertEquals("Wrong actual maximum value for DAY_OF_MONTH for Feb 1998", + 28, gc3.getActualMaximum(Calendar.DAY_OF_MONTH)); + assertEquals("Wrong actual maximum value for DAY_OF_MONTH for Feb 2000", + 29, gc4.getActualMaximum(Calendar.DAY_OF_MONTH)); + assertEquals("Wrong actual maximum value for DAY_OF_MONTH for Oct 2000", + 31, gc5.getActualMaximum(Calendar.DAY_OF_MONTH)); + assertEquals("Wrong actual maximum value for DAY_OF_MONTH for Apr 2000", + 30, gc6.getActualMaximum(Calendar.DAY_OF_MONTH)); assertTrue("Wrong actual maximum value for MONTH", gc1 .getActualMaximum(Calendar.MONTH) == Calendar.DECEMBER); - assertTrue("Wrong actual maximum value for HOUR_OF_DAY", gc1 - .getActualMaximum(Calendar.HOUR_OF_DAY) == 23); - assertTrue("Wrong actual maximum value for HOUR", gc1 - .getActualMaximum(Calendar.HOUR) == 11); - assertTrue("Wrong actual maximum value for DAY_OF_WEEK_IN_MONTH", gc6 - .getActualMaximum(Calendar.DAY_OF_WEEK_IN_MONTH) == 4); + assertEquals("Wrong actual maximum value for HOUR_OF_DAY", 23, gc1 + .getActualMaximum(Calendar.HOUR_OF_DAY)); + assertEquals("Wrong actual maximum value for HOUR", 11, gc1 + .getActualMaximum(Calendar.HOUR)); + assertEquals("Wrong actual maximum value for DAY_OF_WEEK_IN_MONTH", 4, gc6 + .getActualMaximum(Calendar.DAY_OF_WEEK_IN_MONTH)); } /** @@ -302,16 +302,16 @@ new GregorianCalendar(2000, 1, 1); new GregorianCalendar(2000, 9, 9); GregorianCalendar gc6 = new GregorianCalendar(2000, 3, 3); - assertTrue("Wrong actual minimum value for DAY_OF_MONTH for Feb 1900", - gc1.getActualMinimum(Calendar.DAY_OF_MONTH) == 1); + assertEquals("Wrong actual minimum value for DAY_OF_MONTH for Feb 1900", + 1, gc1.getActualMinimum(Calendar.DAY_OF_MONTH)); assertTrue("Wrong actual minimum value for MONTH", gc1 .getActualMinimum(Calendar.MONTH) == Calendar.JANUARY); - assertTrue("Wrong actual minimum value for HOUR_OF_DAY", gc1 - .getActualMinimum(Calendar.HOUR_OF_DAY) == 0); - assertTrue("Wrong actual minimum value for HOUR", gc1 - .getActualMinimum(Calendar.HOUR) == 0); - assertTrue("Wrong actual minimum value for DAY_OF_WEEK_IN_MONTH", gc6 - .getActualMinimum(Calendar.DAY_OF_WEEK_IN_MONTH) == -1); + assertEquals("Wrong actual minimum value for HOUR_OF_DAY", 0, gc1 + .getActualMinimum(Calendar.HOUR_OF_DAY)); + assertEquals("Wrong actual minimum value for HOUR", 0, gc1 + .getActualMinimum(Calendar.HOUR)); + assertEquals("Wrong actual minimum value for DAY_OF_WEEK_IN_MONTH", -1, gc6 + .getActualMinimum(Calendar.DAY_OF_WEEK_IN_MONTH)); } /** @@ -321,14 +321,14 @@ // Test for method int // java.util.GregorianCalendar.getGreatestMinimum(int) GregorianCalendar gc = new GregorianCalendar(); - assertTrue("Wrong greatest minimum value for DAY_OF_MONTH", gc - .getGreatestMinimum(Calendar.DAY_OF_MONTH) == 1); + assertEquals("Wrong greatest minimum value for DAY_OF_MONTH", 1, gc + .getGreatestMinimum(Calendar.DAY_OF_MONTH)); assertTrue("Wrong greatest minimum value for MONTH", gc .getGreatestMinimum(Calendar.MONTH) == Calendar.JANUARY); - assertTrue("Wrong greatest minimum value for HOUR_OF_DAY", gc - .getGreatestMinimum(Calendar.HOUR_OF_DAY) == 0); - assertTrue("Wrong greatest minimum value for HOUR", gc - .getGreatestMinimum(Calendar.HOUR) == 0); + assertEquals("Wrong greatest minimum value for HOUR_OF_DAY", 0, gc + .getGreatestMinimum(Calendar.HOUR_OF_DAY)); + assertEquals("Wrong greatest minimum value for HOUR", 0, gc + .getGreatestMinimum(Calendar.HOUR)); BitSet result = new BitSet(); int[] min = { 0, 1, 0, 1, 0, 1, 1, 1, -1, 0, 0, 0, 0, 0, 0, -43200000, @@ -350,12 +350,12 @@ GregorianCalendar returnedChange = new GregorianCalendar(TimeZone .getTimeZone("EST")); returnedChange.setTime(gc.getGregorianChange()); - assertTrue("Returned incorrect year", - returnedChange.get(Calendar.YEAR) == 1582); + assertEquals("Returned incorrect year", + 1582, returnedChange.get(Calendar.YEAR)); assertTrue("Returned incorrect month", returnedChange .get(Calendar.MONTH) == Calendar.OCTOBER); - assertTrue("Returned incorrect day of month", returnedChange - .get(Calendar.DAY_OF_MONTH) == 4); + assertEquals("Returned incorrect day of month", 4, returnedChange + .get(Calendar.DAY_OF_MONTH)); } /** @@ -364,14 +364,14 @@ public void test_getLeastMaximumI() { // Test for method int java.util.GregorianCalendar.getLeastMaximum(int) GregorianCalendar gc = new GregorianCalendar(); - assertTrue("Wrong least maximum value for DAY_OF_MONTH", gc - .getLeastMaximum(Calendar.DAY_OF_MONTH) == 28); + assertEquals("Wrong least maximum value for DAY_OF_MONTH", 28, gc + .getLeastMaximum(Calendar.DAY_OF_MONTH)); assertTrue("Wrong least maximum value for MONTH", gc .getLeastMaximum(Calendar.MONTH) == Calendar.DECEMBER); - assertTrue("Wrong least maximum value for HOUR_OF_DAY", gc - .getLeastMaximum(Calendar.HOUR_OF_DAY) == 23); - assertTrue("Wrong least maximum value for HOUR", gc - .getLeastMaximum(Calendar.HOUR) == 11); + assertEquals("Wrong least maximum value for HOUR_OF_DAY", 23, gc + .getLeastMaximum(Calendar.HOUR_OF_DAY)); + assertEquals("Wrong least maximum value for HOUR", 11, gc + .getLeastMaximum(Calendar.HOUR)); BitSet result = new BitSet(); Vector values = new Vector(); @@ -393,14 +393,14 @@ public void test_getMaximumI() { // Test for method int java.util.GregorianCalendar.getMaximum(int) GregorianCalendar gc = new GregorianCalendar(); - assertTrue("Wrong maximum value for DAY_OF_MONTH", gc - .getMaximum(Calendar.DAY_OF_MONTH) == 31); + assertEquals("Wrong maximum value for DAY_OF_MONTH", 31, gc + .getMaximum(Calendar.DAY_OF_MONTH)); assertTrue("Wrong maximum value for MONTH", gc .getMaximum(Calendar.MONTH) == Calendar.DECEMBER); - assertTrue("Wrong maximum value for HOUR_OF_DAY", gc - .getMaximum(Calendar.HOUR_OF_DAY) == 23); - assertTrue("Wrong maximum value for HOUR", - gc.getMaximum(Calendar.HOUR) == 11); + assertEquals("Wrong maximum value for HOUR_OF_DAY", 23, gc + .getMaximum(Calendar.HOUR_OF_DAY)); + assertEquals("Wrong maximum value for HOUR", + 11, gc.getMaximum(Calendar.HOUR)); BitSet result = new BitSet(); Vector values = new Vector(); @@ -422,14 +422,14 @@ public void test_getMinimumI() { // Test for method int java.util.GregorianCalendar.getMinimum(int) GregorianCalendar gc = new GregorianCalendar(); - assertTrue("Wrong minimum value for DAY_OF_MONTH", gc - .getMinimum(Calendar.DAY_OF_MONTH) == 1); + assertEquals("Wrong minimum value for DAY_OF_MONTH", 1, gc + .getMinimum(Calendar.DAY_OF_MONTH)); assertTrue("Wrong minimum value for MONTH", gc .getMinimum(Calendar.MONTH) == Calendar.JANUARY); - assertTrue("Wrong minimum value for HOUR_OF_DAY", gc - .getMinimum(Calendar.HOUR_OF_DAY) == 0); - assertTrue("Wrong minimum value for HOUR", - gc.getMinimum(Calendar.HOUR) == 0); + assertEquals("Wrong minimum value for HOUR_OF_DAY", 0, gc + .getMinimum(Calendar.HOUR_OF_DAY)); + assertEquals("Wrong minimum value for HOUR", + 0, gc.getMinimum(Calendar.HOUR)); BitSet result = new BitSet(); int[] min = { 0, 1, 0, 1, 0, 1, 1, 1, -1, 0, 0, 0, 0, 0, 0, -43200000, @@ -507,14 +507,14 @@ } catch (IllegalArgumentException e) { result = 1; } - assertTrue("ZONE_OFFSET roll", result == 1); + assertEquals("ZONE_OFFSET roll", 1, result); try { cal.roll(Calendar.DST_OFFSET, true); result = 0; } catch (IllegalArgumentException e) { result = 1; } - assertTrue("ZONE_OFFSET roll", result == 1); + assertEquals("ZONE_OFFSET roll", 1, result); cal.set(2004, Calendar.DECEMBER, 31, 5, 0, 0); cal.roll(Calendar.WEEK_OF_YEAR, true); 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 15:18:06.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/util/HashMapTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -54,7 +54,7 @@ new Support_MapTest2(new HashMap()).runTest(); HashMap hm2 = new HashMap(); - assertTrue("Created incorrect HashMap", hm2.size() == 0); + assertEquals("Created incorrect HashMap", 0, hm2.size()); } /** @@ -63,7 +63,7 @@ public void test_ConstructorI() { // Test for method java.util.HashMap(int) HashMap hm2 = new HashMap(5); - assertTrue("Created incorrect HashMap", hm2.size() == 0); + assertEquals("Created incorrect HashMap", 0, hm2.size()); try { new HashMap(-1); } catch (IllegalArgumentException e) { @@ -84,7 +84,7 @@ public void test_ConstructorIF() { // Test for method java.util.HashMap(int, float) HashMap hm2 = new HashMap(5, (float) 0.5); - assertTrue("Created incorrect HashMap", hm2.size() == 0); + assertEquals("Created incorrect HashMap", 0, hm2.size()); try { new HashMap(0, 0); } catch (IllegalArgumentException e) { @@ -119,7 +119,7 @@ public void test_clear() { // Test for method void java.util.HashMap.clear() hm.clear(); - assertTrue("Clear failed to reset size", hm.size() == 0); + assertEquals("Clear failed to reset size", 0, hm.size()); for (int i = 0; i < hmSize; i++) assertNull("Failed to clear all elements", hm.get(objArray2[i])); @@ -277,7 +277,7 @@ list.remove(remove1); list.remove(remove2); assertTrue("Wrong result", it.next().equals(list.get(0))); - assertTrue("Wrong size", map.size() == 1); + assertEquals("Wrong size", 1, map.size()); assertTrue("Wrong contents", map.keySet().iterator().next().equals( list.get(0))); @@ -294,7 +294,7 @@ it2.hasNext(); it2.remove(); assertTrue("Wrong result 2", it2.next().equals(next)); - assertTrue("Wrong size 2", map2.size() == 1); + assertEquals("Wrong size 2", 1, map2.size()); assertTrue("Wrong contents 2", map2.keySet().iterator().next().equals( next)); } Index: modules/luni/src/test/java/tests/api/java/util/HashSetTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/util/HashSetTest.java.orig 2006-04-16 15:18:06.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/util/HashSetTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -37,7 +37,7 @@ public void test_Constructor() { // Test for method java.util.HashSet() HashSet hs2 = new HashSet(); - assertTrue("Created incorrect HashSet", hs2.size() == 0); + assertEquals("Created incorrect HashSet", 0, hs2.size()); } /** @@ -46,7 +46,7 @@ public void test_ConstructorI() { // Test for method java.util.HashSet(int) HashSet hs2 = new HashSet(5); - assertTrue("Created incorrect HashSet", hs2.size() == 0); + assertEquals("Created incorrect HashSet", 0, hs2.size()); try { new HashSet(-1); } catch (IllegalArgumentException e) { @@ -62,7 +62,7 @@ public void test_ConstructorIF() { // Test for method java.util.HashSet(int, float) HashSet hs2 = new HashSet(5, (float) 0.5); - assertTrue("Created incorrect HashSet", hs2.size() == 0); + assertEquals("Created incorrect HashSet", 0, hs2.size()); try { new HashSet(0, 0); } catch (IllegalArgumentException e) { @@ -107,7 +107,7 @@ Set orgSet = (Set) hs.clone(); hs.clear(); Iterator i = orgSet.iterator(); - assertTrue("Returned non-zero size after clear", hs.size() == 0); + assertEquals("Returned non-zero size after clear", 0, hs.size()); while (i.hasNext()) assertTrue("Failed to clear set", !hs.contains(i.next())); } @@ -186,7 +186,7 @@ // Test for method int java.util.HashSet.size() assertTrue("Returned incorrect size", hs.size() == (objArray.length + 1)); hs.clear(); - assertTrue("Cleared set returned non-zero size", hs.size() == 0); + assertEquals("Cleared set returned non-zero size", 0, hs.size()); } /** 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 15:18:06.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/util/HashtableTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -56,7 +56,7 @@ Hashtable h = new Hashtable(); - assertTrue("Created incorrect hashtable", h.size() == 0); + assertEquals("Created incorrect hashtable", 0, h.size()); } /** @@ -66,7 +66,7 @@ // Test for method java.util.Hashtable(int) Hashtable h = new Hashtable(9); - assertTrue("Created incorrect hashtable", h.size() == 0); + assertEquals("Created incorrect hashtable", 0, h.size()); Hashtable empty = new Hashtable(0); assertNull("Empty hashtable access", empty.get("nothing")); @@ -80,7 +80,7 @@ public void test_ConstructorIF() { // Test for method java.util.Hashtable(int, float) Hashtable h = new java.util.Hashtable(10, 0.5f); - assertTrue("Created incorrect hashtable", h.size() == 0); + assertEquals("Created incorrect hashtable", 0, h.size()); Hashtable empty = new Hashtable(0, 0.75f); assertNull("Empty hashtable access", empty.get("nothing")); @@ -112,7 +112,7 @@ // Test for method void java.util.Hashtable.clear() Hashtable h = hashtableClone(htfull); h.clear(); - assertTrue("Hashtable was not cleared", h.size() == 0); + assertEquals("Hashtable was not cleared", 0, h.size()); Enumeration el = h.elements(); Enumeration keys = h.keys(); assertTrue("Hashtable improperly cleared", !el.hasMoreElements() @@ -190,7 +190,7 @@ ++i; } - assertTrue("All keys not retrieved", ht10.size() == 10); + assertEquals("All keys not retrieved", 10, ht10.size()); } /** @@ -357,7 +357,7 @@ ++i; } - assertTrue("All keys not retrieved", ht10.size() == 10); + assertEquals("All keys not retrieved", 10, ht10.size()); } /** @@ -408,7 +408,7 @@ list.remove(remove1); list.remove(remove2); assertTrue("Wrong result", it.next().equals(list.get(0))); - assertTrue("Wrong size", map.size() == 1); + assertEquals("Wrong size", 1, map.size()); assertTrue("Wrong contents", map.keySet().iterator().next().equals( list.get(0))); @@ -425,7 +425,7 @@ it2.hasNext(); it2.remove(); assertTrue("Wrong result 2", it2.next().equals(next)); - assertTrue("Wrong size 2", map2.size() == 1); + assertEquals("Wrong size 2", 1, map2.size()); assertTrue("Wrong contents 2", map2.keySet().iterator().next().equals( next)); } Index: modules/luni/src/test/java/tests/api/java/util/IdentityHashMap2Test.java =================================================================== --- modules/luni/src/test/java/tests/api/java/util/IdentityHashMap2Test.java.orig 2006-04-16 15:18:06.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/util/IdentityHashMap2Test.java 2006-04-16 15:18:06.000000000 +0100 @@ -151,7 +151,7 @@ Set set = map.entrySet(); set.removeAll(set); - assertTrue("did not remove all elements in the map", map.size() == 0); + assertEquals("did not remove all elements in the map", 0, map.size()); assertTrue("did not remove all elements in the entryset", set.isEmpty()); Iterator it = set.iterator(); @@ -170,7 +170,7 @@ Set set = map.keySet(); set.clear(); - assertTrue("did not remove all elements in the map", map.size() == 0); + assertEquals("did not remove all elements in the map", 0, map.size()); assertTrue("did not remove all elements in the keyset", set.isEmpty()); Iterator it = set.iterator(); @@ -224,7 +224,7 @@ .containsValue(value)); vals.clear(); - assertTrue("Did not remove all entries as expected", map.size() == 0); + assertEquals("Did not remove all entries as expected", 0, map.size()); } /** @@ -239,7 +239,7 @@ Set set = map.keySet(); set.removeAll(set); - assertTrue("did not remove all elements in the map", map.size() == 0); + assertEquals("did not remove all elements in the map", 0, map.size()); assertTrue("did not remove all elements in the keyset", set.isEmpty()); Iterator it = set.iterator(); @@ -259,12 +259,12 @@ // retain all the elements boolean result = set.retainAll(set); assertTrue("retain all should return false", !result); - assertTrue("did not retain all", set.size() == 1000); + assertEquals("did not retain all", 1000, set.size()); // send empty set to retainAll result = set.retainAll(new TreeSet()); assertTrue("retain all should return true", result); - assertTrue("did not remove all elements in the map", map.size() == 0); + assertEquals("did not remove all elements in the map", 0, map.size()); assertTrue("did not remove all elements in the keyset", set.isEmpty()); Iterator it = set.iterator(); 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 15:18:06.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/util/IdentityHashMapTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -59,7 +59,7 @@ new Support_MapTest2(new IdentityHashMap()).runTest(); IdentityHashMap hm2 = new IdentityHashMap(); - assertTrue("Created incorrect IdentityHashMap", hm2.size() == 0); + assertEquals("Created incorrect IdentityHashMap", 0, hm2.size()); } /** @@ -68,7 +68,7 @@ public void test_ConstructorI() { // Test for method java.util.IdentityHashMap(int) IdentityHashMap hm2 = new IdentityHashMap(5); - assertTrue("Created incorrect IdentityHashMap", hm2.size() == 0); + assertEquals("Created incorrect IdentityHashMap", 0, hm2.size()); try { new IdentityHashMap(-1); } catch (IllegalArgumentException e) { @@ -103,7 +103,7 @@ public void test_clear() { // Test for method void java.util.IdentityHashMap.clear() hm.clear(); - assertTrue("Clear failed to reset size", hm.size() == 0); + assertEquals("Clear failed to reset size", 0, hm.size()); for (int i = 0; i < hmSize; i++) assertNull("Failed to clear all elements", hm.get(objArray2[i])); @@ -253,7 +253,7 @@ list.remove(remove1); list.remove(remove2); assertTrue("Wrong result", it.next().equals(list.get(0))); - assertTrue("Wrong size", map.size() == 1); + assertEquals("Wrong size", 1, map.size()); assertTrue("Wrong contents", map.keySet().iterator().next().equals( list.get(0))); @@ -270,7 +270,7 @@ it2.hasNext(); it2.remove(); assertTrue("Wrong result 2", it2.next().equals(next)); - assertTrue("Wrong size 2", map2.size() == 1); + assertEquals("Wrong size 2", 1, map2.size()); assertTrue("Wrong contents 2", map2.keySet().iterator().next().equals( next)); } 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 15:18:06.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/util/LinkedHashMapTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -63,7 +63,7 @@ new Support_MapTest2(new LinkedHashMap()).runTest(); LinkedHashMap hm2 = new LinkedHashMap(); - assertTrue("Created incorrect LinkedHashMap", hm2.size() == 0); + assertEquals("Created incorrect LinkedHashMap", 0, hm2.size()); } /** @@ -72,7 +72,7 @@ public void test_ConstructorI() { // Test for method java.util.LinkedHashMap(int) LinkedHashMap hm2 = new LinkedHashMap(5); - assertTrue("Created incorrect LinkedHashMap", hm2.size() == 0); + assertEquals("Created incorrect LinkedHashMap", 0, hm2.size()); try { new LinkedHashMap(-1); } catch (IllegalArgumentException e) { @@ -93,7 +93,7 @@ public void test_ConstructorIF() { // Test for method java.util.LinkedHashMap(int, float) LinkedHashMap hm2 = new LinkedHashMap(5, (float) 0.5); - assertTrue("Created incorrect LinkedHashMap", hm2.size() == 0); + assertEquals("Created incorrect LinkedHashMap", 0, hm2.size()); try { new LinkedHashMap(0, 0); } catch (IllegalArgumentException e) { @@ -219,7 +219,7 @@ list.remove(remove1); list.remove(remove2); assertTrue("Wrong result", it.next().equals(list.get(0))); - assertTrue("Wrong size", map.size() == 1); + assertEquals("Wrong size", 1, map.size()); assertTrue("Wrong contents", map.keySet().iterator().next().equals( list.get(0))); @@ -236,7 +236,7 @@ it2.hasNext(); it2.remove(); assertTrue("Wrong result 2", it2.next().equals(next)); - assertTrue("Wrong size 2", map2.size() == 1); + assertEquals("Wrong size 2", 1, map2.size()); assertTrue("Wrong contents 2", map2.keySet().iterator().next().equals( next)); } @@ -295,7 +295,7 @@ public void test_clear() { // Test for method void java.util.LinkedHashMap.clear() hm.clear(); - assertTrue("Clear failed to reset size", hm.size() == 0); + assertEquals("Clear failed to reset size", 0, hm.size()); for (int i = 0; i < hmSize; i++) assertNull("Failed to clear all elements", hm.get(objArray2[i])); @@ -428,7 +428,7 @@ String ii = (String) lruhm.get(new Integer(i)); p = p + Integer.parseInt(ii); } - assertTrue("invalid sum of even numbers", p == 2450); + assertEquals("invalid sum of even numbers", 2450, p); Set s2 = lruhm.entrySet(); Iterator it2 = s2.iterator(); @@ -487,7 +487,7 @@ String ii = (String) lruhm.get(new Integer(i)); p = p + Integer.parseInt(ii); } - assertTrue("invalid sum of even numbers", p == 2450); + assertEquals("invalid sum of even numbers", 2450, p); Set s2 = lruhm.keySet(); Iterator it2 = s2.iterator(); Index: modules/luni/src/test/java/tests/api/java/util/LinkedHashSetTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/util/LinkedHashSetTest.java.orig 2006-04-16 15:18:06.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/util/LinkedHashSetTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -40,7 +40,7 @@ public void test_Constructor() { // Test for method java.util.LinkedHashSet() LinkedHashSet hs2 = new LinkedHashSet(); - assertTrue("Created incorrect LinkedHashSet", hs2.size() == 0); + assertEquals("Created incorrect LinkedHashSet", 0, hs2.size()); } /** @@ -49,7 +49,7 @@ public void test_ConstructorI() { // Test for method java.util.LinkedHashSet(int) LinkedHashSet hs2 = new LinkedHashSet(5); - assertTrue("Created incorrect LinkedHashSet", hs2.size() == 0); + assertEquals("Created incorrect LinkedHashSet", 0, hs2.size()); try { new LinkedHashSet(-1); } catch (IllegalArgumentException e) { @@ -65,7 +65,7 @@ public void test_ConstructorIF() { // Test for method java.util.LinkedHashSet(int, float) LinkedHashSet hs2 = new LinkedHashSet(5, (float) 0.5); - assertTrue("Created incorrect LinkedHashSet", hs2.size() == 0); + assertEquals("Created incorrect LinkedHashSet", 0, hs2.size()); try { new LinkedHashSet(0, 0); } catch (IllegalArgumentException e) { @@ -110,7 +110,7 @@ Set orgSet = (Set) hs.clone(); hs.clear(); Iterator i = orgSet.iterator(); - assertTrue("Returned non-zero size after clear", hs.size() == 0); + assertEquals("Returned non-zero size after clear", 0, hs.size()); while (i.hasNext()) assertTrue("Failed to clear set", !hs.contains(i.next())); } @@ -198,7 +198,7 @@ // Test for method int java.util.LinkedHashSet.size() assertTrue("Returned incorrect size", hs.size() == (objArray.length + 1)); hs.clear(); - assertTrue("Cleared set returned non-zero size", hs.size() == 0); + assertEquals("Cleared set returned non-zero size", 0, hs.size()); } /** 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 15:18:06.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/util/LinkedListTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -92,8 +92,8 @@ // Test for method boolean java.util.LinkedList.addAll(int, // java.util.Collection) ll.addAll(50, (Collection) ll.clone()); - assertTrue("Returned incorrect size after adding to existing list", ll - .size() == 200); + assertEquals("Returned incorrect size after adding to existing list", 200, ll + .size()); for (int i = 0; i < 50; i++) assertTrue("Manipulated elements < index", ll.get(i) == objArray[i]); for (int i = 0; i >= 50 && (i < 150); i++) @@ -130,8 +130,8 @@ assertTrue("Failed to add elements properly", l.get(i).equals( ll.get(i))); ll.addAll((Collection) ll.clone()); - assertTrue("Returned incorrect siZe after adding to existing list", ll - .size() == 200); + assertEquals("Returned incorrect siZe after adding to existing list", 200, ll + .size()); for (int i = 0; i < 100; i++) { assertTrue("Added to list in incorrect order", ll.get(i).equals( l.get(i))); @@ -258,9 +258,9 @@ */ public void test_indexOfLjava_lang_Object() { // Test for method int java.util.LinkedList.indexOf(java.lang.Object) - assertTrue("Returned incorrect index", ll.indexOf(objArray[87]) == 87); - assertTrue("Returned index for invalid Object", ll - .indexOf(new Object()) == -1); + assertEquals("Returned incorrect index", 87, ll.indexOf(objArray[87])); + assertEquals("Returned index for invalid Object", -1, ll + .indexOf(new Object())); ll.add(20, null); ll.add(24, null); assertTrue("Index of null should be 20, but got: " + ll.indexOf(null), @@ -274,10 +274,10 @@ // Test for method int // java.util.LinkedList.lastIndexOf(java.lang.Object) ll.add(new Integer(99)); - assertTrue("Returned incorrect index", - ll.lastIndexOf(objArray[99]) == 100); - assertTrue("Returned index for invalid Object", ll - .lastIndexOf(new Object()) == -1); + assertEquals("Returned incorrect index", + 100, ll.lastIndexOf(objArray[99])); + assertEquals("Returned index for invalid Object", -1, ll + .lastIndexOf(new Object())); ll.add(20, null); ll.add(24, null); assertTrue("Last index of null should be 20, but got: " @@ -340,7 +340,7 @@ public void test_removeI() { // Test for method java.lang.Object java.util.LinkedList.remove(int) ll.remove(10); - assertTrue("Failed to remove element", ll.indexOf(objArray[10]) == -1); + assertEquals("Failed to remove element", -1, ll.indexOf(objArray[10])); try { ll.remove(999); } catch (IndexOutOfBoundsException e) { @@ -360,7 +360,7 @@ // Test for method boolean java.util.LinkedList.remove(java.lang.Object) assertTrue("Failed to remove valid Object", ll.remove(objArray[87])); assertTrue("Removed invalid object", !ll.remove(new Object())); - assertTrue("Found Object after removal", ll.indexOf(objArray[87]) == -1); + assertEquals("Found Object after removal", -1, ll.indexOf(objArray[87])); ll.add(null); ll.remove(null); assertTrue("Should not contain null afrer removal", !ll.contains(null)); Index: modules/luni/src/test/java/tests/api/java/util/ObservableTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/util/ObservableTest.java.orig 2006-04-16 15:17:59.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/util/ObservableTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -78,7 +78,7 @@ try { Observable ov = new Observable(); assertTrue("Wrong initial values.", !ov.hasChanged()); - assertTrue("Wrong initial values.", ov.countObservers() == 0); + assertEquals("Wrong initial values.", 0, ov.countObservers()); } catch (Exception e) { fail("Exception during test : " + e.getMessage()); } @@ -92,9 +92,9 @@ // java.util.Observable.addObserver(java.util.Observer) TestObserver test = new TestObserver(); observable.addObserver(test); - assertTrue("Failed to add observer", observable.countObservers() == 1); + assertEquals("Failed to add observer", 1, observable.countObservers()); observable.addObserver(test); - assertTrue("Duplicate observer", observable.countObservers() == 1); + assertEquals("Duplicate observer", 1, observable.countObservers()); Observable o = new Observable(); try { @@ -113,11 +113,11 @@ */ public void test_countObservers() { // Test for method int java.util.Observable.countObservers() - assertTrue("New observable had > 0 observers", observable - .countObservers() == 0); + assertEquals("New observable had > 0 observers", 0, observable + .countObservers()); observable.addObserver(new TestObserver()); - assertTrue("Observable with observer returned other than 1", observable - .countObservers() == 1); + assertEquals("Observable with observer returned other than 1", 1, observable + .countObservers()); } /** @@ -128,8 +128,8 @@ // java.util.Observable.deleteObserver(java.util.Observer) observable.addObserver(observer = new TestObserver()); observable.deleteObserver(observer); - assertTrue("Failed to delete observer", - observable.countObservers() == 0); + assertEquals("Failed to delete observer", + 0, observable.countObservers()); } @@ -147,8 +147,8 @@ observable.addObserver(new TestObserver()); observable.addObserver(new TestObserver()); observable.deleteObservers(); - assertTrue("Failed to delete observers", - observable.countObservers() == 0); + assertEquals("Failed to delete observers", + 0, observable.countObservers()); } /** @@ -165,12 +165,12 @@ // Test for method void java.util.Observable.notifyObservers() observable.addObserver(observer = new TestObserver()); observable.notifyObservers(); - assertTrue("Notified when unchnaged", ((TestObserver) observer) - .updateCount() == 0); + assertEquals("Notified when unchnaged", 0, ((TestObserver) observer) + .updateCount()); ((TestObservable) observable).doChange(); observable.notifyObservers(); - assertTrue("Failed to notify", - ((TestObserver) observer).updateCount() == 1); + assertEquals("Failed to notify", + 1, ((TestObserver) observer).updateCount()); DeleteTestObserver observer1, observer2; observable.deleteObservers(); @@ -180,7 +180,7 @@ observable.notifyObservers(); assertTrue("Failed to notify all", observer1.updateCount() == 1 && observer2.updateCount() == 1); - assertTrue("Failed to delete all", observable.countObservers() == 0); + assertEquals("Failed to delete all", 0, observable.countObservers()); observable.addObserver(observer1 = new DeleteTestObserver(false)); observable.addObserver(observer2 = new DeleteTestObserver(false)); @@ -188,7 +188,7 @@ observable.notifyObservers(); assertTrue("Failed to notify all 2", observer1.updateCount() == 1 && observer2.updateCount() == 1); - assertTrue("Failed to delete all 2", observable.countObservers() == 0); + assertEquals("Failed to delete all 2", 0, observable.countObservers()); } /** @@ -200,12 +200,12 @@ Object obj; observable.addObserver(observer = new TestObserver()); observable.notifyObservers(); - assertTrue("Notified when unchanged", ((TestObserver) observer) - .updateCount() == 0); + assertEquals("Notified when unchanged", 0, ((TestObserver) observer) + .updateCount()); ((TestObservable) observable).doChange(); observable.notifyObservers(obj = new Object()); - assertTrue("Failed to notify", - ((TestObserver) observer).updateCount() == 1); + assertEquals("Failed to notify", + 1, ((TestObserver) observer).updateCount()); assertTrue("Failed to pass Object arg", ((TestObserver) observer).objv .elementAt(0).equals(obj)); } Index: modules/luni/src/test/java/tests/api/java/util/PropertyResourceBundleTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/util/PropertyResourceBundleTest.java.orig 2006-04-16 15:17:59.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/util/PropertyResourceBundleTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -44,7 +44,7 @@ keyCount++; } - assertTrue("Returned the wrong number of keys", keyCount == 2); + assertEquals("Returned the wrong number of keys", 2, keyCount); assertTrue("Returned the wrong keys", test.contains("p1") && test.contains("p2")); } 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 15:18:06.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/util/SimpleTimeZoneTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -58,7 +58,7 @@ .inDaylightTime(new GregorianCalendar(1998, Calendar.OCTOBER, 13).getTime()))); assertEquals("Incorrect TZ constructed", "TEST", st.getID()); - assertTrue("Incorrect TZ constructed", st.getRawOffset() == 1000); + assertEquals("Incorrect TZ constructed", 1000, st.getRawOffset()); assertTrue("Incorrect TZ constructed", st.useDaylightTime()); } @@ -79,7 +79,7 @@ .inDaylightTime(new GregorianCalendar(1998, Calendar.OCTOBER, 13).getTime()))); assertEquals("Incorrect TZ constructed", "TEST", st.getID()); - assertTrue("Incorrect TZ constructed", st.getRawOffset() == 1000); + assertEquals("Incorrect TZ constructed", 1000, st.getRawOffset()); assertTrue("Incorrect TZ constructed", st.useDaylightTime()); assertTrue("Incorrect TZ constructed", st.getDSTSavings() == 1000 * 60 * 60); @@ -135,18 +135,18 @@ // Test for method int java.util.SimpleTimeZone.getDSTSavings() st1 = new SimpleTimeZone(0, "TEST"); - assertTrue("Non-zero default daylight savings", - st1.getDSTSavings() == 0); + assertEquals("Non-zero default daylight savings", + 0, st1.getDSTSavings()); st1.setStartRule(0, 1, 1, 1); st1.setEndRule(11, 1, 1, 1); - assertTrue("Incorrect default daylight savings", - st1.getDSTSavings() == 3600000); + assertEquals("Incorrect default daylight savings", + 3600000, st1.getDSTSavings()); st1 = new SimpleTimeZone(-5 * 3600000, "EST", Calendar.APRIL, 1, -Calendar.SUNDAY, 2 * 3600000, Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * 3600000, 7200000); - assertTrue("Incorrect daylight savings from constructor", st1 - .getDSTSavings() == 7200000); + assertEquals("Incorrect daylight savings from constructor", 7200000, st1 + .getDSTSavings()); } @@ -258,7 +258,7 @@ st.setStartRule(0, 1, 1, 1); st.setEndRule(11, 1, 1, 1); st.setDSTSavings(1); - assertTrue("Daylight savings amount not set", st.getDSTSavings() == 1); + assertEquals("Daylight savings amount not set", 1, st.getDSTSavings()); } /** Index: modules/luni/src/test/java/tests/api/java/util/StackTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/util/StackTest.java.orig 2006-04-16 15:18:06.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/util/StackTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -27,7 +27,7 @@ */ public void test_Constructor() { // Test for method java.util.Stack() - assertTrue("Stack creation failed", s.size() == 0); + assertEquals("Stack creation failed", 0, s.size()); } /** @@ -133,29 +133,25 @@ s.push(item1); s.push(item2); s.push(item3); - assertTrue("Search returned incorrect value for equivalent object", s - .search(item1) == 3); - assertTrue("Search returned incorrect value for equal object", s - .search("Ichi") == 3); + assertEquals("Search returned incorrect value for equivalent object", 3, s + .search(item1)); + assertEquals("Search returned incorrect value for equal object", 3, s + .search("Ichi")); s.pop(); - assertTrue( - "Search returned incorrect value for equivalent object at top of stack", - s.search(item2) == 1); - assertTrue( - "Search returned incorrect value for equal object at top of stack", - s.search("Ni") == 1); + assertEquals("Search returned incorrect value for equivalent object at top of stack", + 1, s.search(item2)); + assertEquals("Search returned incorrect value for equal object at top of stack", + 1, s.search("Ni")); s.push(null); - assertTrue( - "Search returned incorrect value for search for null at top of stack", - s.search(null) == 1); + assertEquals("Search returned incorrect value for search for null at top of stack", + 1, s.search(null)); s.push("Shi"); - assertTrue("Search returned incorrect value for search for null", s - .search(null) == 2); + assertEquals("Search returned incorrect value for search for null", 2, s + .search(null)); s.pop(); s.pop(); - assertTrue( - "Search returned incorrect value for search for null--wanted -1", - s.search(null) == -1); + assertEquals("Search returned incorrect value for search for null--wanted -1", + -1, s.search(null)); } /** 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 15:18:06.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/util/StringTokenizerTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -61,7 +61,7 @@ // Test for method int java.util.StringTokenizer.countTokens() StringTokenizer st = new StringTokenizer("This is a test String"); - assertTrue("Incorrect token count returned", st.countTokens() == 5); + assertEquals("Incorrect token count returned", 5, st.countTokens()); } /** Index: modules/luni/src/test/java/tests/api/java/util/TimerTaskTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/util/TimerTaskTest.java.orig 2006-04-16 15:17:59.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/util/TimerTaskTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -103,9 +103,8 @@ Thread.sleep(500); } catch (InterruptedException e) { } - assertTrue( - "TimerTask.run() method should not be called after cancel()", - testTask.wasRun() == 0); + assertEquals("TimerTask.run() method should not be called after cancel()", + 0, testTask.wasRun()); t.cancel(); // Ensure cancelling a task which has already run returns true @@ -274,8 +273,8 @@ Thread.sleep(200); } catch (InterruptedException e) { } - assertTrue("TimerTask.run() method should not have been called", - testTask.wasRun() == 0); + assertEquals("TimerTask.run() method should not have been called", + 0, testTask.wasRun()); // Ensure a task is run t = new Timer(); @@ -285,8 +284,8 @@ Thread.sleep(400); } catch (InterruptedException e) { } - assertTrue("TimerTask.run() method not called after 200ms", - testTask.wasRun() == 1); + assertEquals("TimerTask.run() method not called after 200ms", + 1, testTask.wasRun()); t.cancel(); // Ensure a repeated execution task does just that Index: modules/luni/src/test/java/tests/api/java/util/TimerTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/util/TimerTest.java.orig 2006-04-16 15:17:59.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/util/TimerTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -103,8 +103,8 @@ } catch (InterruptedException e) { } } - assertTrue("TimerTask.run() method not called after 200ms", - testTask.wasRun() == 1); + assertEquals("TimerTask.run() method not called after 200ms", + 1, testTask.wasRun()); t.cancel(); } finally { if (t != null) @@ -129,8 +129,8 @@ } catch (InterruptedException e) { } } - assertTrue("TimerTask.run() method not called after 200ms", - testTask.wasRun() == 1); + assertEquals("TimerTask.run() method not called after 200ms", + 1, testTask.wasRun()); t.cancel(); } finally { if (t != null) @@ -169,8 +169,8 @@ } catch (InterruptedException e) { } } - assertTrue("TimerTask.run() method not called after 200ms", - testTask.wasRun() == 1); + assertEquals("TimerTask.run() method not called after 200ms", + 1, testTask.wasRun()); t.cancel(); synchronized (sync) { try { @@ -178,9 +178,8 @@ } catch (InterruptedException e) { } } - assertTrue( - "TimerTask.run() method should not have been called after cancel", - testTask.wasRun() == 1); + assertEquals("TimerTask.run() method should not have been called after cancel", + 1, testTask.wasRun()); // Ensure you can call cancel more than once t = new Timer(); @@ -192,8 +191,8 @@ } catch (InterruptedException e) { } } - assertTrue("TimerTask.run() method not called after 200ms", - testTask.wasRun() == 1); + assertEquals("TimerTask.run() method not called after 200ms", + 1, testTask.wasRun()); t.cancel(); t.cancel(); t.cancel(); @@ -203,9 +202,8 @@ } catch (InterruptedException e) { } } - assertTrue( - "TimerTask.run() method should not have been called after cancel", - testTask.wasRun() == 1); + assertEquals("TimerTask.run() method should not have been called after cancel", + 1, testTask.wasRun()); // Ensure that a call to cancel from within a timer ensures no more // run @@ -345,8 +343,8 @@ Thread.sleep(400); } catch (InterruptedException e) { } - assertTrue("TimerTask.run() method not called after 200ms", - testTask.wasRun() == 1); + assertEquals("TimerTask.run() method not called after 200ms", + 1, testTask.wasRun()); t.cancel(); // Ensure multiple tasks are run @@ -467,8 +465,8 @@ Thread.sleep(400); } catch (InterruptedException e) { } - assertTrue("TimerTask.run() method not called after 200ms", - testTask.wasRun() == 1); + assertEquals("TimerTask.run() method not called after 200ms", + 1, testTask.wasRun()); t.cancel(); // Ensure multiple tasks are run 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 15:18:06.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/util/TreeMapTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -109,7 +109,7 @@ public void test_clear() { // Test for method void java.util.TreeMap.clear() tm.clear(); - assertTrue("Cleared map returned non-zero size", tm.size() == 0); + assertEquals("Cleared map returned non-zero size", 0, tm.size()); } /** @@ -234,7 +234,7 @@ // Test for method java.util.SortedMap // java.util.TreeMap.headMap(java.lang.Object) Map head = tm.headMap("100"); - assertTrue("Returned map of incorrect size", head.size() == 3); + assertEquals("Returned map of incorrect size", 3, head.size()); assertTrue("Returned incorrect elements", head.containsKey("0") && head.containsValue(new Integer("1")) && head.containsKey("10")); @@ -303,7 +303,7 @@ */ public void test_size() { // Test for method int java.util.TreeMap.size() - assertTrue("Returned incorrect size", tm.size() == 1000); + assertEquals("Returned incorrect size", 1000, tm.size()); } /** @@ -314,7 +314,7 @@ // java.util.TreeMap.subMap(java.lang.Object, java.lang.Object) SortedMap subMap = tm.subMap(objArray[100].toString(), objArray[109] .toString()); - assertTrue("subMap is of incorrect size", subMap.size() == 9); + assertEquals("subMap is of incorrect size", 9, subMap.size()); for (int counter = 100; counter < 109; counter++) assertTrue("SubMap contains incorrect elements", subMap.get( objArray[counter].toString()).equals(objArray[counter])); @@ -326,9 +326,8 @@ } catch (IllegalArgumentException e) { result = 1; } - assertTrue( - "end key less than start key should throw IllegalArgumentException", - result == 1); + assertEquals("end key less than start key should throw IllegalArgumentException", + 1, result); } /** Index: modules/luni/src/test/java/tests/api/java/util/TreeSetTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/util/TreeSetTest.java.orig 2006-04-16 15:17:59.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/util/TreeSetTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -131,7 +131,7 @@ public void test_clear() { // Test for method void java.util.TreeSet.clear() ts.clear(); - assertTrue("Returned non-zero size after clear", ts.size() == 0); + assertEquals("Returned non-zero size after clear", 0, ts.size()); assertTrue("Found element in cleared set", !ts.contains(objArray[0])); } @@ -193,7 +193,7 @@ // Test for method java.util.SortedSet // java.util.TreeSet.headSet(java.lang.Object) Set s = ts.headSet(new Integer(100)); - assertTrue("Returned set of incorrect size", s.size() == 100); + assertEquals("Returned set of incorrect size", 100, s.size()); for (int i = 0; i < 100; i++) assertTrue("Returned incorrect set", s.contains(objArray[i])); } @@ -218,7 +218,7 @@ Set as = new HashSet(Arrays.asList(objArray)); while (i.hasNext()) as.remove(i.next()); - assertTrue("Returned incorrect iterator", as.size() == 0); + assertEquals("Returned incorrect iterator", 0, as.size()); } @@ -279,7 +279,7 @@ } catch (IllegalArgumentException e) { result = 1; } - assertTrue("end less than start should throw", result == 1); + assertEquals("end less than start should throw", 1, result); } /** @@ -289,7 +289,7 @@ // Test for method java.util.SortedSet // java.util.TreeSet.tailSet(java.lang.Object) Set s = ts.tailSet(new Integer(900)); - assertTrue("Returned set of incorrect size", s.size() == 100); + assertEquals("Returned set of incorrect size", 100, s.size()); for (int i = 900; i < objArray.length; i++) assertTrue("Returned incorrect set", s.contains(objArray[i])); } 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 15:18:06.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/util/VectorTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -51,8 +51,8 @@ new Support_ListTest("", tv.subList(50, 150)).runTest(); Vector v = new Vector(); - assertTrue("Vector creation failed", v.size() == 0); - assertTrue("Wrong capacity", v.capacity() == 10); + assertEquals("Vector creation failed", 0, v.size()); + assertEquals("Wrong capacity", 10, v.capacity()); } /** @@ -62,8 +62,8 @@ // Test for method java.util.Vector(int) Vector v = new Vector(100); - assertTrue("Vector creation failed", v.size() == 0); - assertTrue("Wrong capacity", v.capacity() == 100); + assertEquals("Vector creation failed", 0, v.size()); + assertEquals("Wrong capacity", 100, v.capacity()); } /** @@ -77,16 +77,16 @@ v.addElement(new Object()); v.addElement(new Object()); - assertTrue("Failed to inc capacity by proper amount", - v.capacity() == 12); + assertEquals("Failed to inc capacity by proper amount", + 12, v.capacity()); Vector grow = new Vector(3, -1); grow.addElement("one"); grow.addElement("two"); grow.addElement("three"); grow.addElement("four"); - assertTrue("Wrong size", grow.size() == 4); - assertTrue("Wrong capacity", grow.capacity() == 6); + assertEquals("Wrong size", 4, grow.size()); + assertEquals("Wrong capacity", 6, grow.capacity()); } /** @@ -115,14 +115,14 @@ tVector.add(45, o); assertTrue("Failed to add Object", tVector.get(45) == o); assertTrue("Failed to fix-up existing indices", tVector.get(46) == prev); - assertTrue("Wrong size after add", tVector.size() == 101); + assertEquals("Wrong size after add", 101, tVector.size()); prev = tVector.get(50); tVector.add(50, null); assertNull("Failed to add null", tVector.get(50)); assertTrue("Failed to fix-up existing indices after adding null", tVector.get(51) == prev); - assertTrue("Wrong size after add", tVector.size() == 102); + assertEquals("Wrong size after add", 102, tVector.size()); } /** @@ -133,11 +133,11 @@ Object o = new Object(); tVector.add(o); assertTrue("Failed to add Object", tVector.lastElement() == o); - assertTrue("Wrong size after add", tVector.size() == 101); + assertEquals("Wrong size after add", 101, tVector.size()); tVector.add(null); assertNull("Failed to add null", tVector.lastElement()); - assertTrue("Wrong size after add", tVector.size() == 102); + assertEquals("Wrong size after add", 102, tVector.size()); } /** @@ -246,7 +246,7 @@ // Test for method int java.util.Vector.capacity() Vector v = new Vector(9); - assertTrue("Incorrect capacity returned", v.capacity() == 9); + assertEquals("Incorrect capacity returned", 9, v.capacity()); } /** @@ -256,7 +256,7 @@ // Test for method void java.util.Vector.clear() Vector orgVector = vectorClone(tVector); tVector.clear(); - assertTrue("a) Cleared Vector has non-zero size", tVector.size() == 0); + assertEquals("a) Cleared Vector has non-zero size", 0, tVector.size()); Enumeration e = orgVector.elements(); while (e.hasMoreElements()) assertTrue("a) Cleared vector contained elements", !tVector @@ -264,7 +264,7 @@ tVector.add(null); tVector.clear(); - assertTrue("b) Cleared Vector has non-zero size", tVector.size() == 0); + assertEquals("b) Cleared Vector has non-zero size", 0, tVector.size()); e = orgVector.elements(); while (e.hasMoreElements()) assertTrue("b) Cleared vector contained elements", !tVector @@ -413,10 +413,10 @@ Vector v = new Vector(9); v.ensureCapacity(20); - assertTrue("ensureCapacity failed to set correct capacity", v - .capacity() == 20); + assertEquals("ensureCapacity failed to set correct capacity", 20, v + .capacity()); v = new Vector(100); - assertTrue("ensureCapacity reduced capacity", v.capacity() == 100); + assertEquals("ensureCapacity reduced capacity", 100, v.capacity()); } /** @@ -480,9 +480,9 @@ */ public void test_indexOfLjava_lang_Object() { // Test for method int java.util.Vector.indexOf(java.lang.Object) - assertTrue("Incorrect index returned", tVector.indexOf("Test 10") == 10); - assertTrue("Index returned for invalid Object", tVector - .indexOf("XXXXXXXXXXX") == -1); + assertEquals("Incorrect index returned", 10, tVector.indexOf("Test 10")); + assertEquals("Index returned for invalid Object", -1, tVector + .indexOf("XXXXXXXXXXX")); tVector.setElementAt(null, 20); tVector.setElementAt(null, 40); assertTrue("Incorrect indexOf returned for null: " @@ -587,7 +587,7 @@ for (int i = 0; i < 9; i++) v.addElement("Test"); v.addElement("z"); - assertTrue("Failed to return correct index", v.lastIndexOf("Test") == 8); + assertEquals("Failed to return correct index", 8, v.lastIndexOf("Test")); tVector.setElementAt(null, 20); tVector.setElementAt(null, 40); assertTrue("Incorrect lastIndexOf returned for null: " @@ -600,8 +600,8 @@ public void test_lastIndexOfLjava_lang_ObjectI() { // Test for method int java.util.Vector.lastIndexOf(java.lang.Object, // int) - assertTrue("Failed to find object", - tVector.lastIndexOf("Test 0", 0) == 0); + assertEquals("Failed to find object", + 0, tVector.lastIndexOf("Test 0", 0)); assertTrue("Found Object outside of index", (tVector.lastIndexOf( "Test 0", 10) > -1)); tVector.setElementAt(null, 20); @@ -623,15 +623,15 @@ tVector.remove(36); assertTrue("Contained element after remove", !tVector .contains("Test 36")); - assertTrue("Failed to decrement size after remove", - tVector.size() == 99); + assertEquals("Failed to decrement size after remove", + 99, tVector.size()); tVector.add(20, null); tVector.remove(19); assertNull("Didn't move null element over", tVector.get(19)); tVector.remove(19); assertTrue("Didn't remove null element", tVector.get(19) != null); - assertTrue("Failed to decrement size after removing null", tVector - .size() == 98); + assertEquals("Failed to decrement size after removing null", 98, tVector + .size()); } /** @@ -642,13 +642,13 @@ tVector.remove("Test 0"); assertTrue("Contained element after remove", !tVector .contains("Test 0")); - assertTrue("Failed to decrement size after remove", - tVector.size() == 99); + assertEquals("Failed to decrement size after remove", + 99, tVector.size()); tVector.add(null); tVector.remove(null); assertTrue("Contained null after remove", !tVector.contains(null)); - assertTrue("Failed to decrement size after removing null", tVector - .size() == 99); + assertEquals("Failed to decrement size after removing null", 99, tVector + .size()); } /** @@ -675,11 +675,11 @@ v.add(null); v.add("Boom"); v.removeAll(s); - assertTrue("Should not have removed any elements", v.size() == 3); + assertEquals("Should not have removed any elements", 3, v.size()); l = new LinkedList(); l.add(null); v.removeAll(l); - assertTrue("Should only have one element", v.size() == 1); + assertEquals("Should only have one element", 1, v.size()); assertEquals("Element should be 'Boom'", "Boom", v.firstElement()); } @@ -690,7 +690,7 @@ // Test for method void java.util.Vector.removeAllElements() Vector v = vectorClone(tVector); v.removeAllElements(); - assertTrue("Failed to remove all elements", v.size() == 0); + assertEquals("Failed to remove all elements", 0, v.size()); } /** @@ -718,7 +718,7 @@ // Test for method void java.util.Vector.removeElementAt(int) Vector v = vectorClone(tVector); v.removeElementAt(50); - assertTrue("Failed to remove element", v.indexOf("Test 50", 0) == -1); + assertEquals("Failed to remove element", -1, v.indexOf("Test 50", 0)); tVector.insertElementAt(null, 60); tVector.removeElementAt(60); assertTrue("Element at 60 should not be null after removal", tVector @@ -771,7 +771,7 @@ // Test for method void java.util.Vector.setSize(int) Vector v = vectorClone(tVector); v.setSize(10); - assertTrue("Failed to set size", v.size() == 10); + assertEquals("Failed to set size", 10, v.size()); } /** @@ -779,7 +779,7 @@ */ public void test_size() { // Test for method int java.util.Vector.size() - assertTrue("Returned incorrect size", tVector.size() == 100); + assertEquals("Returned incorrect size", 100, tVector.size()); final Vector v = new Vector(); v.addElement("initial"); @@ -814,7 +814,7 @@ public void test_subListII() { // Test for method java.util.List java.util.Vector.subList(int, int) List sl = tVector.subList(10, 25); - assertTrue("Returned sublist of incorrect size", sl.size() == 15); + assertEquals("Returned sublist of incorrect size", 15, sl.size()); for (int i = 10; i < 25; i++) assertTrue("Returned incorrect sublist", sl .contains(tVector.get(i))); @@ -875,7 +875,7 @@ Vector v = new Vector(10); v.addElement(new Object()); v.trimToSize(); - assertTrue("Failed to trim capacity", v.capacity() == 1); + assertEquals("Failed to trim capacity", 1, v.capacity()); } protected Vector vectorClone(Vector s) { Index: modules/luni/src/test/java/tests/api/java/util/WeakHashMapTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/util/WeakHashMapTest.java.orig 2006-04-16 15:18:06.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/util/WeakHashMapTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -203,7 +203,7 @@ System.gc(); System.runFinalization(); map.remove("nothing"); // Cause objects in queue to be removed - assertTrue("null key was removed", map.size() == 1); + assertEquals("null key was removed", 1, map.size()); } /** @@ -220,7 +220,7 @@ whm.remove(keyArray[25]) == valueArray[25]); assertNull("Remove returned incorrect value", whm.remove(keyArray[25])); - assertTrue("Size should be 99 after remove", whm.size() == 99); + assertEquals("Size should be 99 after remove", 99, whm.size()); } /** Index: modules/math/src/test/java/org/apache/harmony/tests/java/math/BigDecimalCompareTest.java =================================================================== --- modules/math/src/test/java/org/apache/harmony/tests/java/math/BigDecimalCompareTest.java.orig 2006-04-16 15:17:59.000000000 +0100 +++ modules/math/src/test/java/org/apache/harmony/tests/java/math/BigDecimalCompareTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -349,7 +349,7 @@ String a = "92948782094488478231212478987482988429808779810457634781384756794987"; int aScale = 41; BigDecimal aNumber = new BigDecimal(new BigInteger(a), aScale); - assertTrue("incorrect value", aNumber.signum() == 1); + assertEquals("incorrect value", 1, aNumber.signum()); } /** @@ -359,7 +359,7 @@ String a = "-92948782094488478231212478987482988429808779810457634781384756794987"; int aScale = 41; BigDecimal aNumber = new BigDecimal(new BigInteger(a), aScale); - assertTrue("incorrect value", aNumber.signum() == -1); + assertEquals("incorrect value", -1, aNumber.signum()); } /** @@ -369,6 +369,6 @@ String a = "0"; int aScale = 41; BigDecimal aNumber = new BigDecimal(new BigInteger(a), aScale); - assertTrue("incorrect value", aNumber.signum() == 0); + assertEquals("incorrect value", 0, aNumber.signum()); } } 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 15:18:06.000000000 +0100 +++ modules/math/src/test/java/org/apache/harmony/tests/java/math/BigDecimalConstructorsTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -67,7 +67,7 @@ BigInteger bA = new BigInteger(a); BigDecimal aNumber = new BigDecimal(bA); assertTrue("incorrect value", aNumber.unscaledValue().equals(bA)); - assertTrue("incorrect scale", aNumber.scale() == 0); + assertEquals("incorrect scale", 0, aNumber.scale()); } /** 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 15:18:06.000000000 +0100 +++ modules/math/src/test/java/org/apache/harmony/tests/java/math/BigDecimalScaleOperationsTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -93,7 +93,7 @@ BigDecimal aNumber = new BigDecimal(new BigInteger(a), aScale); BigDecimal bNumber = aNumber.setScale(newScale); assertTrue("incorrect scale", bNumber.scale() == newScale); - assertTrue("incorrect value", bNumber.compareTo(aNumber) == 0); + assertEquals("incorrect value", 0, bNumber.compareTo(aNumber)); } /** @@ -105,7 +105,7 @@ BigDecimal aNumber = new BigDecimal(a); BigDecimal bNumber = aNumber.setScale(newScale); assertTrue("incorrect scale", bNumber.scale() == newScale); - assertTrue("incorrect value", bNumber.compareTo(aNumber) == 0); + assertEquals("incorrect value", 0, bNumber.compareTo(aNumber)); } /** Index: modules/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerAddTest.java =================================================================== --- modules/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerAddTest.java.orig 2006-04-16 15:17:59.000000000 +0100 +++ modules/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerAddTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -45,7 +45,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -65,7 +65,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == -1); + assertEquals("incorrect sign", -1, result.signum()); } /** @@ -87,7 +87,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -109,7 +109,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == -1); + assertEquals("incorrect sign", -1, result.signum()); } /** @@ -131,7 +131,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == -1); + assertEquals("incorrect sign", -1, result.signum()); } /** @@ -153,7 +153,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -174,7 +174,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -195,7 +195,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -216,7 +216,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == -1); + assertEquals("incorrect sign", -1, result.signum()); } /** @@ -237,7 +237,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == -1); + assertEquals("incorrect sign", -1, result.signum()); } /** @@ -259,7 +259,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -281,7 +281,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == -1); + assertEquals("incorrect sign", -1, result.signum()); } /** @@ -303,7 +303,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == -1); + assertEquals("incorrect sign", -1, result.signum()); } /** @@ -325,7 +325,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -344,7 +344,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 0); + assertEquals("incorrect sign", 0, result.signum()); } /** @@ -364,7 +364,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -384,7 +384,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -404,7 +404,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 0); + assertEquals("incorrect sign", 0, result.signum()); } /** @@ -422,7 +422,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -440,7 +440,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -456,7 +456,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 0); + assertEquals("incorrect sign", 0, result.signum()); } /** @@ -472,7 +472,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -492,6 +492,6 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } } Index: modules/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerAndTest.java =================================================================== --- modules/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerAndTest.java.orig 2006-04-16 15:17:59.000000000 +0100 +++ modules/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerAndTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -45,7 +45,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 0); + assertEquals("incorrect sign", 0, result.signum()); } /** @@ -65,7 +65,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 0); + assertEquals("incorrect sign", 0, result.signum()); } /** @@ -85,7 +85,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 0); + assertEquals("incorrect sign", 0, result.signum()); } /** @@ -105,7 +105,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 0); + assertEquals("incorrect sign", 0, result.signum()); } /** @@ -125,7 +125,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 0); + assertEquals("incorrect sign", 0, result.signum()); } /** @@ -136,7 +136,7 @@ BigInteger bNumber = BigInteger.ONE; BigInteger result = aNumber.and(bNumber); assertTrue(result.equals(BigInteger.ZERO)); - assertTrue("incorrect sign", result.signum() == 0); + assertEquals("incorrect sign", 0, result.signum()); } /** @@ -147,7 +147,7 @@ BigInteger bNumber = BigInteger.ONE; BigInteger result = aNumber.and(bNumber); assertTrue(result.equals(BigInteger.ONE)); - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -167,7 +167,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -187,7 +187,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -207,7 +207,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -227,7 +227,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == -1); + assertEquals("incorrect sign", -1, result.signum()); } /** @@ -247,7 +247,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == -1); + assertEquals("incorrect sign", -1, result.signum()); } /** @@ -267,7 +267,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == -1); + assertEquals("incorrect sign", -1, result.signum()); } /** @@ -287,7 +287,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -307,7 +307,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -327,7 +327,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -347,7 +347,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -367,7 +367,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -387,7 +387,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -407,7 +407,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == -1); + assertEquals("incorrect sign", -1, result.signum()); } /** @@ -427,6 +427,6 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } } 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 15:18:06.000000000 +0100 +++ modules/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerCompareTest.java 2006-04-16 15:23:14.000000000 +0100 @@ -42,7 +42,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -59,7 +59,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -74,7 +74,7 @@ int bSign = 1; BigInteger aNumber = new BigInteger(aSign, aBytes); BigInteger bNumber = new BigInteger(bSign, bBytes); - assertTrue(aNumber.compareTo(bNumber) == 1); + assertEquals(1, aNumber.compareTo(bNumber)); } /** @@ -90,7 +90,7 @@ BigInteger aNumber = new BigInteger(aSign, aBytes); BigInteger bNumber = new BigInteger(bSign, bBytes); int result = aNumber.compareTo(bNumber); - assertTrue(aNumber.compareTo(bNumber) == -1); + assertEquals(-1, aNumber.compareTo(bNumber)); } /** @@ -104,7 +104,7 @@ int bSign = 1; BigInteger aNumber = new BigInteger(aSign, aBytes); BigInteger bNumber = new BigInteger(bSign, bBytes); - assertTrue(aNumber.compareTo(bNumber) == 0); + assertEquals(0, aNumber.compareTo(bNumber)); } /** @@ -119,7 +119,7 @@ int bSign = -1; BigInteger aNumber = new BigInteger(aSign, aBytes); BigInteger bNumber = new BigInteger(bSign, bBytes); - assertTrue(aNumber.compareTo(bNumber) == -1); + assertEquals(-1, aNumber.compareTo(bNumber)); } /** @@ -134,7 +134,7 @@ int bSign = -1; BigInteger aNumber = new BigInteger(aSign, aBytes); BigInteger bNumber = new BigInteger(bSign, bBytes); - assertTrue(aNumber.compareTo(bNumber) == 1); + assertEquals(1, aNumber.compareTo(bNumber)); } /** @@ -148,7 +148,7 @@ int bSign = -1; BigInteger aNumber = new BigInteger(aSign, aBytes); BigInteger bNumber = new BigInteger(bSign, bBytes); - assertTrue(aNumber.compareTo(bNumber) == 0); + assertEquals(0, aNumber.compareTo(bNumber)); } /** @@ -163,7 +163,7 @@ int bSign = -1; BigInteger aNumber = new BigInteger(aSign, aBytes); BigInteger bNumber = new BigInteger(bSign, bBytes); - assertTrue(aNumber.compareTo(bNumber) == 1); + assertEquals(1, aNumber.compareTo(bNumber)); } /** @@ -178,7 +178,7 @@ int bSign = 1; BigInteger aNumber = new BigInteger(aSign, aBytes); BigInteger bNumber = new BigInteger(bSign, bBytes); - assertTrue(aNumber.compareTo(bNumber) == -1); + assertEquals(-1, aNumber.compareTo(bNumber)); } /** @@ -191,7 +191,7 @@ BigInteger aNumber = new BigInteger(aSign, aBytes); BigInteger bNumber = BigInteger.ZERO; int result = aNumber.compareTo(bNumber); - assertTrue(aNumber.compareTo(bNumber) == 1); + assertEquals(1, aNumber.compareTo(bNumber)); } /** @@ -203,7 +203,7 @@ int bSign = 1; BigInteger aNumber = BigInteger.ZERO; BigInteger bNumber = new BigInteger(bSign, bBytes); - assertTrue(aNumber.compareTo(bNumber) == -1); + assertEquals(-1, aNumber.compareTo(bNumber)); } /** @@ -215,7 +215,7 @@ int aSign = -1; BigInteger aNumber = new BigInteger(aSign, aBytes); BigInteger bNumber = BigInteger.ZERO; - assertTrue(aNumber.compareTo(bNumber) == -1); + assertEquals(-1, aNumber.compareTo(bNumber)); } /** @@ -227,7 +227,7 @@ int bSign = -1; BigInteger aNumber = BigInteger.ZERO; BigInteger bNumber = new BigInteger(bSign, bBytes); - assertTrue(aNumber.compareTo(bNumber) == 1); + assertEquals(1, aNumber.compareTo(bNumber)); } /** @@ -237,7 +237,7 @@ public void testCompareToZeroZero() { BigInteger aNumber = BigInteger.ZERO; BigInteger bNumber = BigInteger.ZERO; - assertTrue(aNumber.compareTo(bNumber) == 0); + assertEquals(0, aNumber.compareTo(bNumber)); } /** @@ -286,7 +286,7 @@ int bSign = 1; BigInteger aNumber = new BigInteger(aSign, aBytes); Object bNumber = (Object)new BigInteger(bSign, bBytes); - assertTrue(aNumber.compareTo(bNumber) == -1); + assertEquals(-1, aNumber.compareTo(bNumber)); } /** @@ -359,7 +359,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -380,7 +380,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -401,7 +401,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -420,7 +420,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 0); + assertEquals("incorrect sign", 0, result.signum()); } /** @@ -441,7 +441,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -462,7 +462,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -483,7 +483,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -502,7 +502,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 0); + assertEquals("incorrect sign", 0, result.signum()); } /** @@ -519,7 +519,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == -1); + assertEquals("incorrect sign", -1, result.signum()); } /** @@ -536,7 +536,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -551,7 +551,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 0); + assertEquals("incorrect sign", 0, result.signum()); } /** @@ -561,7 +561,7 @@ byte aBytes[] = {12, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, 3, 91}; int aSign = 1; BigInteger aNumber = new BigInteger(aSign, aBytes); - assertTrue("incorrect sign", aNumber.signum() == 1); + assertEquals("incorrect sign", 1, aNumber.signum()); } /** @@ -571,7 +571,7 @@ byte aBytes[] = {12, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, 3, 91}; int aSign = -1; BigInteger aNumber = new BigInteger(aSign, aBytes); - assertTrue("incorrect sign", aNumber.signum() == -1); + assertEquals("incorrect sign", -1, aNumber.signum()); } /** @@ -579,6 +579,6 @@ */ public void testSignumZero() { BigInteger aNumber = BigInteger.ZERO; - assertTrue("incorrect sign", aNumber.signum() == 0); + assertEquals("incorrect sign", 0, aNumber.signum()); } } 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 15:18:06.000000000 +0100 +++ modules/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerConstructorsTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -57,7 +57,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", aNumber.signum() == 1); + assertEquals("incorrect sign", 1, aNumber.signum()); } /** @@ -73,7 +73,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", aNumber.signum() == 1); + assertEquals("incorrect sign", 1, aNumber.signum()); } /** @@ -89,7 +89,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", aNumber.signum() == 1); + assertEquals("incorrect sign", 1, aNumber.signum()); } /** @@ -105,7 +105,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", aNumber.signum() == 1); + assertEquals("incorrect sign", 1, aNumber.signum()); } /** @@ -121,7 +121,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", aNumber.signum() == -1); + assertEquals("incorrect sign", -1, aNumber.signum()); } /** @@ -137,7 +137,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", aNumber.signum() == -1); + assertEquals("incorrect sign", -1, aNumber.signum()); } /** @@ -153,7 +153,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", aNumber.signum() == -1); + assertEquals("incorrect sign", -1, aNumber.signum()); } /** @@ -169,7 +169,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", aNumber.signum() == -1); + assertEquals("incorrect sign", -1, aNumber.signum()); } /** @@ -184,7 +184,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", aNumber.signum() == 0); + assertEquals("incorrect sign", 0, aNumber.signum()); } /** @@ -232,7 +232,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", aNumber.signum() == 1); + assertEquals("incorrect sign", 1, aNumber.signum()); } /** @@ -250,7 +250,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", aNumber.signum() == 1); + assertEquals("incorrect sign", 1, aNumber.signum()); } /** @@ -267,7 +267,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", aNumber.signum() == 1); + assertEquals("incorrect sign", 1, aNumber.signum()); } /** @@ -285,7 +285,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", aNumber.signum() == 1); + assertEquals("incorrect sign", 1, aNumber.signum()); } /** @@ -303,7 +303,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", aNumber.signum() == 1); + assertEquals("incorrect sign", 1, aNumber.signum()); } /** @@ -321,7 +321,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", aNumber.signum() == 1); + assertEquals("incorrect sign", 1, aNumber.signum()); } /** @@ -339,7 +339,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", aNumber.signum() == 1); + assertEquals("incorrect sign", 1, aNumber.signum()); } /** @@ -357,7 +357,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", aNumber.signum() == -1); + assertEquals("incorrect sign", -1, aNumber.signum()); } /** @@ -375,7 +375,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", aNumber.signum() == -1); + assertEquals("incorrect sign", -1, aNumber.signum()); } /** @@ -392,7 +392,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", aNumber.signum() == -1); + assertEquals("incorrect sign", -1, aNumber.signum()); } /** @@ -410,7 +410,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", aNumber.signum() == -1); + assertEquals("incorrect sign", -1, aNumber.signum()); } /** @@ -428,7 +428,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", aNumber.signum() == -1); + assertEquals("incorrect sign", -1, aNumber.signum()); } /** @@ -446,7 +446,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", aNumber.signum() == -1); + assertEquals("incorrect sign", -1, aNumber.signum()); } /** @@ -464,7 +464,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", aNumber.signum() == -1); + assertEquals("incorrect sign", -1, aNumber.signum()); } /** @@ -481,7 +481,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", aNumber.signum() == 0); + assertEquals("incorrect sign", 0, aNumber.signum()); } /** @@ -498,7 +498,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", aNumber.signum() == 0); + assertEquals("incorrect sign", 0, aNumber.signum()); } /** @@ -515,7 +515,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", aNumber.signum() == 0); + assertEquals("incorrect sign", 0, aNumber.signum()); } /** @@ -532,7 +532,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", aNumber.signum() == 0); + assertEquals("incorrect sign", 0, aNumber.signum()); } /** @@ -549,7 +549,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", aNumber.signum() == 0); + assertEquals("incorrect sign", 0, aNumber.signum()); } /** @@ -566,7 +566,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", aNumber.signum() == 0); + assertEquals("incorrect sign", 0, aNumber.signum()); } /** @@ -639,7 +639,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", aNumber.signum() == 1); + assertEquals("incorrect sign", 1, aNumber.signum()); } /** @@ -655,7 +655,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", aNumber.signum() == 1); + assertEquals("incorrect sign", 1, aNumber.signum()); } /** @@ -671,7 +671,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", aNumber.signum() == 1); + assertEquals("incorrect sign", 1, aNumber.signum()); } /** @@ -687,7 +687,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", aNumber.signum() == 1); + assertEquals("incorrect sign", 1, aNumber.signum()); } /** @@ -703,7 +703,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", aNumber.signum() == 1); + assertEquals("incorrect sign", 1, aNumber.signum()); } /** @@ -719,7 +719,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", aNumber.signum() == -1); + assertEquals("incorrect sign", -1, aNumber.signum()); } /** @@ -735,7 +735,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", aNumber.signum() == 0); + assertEquals("incorrect sign", 0, aNumber.signum()); } /** Index: modules/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerConvertTest.java =================================================================== --- modules/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerConvertTest.java.orig 2006-04-16 15:17:59.000000000 +0100 +++ modules/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerConvertTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -666,7 +666,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", aNumber.signum() == 1); + assertEquals("incorrect sign", 1, aNumber.signum()); } /** @@ -681,7 +681,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", aNumber.signum() == -1); + assertEquals("incorrect sign", -1, aNumber.signum()); } /** @@ -696,7 +696,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", aNumber.signum() == 1); + assertEquals("incorrect sign", 1, aNumber.signum()); } /** @@ -711,7 +711,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", aNumber.signum() == -1); + assertEquals("incorrect sign", -1, aNumber.signum()); } /** @@ -726,7 +726,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", aNumber.signum() == 1); + assertEquals("incorrect sign", 1, aNumber.signum()); } /** @@ -742,7 +742,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", aNumber.signum() == 1); + assertEquals("incorrect sign", 1, aNumber.signum()); } /** @@ -757,7 +757,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", aNumber.signum() == -1); + assertEquals("incorrect sign", -1, aNumber.signum()); } /** @@ -773,7 +773,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", aNumber.signum() == -1); + assertEquals("incorrect sign", -1, aNumber.signum()); } /** * valueOf (long val): convert a zero long value to a BigInteger. @@ -787,6 +787,6 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", aNumber.signum() == 0); + assertEquals("incorrect sign", 0, aNumber.signum()); } } 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 15:18:06.000000000 +0100 +++ modules/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerDivideTest.java 2006-04-16 15:23:14.000000000 +0100 @@ -79,7 +79,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -99,7 +99,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == -1); + assertEquals("incorrect sign", -1, result.signum()); } /** @@ -120,7 +120,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 0); + assertEquals("incorrect sign", 0, result.signum()); } /** @@ -141,7 +141,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 0); + assertEquals("incorrect sign", 0, result.signum()); } /** @@ -161,7 +161,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -181,7 +181,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == -1); + assertEquals("incorrect sign", -1, result.signum()); } /** @@ -201,7 +201,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == -1); + assertEquals("incorrect sign", -1, result.signum()); } /** @@ -221,7 +221,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -241,7 +241,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 0); + assertEquals("incorrect sign", 0, result.signum()); } /** @@ -259,7 +259,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 0); + assertEquals("incorrect sign", 0, result.signum()); } /** @@ -277,7 +277,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -293,7 +293,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -313,7 +313,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -333,7 +333,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -354,7 +354,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -374,7 +374,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == -1); + assertEquals("incorrect sign", -1, result.signum()); } /** @@ -394,7 +394,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == -1); + assertEquals("incorrect sign", -1, result.signum()); } /** @@ -432,7 +432,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 0); + assertEquals("incorrect sign", 0, result.signum()); } /** @@ -452,7 +452,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -472,7 +472,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == -1); + assertEquals("incorrect sign", -1, result.signum()); } /** @@ -493,7 +493,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -514,7 +514,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == -1); + assertEquals("incorrect sign", -1, result.signum()); } /** @@ -534,7 +534,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -554,7 +554,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -574,7 +574,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -600,13 +600,13 @@ fail("Incorrect quotation"); } } - assertTrue(result[0].signum() == -1); + assertEquals(-1, result[0].signum()); resBytes = result[1].toByteArray(); for(int i = 0; i < resBytes.length; i++) { if (resBytes[i] != rBytes[1][i]) { fail("Incorrect remainder"); } - assertTrue(result[1].signum() == -1); + assertEquals(-1, result[1].signum()); } } @@ -645,7 +645,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -665,6 +665,6 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } } 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 15:18:06.000000000 +0100 +++ modules/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerModPowTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -69,7 +69,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -92,7 +92,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -148,7 +148,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -168,7 +168,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -188,7 +188,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -206,7 +206,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -226,7 +226,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -246,7 +246,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -264,7 +264,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -279,7 +279,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 0); + assertEquals("incorrect sign", 0, result.signum()); } /** @@ -299,7 +299,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -319,6 +319,6 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } } 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 15:18:06.000000000 +0100 +++ modules/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerMultiplyTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -45,7 +45,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -66,7 +66,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == -1); + assertEquals("incorrect sign", -1, result.signum()); } /** @@ -88,7 +88,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -110,7 +110,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -133,7 +133,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == -1); + assertEquals("incorrect sign", -1, result.signum()); } /** @@ -156,7 +156,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == -1); + assertEquals("incorrect sign", -1, result.signum()); } /** @@ -176,7 +176,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 0); + assertEquals("incorrect sign", 0, result.signum()); } /** @@ -194,7 +194,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 0); + assertEquals("incorrect sign", 0, result.signum()); } /** @@ -212,7 +212,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -230,7 +230,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == -1); + assertEquals("incorrect sign", -1, result.signum()); } /** @@ -250,7 +250,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == -1); + assertEquals("incorrect sign", -1, result.signum()); } /** @@ -270,7 +270,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -307,7 +307,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == -1); + assertEquals("incorrect sign", -1, result.signum()); } /** @@ -327,7 +327,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -345,7 +345,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -366,7 +366,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -384,6 +384,6 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } } Index: modules/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerNotTest.java =================================================================== --- modules/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerNotTest.java.orig 2006-04-16 15:17:59.000000000 +0100 +++ modules/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerNotTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -45,7 +45,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -65,7 +65,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -85,7 +85,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -105,7 +105,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == -1); + assertEquals("incorrect sign", -1, result.signum()); } /** @@ -120,7 +120,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == -1); + assertEquals("incorrect sign", -1, result.signum()); } /** @@ -135,7 +135,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == -1); + assertEquals("incorrect sign", -1, result.signum()); } /** @@ -152,7 +152,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == -1); + assertEquals("incorrect sign", -1, result.signum()); } /** @@ -169,7 +169,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -187,6 +187,6 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == -1); + assertEquals("incorrect sign", -1, result.signum()); } } \ No newline at end of file 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 15:18:06.000000000 +0100 +++ modules/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerOperateBitsTest.java 2006-04-16 15:23:14.000000000 +0100 @@ -34,7 +34,7 @@ */ public void testBitCountZero() { BigInteger aNumber = new BigInteger("0"); - assertTrue(aNumber.bitCount() == 0); + assertEquals(0, aNumber.bitCount()); } /** @@ -42,7 +42,7 @@ */ public void testBitCountNeg() { BigInteger aNumber = new BigInteger("-12378634756382937873487638746283767238657872368748726875"); - assertTrue(aNumber.bitCount() == 87); + assertEquals(87, aNumber.bitCount()); } /** @@ -50,7 +50,7 @@ */ public void testBitCountPos() { BigInteger aNumber = new BigInteger("12378634756343564757582937873487638746283767238657872368748726875"); - assertTrue(aNumber.bitCount() == 107); + assertEquals(107, aNumber.bitCount()); } /** @@ -58,7 +58,7 @@ */ public void testBitLengthZero() { BigInteger aNumber = new BigInteger("0"); - assertTrue(aNumber.bitLength() == 0); + assertEquals(0, aNumber.bitLength()); } /** @@ -68,7 +68,7 @@ byte aBytes[] = {12, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, 3, 91}; int aSign = 1; BigInteger aNumber = new BigInteger(aSign, aBytes); - assertTrue(aNumber.bitLength() == 108); + assertEquals(108, aNumber.bitLength()); } /** @@ -78,7 +78,7 @@ byte aBytes[] = {-128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26}; int aSign = 1; BigInteger aNumber = new BigInteger(aSign, aBytes); - assertTrue(aNumber.bitLength() == 96); + assertEquals(96, aNumber.bitLength()); } /** @@ -88,7 +88,7 @@ byte aBytes[] = {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; int aSign = 1; BigInteger aNumber = new BigInteger(aSign, aBytes); - assertTrue(aNumber.bitLength() == 81); + assertEquals(81, aNumber.bitLength()); } /** @@ -98,7 +98,7 @@ byte aBytes[] = {12, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26, 3, 91}; int aSign = -1; BigInteger aNumber = new BigInteger(aSign, aBytes); - assertTrue(aNumber.bitLength() == 108); + assertEquals(108, aNumber.bitLength()); } /** @@ -108,7 +108,7 @@ byte aBytes[] = {-128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26}; int aSign = -1; BigInteger aNumber = new BigInteger(aSign, aBytes); - assertTrue(aNumber.bitLength() == 96); + assertEquals(96, aNumber.bitLength()); } /** @@ -118,7 +118,7 @@ byte aBytes[] = {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; int aSign = -1; BigInteger aNumber = new BigInteger(aSign, aBytes); - assertTrue(aNumber.bitLength() == 80); + assertEquals(80, aNumber.bitLength()); } /** @@ -152,7 +152,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 0); + assertEquals("incorrect sign", 0, result.signum()); } /** @@ -170,7 +170,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 0); + assertEquals("incorrect sign", 0, result.signum()); } /** @@ -188,7 +188,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == -1); + assertEquals("incorrect sign", -1, result.signum()); } /** @@ -206,7 +206,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == -1); + assertEquals("incorrect sign", -1, result.signum()); } /** @@ -263,7 +263,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == -1); + assertEquals("incorrect sign", -1, result.signum()); } /** @@ -281,7 +281,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == -1); + assertEquals("incorrect sign", -1, result.signum()); } /** @@ -299,7 +299,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -317,7 +317,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -335,7 +335,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -353,7 +353,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -371,7 +371,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -389,7 +389,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -407,7 +407,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -425,7 +425,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == -1); + assertEquals("incorrect sign", -1, result.signum()); } /** @@ -459,7 +459,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -477,7 +477,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue("incorrect value", resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -495,7 +495,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue("incorrect value", resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -513,7 +513,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == -1); + assertEquals("incorrect sign", -1, result.signum()); } /** @@ -531,7 +531,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -549,7 +549,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == -1); + assertEquals("incorrect sign", -1, result.signum()); } /** @@ -567,7 +567,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == -1); + assertEquals("incorrect sign", -1, result.signum()); } /** @@ -625,7 +625,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == -1); + assertEquals("incorrect sign", -1, result.signum()); } /** @@ -643,7 +643,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == -1); + assertEquals("incorrect sign", -1, result.signum()); } /** @@ -661,7 +661,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -679,7 +679,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -697,7 +697,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -715,7 +715,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -749,7 +749,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -767,7 +767,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -785,7 +785,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -803,7 +803,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -821,7 +821,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -839,7 +839,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -857,7 +857,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -875,7 +875,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -893,7 +893,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -911,7 +911,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == -1); + assertEquals("incorrect sign", -1, result.signum()); } /** @@ -929,7 +929,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == -1); + assertEquals("incorrect sign", -1, result.signum()); } /** @@ -947,7 +947,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == -1); + assertEquals("incorrect sign", -1, result.signum()); } /** @@ -1003,7 +1003,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == -1); + assertEquals("incorrect sign", -1, result.signum()); } /** @@ -1021,7 +1021,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == -1); + assertEquals("incorrect sign", -1, result.signum()); } /** @@ -1032,7 +1032,7 @@ public void testSetBitBug1331() { BigInteger result = BigInteger.valueOf(0L).setBit(191); assertEquals("incorrect value", "3138550867693340381917894711603833208051177722232017256448", result.toString()); - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -1050,7 +1050,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -1068,7 +1068,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -1086,7 +1086,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -1104,7 +1104,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -1122,7 +1122,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == -1); + assertEquals("incorrect sign", -1, result.signum()); } /** @@ -1140,7 +1140,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -1158,7 +1158,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -1176,7 +1176,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -1194,7 +1194,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -1212,7 +1212,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 0); + assertEquals("incorrect sign", 0, result.signum()); } /** @@ -1232,7 +1232,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == -1); + assertEquals("incorrect sign", -1, result.signum()); } /** @@ -1252,7 +1252,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == -1); + assertEquals("incorrect sign", -1, result.signum()); } /** @@ -1272,7 +1272,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == -1); + assertEquals("incorrect sign", -1, result.signum()); } /** @@ -1292,7 +1292,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == -1); + assertEquals("incorrect sign", -1, result.signum()); } /** Index: modules/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerOrTest.java =================================================================== --- modules/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerOrTest.java.orig 2006-04-16 15:17:59.000000000 +0100 +++ modules/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerOrTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -45,7 +45,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -65,7 +65,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == -1); + assertEquals("incorrect sign", -1, result.signum()); } /** @@ -85,7 +85,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -105,7 +105,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == -1); + assertEquals("incorrect sign", -1, result.signum()); } /** @@ -125,7 +125,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 0); + assertEquals("incorrect sign", 0, result.signum()); } /** @@ -145,7 +145,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -165,7 +165,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -185,7 +185,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -205,7 +205,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -225,7 +225,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == 1); + assertEquals("incorrect sign", 1, result.signum()); } /** @@ -245,7 +245,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == -1); + assertEquals("incorrect sign", -1, result.signum()); } /** @@ -265,7 +265,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == -1); + assertEquals("incorrect sign", -1, result.signum()); } /** @@ -285,7 +285,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == -1); + assertEquals("incorrect sign", -1, result.signum()); } /** @@ -305,7 +305,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == -1); + assertEquals("incorrect sign", -1, result.signum()); } /** @@ -325,7 +325,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == -1); + assertEquals("incorrect sign", -1, result.signum()); } /** @@ -345,7 +345,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == -1); + assertEquals("incorrect sign", -1, result.signum()); } /** @@ -365,7 +365,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == -1); + assertEquals("incorrect sign", -1, result.signum()); } /** @@ -385,7 +385,7 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == -1); + assertEquals("incorrect sign", -1, result.signum()); } /** @@ -405,6 +405,6 @@ for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } - assertTrue("incorrect sign", result.signum() == -1); + assertEquals("incorrect sign", -1, result.signum()); } } 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 15:18:06.000000000 +0100 +++ modules/math/src/test/java/tests/api/java/math/BigDecimalTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -58,20 +58,18 @@ assertTrue("the string representation of this value is not correct: " + big, big.toString().equals("0.0000000000012345")); big = new BigDecimal(-12345E-3); - assertTrue("the double representation is not correct", big - .doubleValue() == -12.345); + assertEquals("the double representation is not correct", -12.345, big + .doubleValue()); big = new BigDecimal(5.1234567897654321e138); assertTrue("the double representation is not correct", big .doubleValue() == 5.1234567897654321E138 && big.scale() == 0); big = new BigDecimal(0.1); - assertTrue( - "the double representation of 0.1 bigDecimal is not correct", - big.doubleValue() == 0.1); + assertEquals("the double representation of 0.1 bigDecimal is not correct", + 0.1, big.doubleValue()); big = new BigDecimal(0.00345); - assertTrue( - "the double representation of 0.00345 bigDecimal is not correct", - big.doubleValue() == 0.00345); + assertEquals("the double representation of 0.00345 bigDecimal is not correct", + 0.00345, big.doubleValue()); } @@ -97,9 +95,8 @@ } catch (NumberFormatException e) { r = 1; } - assertTrue( - "constructor failed to catch invalid character in BigDecimal(string)", - r == 0); + assertEquals("constructor failed to catch invalid character in BigDecimal(string)", + 0, r); } /** @@ -182,14 +179,14 @@ public void test_compareToLjava_math_BigDecimal() { BigDecimal comp1 = new BigDecimal("1.00"); BigDecimal comp2 = new BigDecimal(1.000000D); - assertTrue("1.00 and 1.000000 should be equal", - comp1.compareTo(comp2) == 0); + assertEquals("1.00 and 1.000000 should be equal", + 0, comp1.compareTo(comp2)); BigDecimal comp3 = new BigDecimal("1.02"); - assertTrue("1.02 should be bigger than 1.00", - comp3.compareTo(comp1) == 1); + assertEquals("1.02 should be bigger than 1.00", + 1, comp3.compareTo(comp1)); BigDecimal comp4 = new BigDecimal(0.98D); - assertTrue("0.98 should be less than 1.00", - comp4.compareTo(comp1) == -1); + assertEquals("0.98 should be less than 1.00", + -1, comp4.compareTo(comp1)); } /** @@ -198,15 +195,15 @@ public void test_compareToLjava_lang_Object() { BigDecimal comp1 = new BigDecimal("23456"); BigDecimal comp2 = new BigDecimal(23456D); - assertTrue("23456 and 23456 should be equal", - comp1.compareTo(comp2) == 0); + assertEquals("23456 and 23456 should be equal", + 0, comp1.compareTo(comp2)); int r = 0; try { comp1.compareTo("23456"); } catch (ClassCastException e) { r = 1; } - assertTrue("ClassCastException is not caught", r == 1); + assertEquals("ClassCastException is not caught", 1, r); } /** @@ -233,7 +230,7 @@ } catch (ArithmeticException e) { r = 1; } - assertTrue("divide by zero is not caught", r == 1); + assertEquals("divide by zero is not caught", 1, r); } /** @@ -258,7 +255,7 @@ } catch (ArithmeticException e) { r = 1; } - assertTrue("divide by zero is not caught", r == 1); + assertEquals("divide by zero is not caught", 1, r); } /** @@ -378,17 +375,17 @@ */ public void test_intValue() { BigDecimal int1 = new BigDecimal(value, 3); - assertTrue("the int value of 12345.908 is not 12345", - int1.intValue() == 12345); + assertEquals("the int value of 12345.908 is not 12345", + 12345, int1.intValue()); int1 = new BigDecimal("1.99"); - assertTrue("the int value of 1.99 is not 1", int1.intValue() == 1); + assertEquals("the int value of 1.99 is not 1", 1, int1.intValue()); int1 = new BigDecimal("23423419083091823091283933"); // ran JDK and found representation for the above was -249268259 - assertTrue("the int value of 23423419083091823091283933 is wrong", int1 - .intValue() == -249268259); + assertEquals("the int value of 23423419083091823091283933 is wrong", -249268259, int1 + .intValue()); int1 = new BigDecimal(-1235D); - assertTrue("the int value of -1235 is not -1235", - int1.intValue() == -1235); + assertEquals("the int value of -1235 is not -1235", + -1235, int1.intValue()); } /** @@ -396,17 +393,16 @@ */ public void test_longValue() { BigDecimal long1 = new BigDecimal(value2.negate(), 0); - assertTrue("the long value of 12334560000 is not 12334560000", long1 - .longValue() == -12334560000L); + assertEquals("the long value of 12334560000 is not 12334560000", -12334560000L, long1 + .longValue()); long1 = new BigDecimal(-1345.348E-123D); - assertTrue("the long value of -1345.348E-123D is not zero", long1 - .longValue() == 0); + assertEquals("the long value of -1345.348E-123D is not zero", 0, long1 + .longValue()); long1 = new BigDecimal("31323423423419083091823091283933"); // ran JDK and found representation for the above was // -5251313250005125155 - assertTrue( - "the long value of 31323423423419083091823091283933 is wrong", - long1.longValue() == -5251313250005125155L); + assertEquals("the long value of 31323423423419083091823091283933 is wrong", + -5251313250005125155L, long1.longValue()); } /** @@ -558,22 +554,22 @@ */ public void test_scale() { BigDecimal scale1 = new BigDecimal(value2, 8); - assertTrue("the scale of the number 123.34560000 is wrong", scale1 - .scale() == 8); + assertEquals("the scale of the number 123.34560000 is wrong", 8, scale1 + .scale()); BigDecimal scale2 = new BigDecimal("29389."); - assertTrue("the scale of the number 29389. is wrong", - scale2.scale() == 0); + assertEquals("the scale of the number 29389. is wrong", + 0, scale2.scale()); BigDecimal scale3 = new BigDecimal(3.374E13); - assertTrue("the scale of the number 3.374E13 is wrong", - scale3.scale() == 0); + assertEquals("the scale of the number 3.374E13 is wrong", + 0, scale3.scale()); BigDecimal scale4 = new BigDecimal(-3.45E-203); // note the scale is calculated as 15 digits of 345000.... + exponent - // 1. -1 for the 3 assertTrue("the scale of the number -3.45E-203 is wrong: " + scale4.scale(), scale4.scale() == 205); scale4 = new BigDecimal(-345.4E-200); - assertTrue("the scale of the number -345.4E-200 is wrong", scale4 - .scale() == 201); + assertEquals("the scale of the number -345.4E-200 is wrong", 201, scale4 + .scale()); } /** @@ -593,9 +589,8 @@ } catch (ArithmeticException e) { r = 1; } - assertTrue( - "arithmetic Exception not caught as a result of loosing precision", - r == 1); + assertEquals("arithmetic Exception not caught as a result of loosing precision", + 1, r); } /** @@ -604,14 +599,14 @@ public void test_setScaleII() { BigDecimal setScale1 = new BigDecimal(2.323E102); BigDecimal setScale2 = setScale1.setScale(4); - assertTrue("the number 2.323E102 after setting scale is wrong", - setScale2.scale() == 4); + assertEquals("the number 2.323E102 after setting scale is wrong", + 4, setScale2.scale()); assertTrue("the resentation of the number 2.323E102 is wrong", - setScale2.doubleValue() == 2.323E102); + setScale2.doubleValue() == 2.323E102); setScale1 = new BigDecimal(-1.253E-12); setScale2 = setScale1.setScale(17, BigDecimal.ROUND_CEILING); - assertTrue("the number -1.253E-12 after setting scale is wrong", - setScale2.scale() == 17); + assertEquals("the number -1.253E-12 after setting scale is wrong", + 17, setScale2.scale()); assertEquals("the representation of the number -1.253E-12 after setting scale is wrong", "-0.00000000000125300", setScale2.toString()); @@ -710,8 +705,8 @@ } catch (ArithmeticException e) { r = 1; } - assertTrue("arithmetic Exception not caught for round unnecessary", - r == 1); + assertEquals("arithmetic Exception not caught for round unnecessary", + 1, r); // testing rounding Mode ROUND_UP setScale1 = new BigDecimal("100000.374"); @@ -733,9 +728,8 @@ } catch (IllegalArgumentException e) { r = 1; } - assertTrue( - "IllegalArgumentException is not caught for wrong rounding mode", - r == 1); + assertEquals("IllegalArgumentException is not caught for wrong rounding mode", + 1, r); } /** @@ -743,12 +737,12 @@ */ public void test_signum() { BigDecimal sign = new BigDecimal(123E-104); - assertTrue("123E-104 is not positive in signum()", sign.signum() == 1); + assertEquals("123E-104 is not positive in signum()", 1, sign.signum()); sign = new BigDecimal("-1234.3959"); - assertTrue("-1234.3959 is not negative in signum()", - sign.signum() == -1); + assertEquals("-1234.3959 is not negative in signum()", + -1, sign.signum()); sign = new BigDecimal(000D); - assertTrue("000D is not zero in signum()", sign.signum() == 0); + assertEquals("000D is not zero in signum()", 0, sign.signum()); } /** 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 15:18:06.000000000 +0100 +++ modules/math/src/test/java/tests/api/java/math/BigIntegerTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -231,7 +231,7 @@ public void test_compareToLjava_math_BigInteger() { assertTrue("Smaller number returned >= 0", one.compareTo(two) < 0); assertTrue("Larger number returned >= 0", two.compareTo(one) > 0); - assertTrue("Equal numbers did not return 0", one.compareTo(one) == 0); + assertEquals("Equal numbers did not return 0", 0, one.compareTo(one)); assertTrue("Neg number messed things up", two.negate().compareTo(one) < 0); } @@ -244,8 +244,8 @@ one.compareTo((Object) two) < 0); assertTrue("Larger number returned >= 0", two.compareTo((Object) one) > 0); - assertTrue("Equal numbers did not return 0", one - .compareTo((Object) one) == 0); + assertEquals("Equal numbers did not return 0", 0, one + .compareTo((Object) one)); assertTrue("Neg number messed things up", two.negate().compareTo( (Object) one) < 0); try { @@ -261,18 +261,18 @@ * @tests java.math.BigInteger#intValue() */ public void test_intValue() { - assertTrue("Incorrect intValue for 2**70", - twoToTheSeventy.intValue() == 0); - assertTrue("Incorrect intValue for 2", two.intValue() == 2); + assertEquals("Incorrect intValue for 2**70", + 0, twoToTheSeventy.intValue()); + assertEquals("Incorrect intValue for 2", 2, two.intValue()); } /** * @tests java.math.BigInteger#longValue() */ public void test_longValue() { - assertTrue("Incorrect longValue for 2**70", - twoToTheSeventy.longValue() == 0); - assertTrue("Incorrect longValue for 2", two.longValue() == 2); + assertEquals("Incorrect longValue for 2**70", + 0, twoToTheSeventy.longValue()); + assertEquals("Incorrect longValue for 2", 2, two.longValue()); } /** @@ -351,10 +351,10 @@ * @tests java.math.BigInteger#signum() */ public void test_signum() { - assertTrue("Wrong positive signum", two.signum() == 1); - assertTrue("Wrong zero signum", zero.signum() == 0); - assertTrue("Wrong neg zero signum", zero.negate().signum() == 0); - assertTrue("Wrong neg signum", two.negate().signum() == -1); + assertEquals("Wrong positive signum", 1, two.signum()); + assertEquals("Wrong zero signum", 0, zero.signum()); + assertEquals("Wrong neg zero signum", 0, zero.negate().signum()); + assertEquals("Wrong neg signum", -1, two.negate().signum()); } /** @@ -478,7 +478,7 @@ assertTrue("e==f", e.equals(f)); e = e.shiftRight(1); assertTrue(">>1 == /2", f.subtract(one).divide(two).equals(e)); - assertTrue("e negative", e.signum() == -1); + assertEquals("e negative", -1, e.signum()); assertTrue("b >> i", b.shiftRight(i).equals(one)); assertTrue("b >> i+1", b.shiftRight(i + 1).equals(zero)); @@ -522,7 +522,7 @@ assertTrue("c==d", c.equals(d)); c = c.shiftLeft(1); assertTrue("<<1 == *2 negative", d.multiply(two).equals(c)); - assertTrue("c negative", c.signum() == -1); + assertEquals("c negative", -1, c.signum()); assertTrue("d >> i == minusOne", d.shiftRight(i).equals(minusOne)); } } 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 15:18:06.000000000 +0100 +++ modules/security/src/test/java/common/java/security/cert/LDAPCertStoreParametersTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -61,7 +61,7 @@ public final void testLDAPCertStoreParameters02() { LDAPCertStoreParameters cp = new LDAPCertStoreParameters(); assertEquals("host", "localhost", cp.getServerName()); - assertTrue("port", cp.getPort() == 389); + assertEquals("port", 389, cp.getPort()); } /** @@ -84,7 +84,7 @@ String serverName = "myhost"; LDAPCertStoreParameters cp = new LDAPCertStoreParameters(serverName); assertTrue("host", serverName.equals(cp.getServerName())); - assertTrue("port", cp.getPort() == 389); + assertEquals("port", 389, cp.getPort()); } /** Index: modules/security/src/test/java/common/java/security/cert/PKIXParametersTest.java =================================================================== --- modules/security/src/test/java/common/java/security/cert/PKIXParametersTest.java.orig 2006-04-16 15:17:59.000000000 +0100 +++ modules/security/src/test/java/common/java/security/cert/PKIXParametersTest.java 2006-04-16 15:23:14.000000000 +0100 @@ -942,7 +942,7 @@ // check that we have two PKIXCertPathCheckers and // they are in right order List l1 = p.getCertPathCheckers(); - assertTrue("listSize", l1.size() == 2); + assertEquals("listSize", 2, l1.size()); assertFalse("order1", ((PKIXCertPathChecker)l1.get(0)).isForwardCheckingSupported()); assertTrue("order2", @@ -969,7 +969,7 @@ p.addCertPathChecker(null); // check that we have one PKIXCertPathChecker List l1 = p.getCertPathCheckers(); - assertTrue("listSize", l1.size() == 1); + assertEquals("listSize", 1, l1.size()); } /** @@ -997,7 +997,7 @@ // above modification List l = p.getCertPathCheckers(); PKIXCertPathChecker cpc1 = (PKIXCertPathChecker)l.get(0); - assertTrue("listSize", l.size() == 1); + assertEquals("listSize", 1, l.size()); assertFalse("isCopied", cpc1.isForwardCheckingSupported()); } @@ -1059,7 +1059,7 @@ PKIXParameters p = new PKIXParameters(taSet); p.setDate(new Date(555L)); - assertTrue(p.getDate().getTime() == 555L); + assertEquals(555L, p.getDate().getTime()); } /** @@ -1096,7 +1096,7 @@ toBeSet.setTime(0L); // check that internal Date has not been // changed by the above modification - assertTrue(p.getDate().getTime() == 555L); + assertEquals(555L, p.getDate().getTime()); } /** @@ -1154,7 +1154,7 @@ s.add("1.2.3.4.5.6.7"); PKIXParameters p = new PKIXParameters(taSet); p.setInitialPolicies(s); - assertTrue(p.getInitialPolicies().size() == 1); + assertEquals(1, p.getInitialPolicies().size()); } /** @@ -1208,7 +1208,7 @@ s.clear(); // check that set maintained internally has // not been changed by the above modification - assertTrue(p.getInitialPolicies().size() == 2); + assertEquals(2, p.getInitialPolicies().size()); } /** Index: modules/security/src/test/java/common/java/security/cert/X509CRLSelectorTest.java =================================================================== --- modules/security/src/test/java/common/java/security/cert/X509CRLSelectorTest.java.orig 2006-04-16 15:18:06.000000000 +0100 +++ modules/security/src/test/java/common/java/security/cert/X509CRLSelectorTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -469,8 +469,8 @@ fail("Unexpected IOException was thrown."); } Collection result = selector.getIssuerNames(); - assertTrue("The collection should contain all of the specified DNs.", - result.size() == 2); + assertEquals("The collection should contain all of the specified DNs.", + 2, result.size()); } /** Index: modules/security/src/test/java/common/org/apache/harmony/security/provider/cert/X509CRLImplTest.java =================================================================== --- modules/security/src/test/java/common/org/apache/harmony/security/provider/cert/X509CRLImplTest.java.orig 2006-04-16 15:17:59.000000000 +0100 +++ modules/security/src/test/java/common/org/apache/harmony/security/provider/cert/X509CRLImplTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -280,7 +280,7 @@ * getVersion() method testing. */ public void testGetVersion() { - assertTrue("Incorrect version value", crl.getVersion() == 2); + assertEquals("Incorrect version value", 2, crl.getVersion()); } /** Index: modules/security/src/test/java/common/org/apache/harmony/security/provider/cert/X509CertFactoryImplTest.java =================================================================== --- modules/security/src/test/java/common/org/apache/harmony/security/provider/cert/X509CertFactoryImplTest.java.orig 2006-04-16 15:17:59.000000000 +0100 +++ modules/security/src/test/java/common/org/apache/harmony/security/provider/cert/X509CertFactoryImplTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -98,8 +98,8 @@ new ByteArrayInputStream( CertFactoryTestData.getCertEncoding()); try { - assertTrue("The size of collection is not correct", - certFactory.engineGenerateCertificates(bais).size() == 2); + assertEquals("The size of collection is not correct", + 2, certFactory.engineGenerateCertificates(bais).size()); } catch (CertificateException e) { e.printStackTrace(); fail("Unexpected CertificateException: " + e.getMessage()); @@ -109,8 +109,8 @@ bais = new ByteArrayInputStream( CertFactoryTestData.getBase64CertEncoding()); try { - assertTrue("The size of collection is not correct", - certFactory.engineGenerateCertificates(bais).size() == 2); + assertEquals("The size of collection is not correct", + 2, certFactory.engineGenerateCertificates(bais).size()); } catch (CertificateException e) { e.printStackTrace(); fail("Unexpected CertificateException: " + e.getMessage()); @@ -157,8 +157,8 @@ new ByteArrayInputStream( CertFactoryTestData.getCRLEncoding()); try { - assertTrue("The size of collection is not correct", - certFactory.engineGenerateCRLs(bais).size() == 2); + assertEquals("The size of collection is not correct", + 2, certFactory.engineGenerateCRLs(bais).size()); } catch (CRLException e) { e.printStackTrace(); fail("Unexpected CRLException: " + e.getMessage()); Index: modules/security/src/test/java/common/tests/api/java/security/KeyStoreTest.java =================================================================== --- modules/security/src/test/java/common/tests/api/java/security/KeyStoreTest.java.orig 2006-04-16 15:18:06.000000000 +0100 +++ modules/security/src/test/java/common/tests/api/java/security/KeyStoreTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -596,7 +596,7 @@ // alias 3 keyTest.setCertificateEntry("alias3", cert[1]); - assertTrue("the size of the keyStore is not 3", keyTest.size() == 3); + assertEquals("the size of the keyStore is not 3", 3, keyTest.size()); } /** 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 15:18:06.000000000 +0100 +++ modules/security/src/test/java/common/tests/api/java/security/SecurityTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -367,8 +367,8 @@ filter.put("Signature.SHA1withDSA", ""); Provider provTest[] = Security.getProviders(filter); if (provTest == null) { - assertTrue("Filter : ,", - getProvidersCount(filter) == 0); + assertEquals("Filter : ,", + 0, getProvidersCount(filter)); } else { assertEquals("Filter : ,", getProvidersCount(filter), provTest.length); @@ -380,9 +380,8 @@ filter.put("KeyFactory.RSA", ""); provTest = Security.getProviders(filter); if (provTest == null) { - assertTrue( - "Filter : ,,", - getProvidersCount(filter) == 0); + assertEquals("Filter : ,,", + 0, getProvidersCount(filter)); } else { assertEquals( "Filter : ,,", @@ -394,9 +393,8 @@ filter.put("CertificateFactory.X.509", ""); provTest = Security.getProviders(filter); if (provTest == null) { - assertTrue( - "Filter : ", - getProvidersCount(filter) == 0); + assertEquals("Filter : ", + 0, getProvidersCount(filter)); } else { assertEquals( "Filter : ", @@ -407,8 +405,8 @@ filter.put("CertificateFactory.X509", ""); provTest = Security.getProviders(filter); if (provTest == null) { - assertTrue("Filter : ", - getProvidersCount(filter) == 0); + assertEquals("Filter : ", + 0, getProvidersCount(filter)); } else { assertEquals("Filter : ", getProvidersCount(filter), provTest.length); @@ -418,8 +416,8 @@ filter.put("Provider.id name", "DRLCertFactory"); provTest = Security.getProviders(filter); if (provTest == null) { - assertTrue("Filter : ", - getProvidersCount(filter) == 0); + assertEquals("Filter : ", + 0, getProvidersCount(filter)); } else { assertEquals("Filter : ", getProvidersCount(filter), provTest.length); Index: modules/text/src/test/java/tests/api/java/text/AttributedCharacterIteratorTest.java =================================================================== --- modules/text/src/test/java/tests/api/java/text/AttributedCharacterIteratorTest.java.orig 2006-04-16 15:17:59.000000000 +0100 +++ modules/text/src/test/java/tests/api/java/text/AttributedCharacterIteratorTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -63,7 +63,7 @@ String test = "Test 23ring"; AttributedString attrString = new AttributedString(test); AttributedCharacterIterator it = attrString.getIterator(null, 2, 6); - assertTrue("Wrong begin index", it.getBeginIndex() == 2); + assertEquals("Wrong begin index", 2, it.getBeginIndex()); } /** @@ -73,7 +73,7 @@ String test = "Test 23ring"; AttributedString attrString = new AttributedString(test); AttributedCharacterIterator it = attrString.getIterator(null, 2, 6); - assertTrue("Wrong begin index", it.getEndIndex() == 6); + assertEquals("Wrong begin index", 6, it.getEndIndex()); } /** @@ -83,14 +83,14 @@ String test = "Test 23ring"; AttributedString attrString = new AttributedString(test); AttributedCharacterIterator it = attrString.getIterator(); - assertTrue("Wrong first", it.getIndex() == 0); + assertEquals("Wrong first", 0, it.getIndex()); it.next(); - assertTrue("Wrong second", it.getIndex() == 1); + assertEquals("Wrong second", 1, it.getIndex()); for (int i = 0; i < 9; i++) it.next(); - assertTrue("Wrong last", it.getIndex() == 10); + assertEquals("Wrong last", 10, it.getIndex()); it.next(); - assertTrue("Wrong final", it.getIndex() == 11); + assertEquals("Wrong final", 11, it.getIndex()); } /** @@ -156,17 +156,15 @@ as.addAttribute(AttributedCharacterIterator.Attribute.LANGUAGE, "a", 2, 3); AttributedCharacterIterator it = as.getIterator(); - assertTrue( - "non-null value limit", - it.getRunLimit(AttributedCharacterIterator.Attribute.LANGUAGE) == 2); + assertEquals("non-null value limit", + 2, it.getRunLimit(AttributedCharacterIterator.Attribute.LANGUAGE)); as = new AttributedString("test"); as.addAttribute(AttributedCharacterIterator.Attribute.LANGUAGE, null, 2, 3); it = as.getIterator(); - assertTrue( - "null value limit", - it.getRunLimit(AttributedCharacterIterator.Attribute.LANGUAGE) == 4); + assertEquals("null value limit", + 4, it.getRunLimit(AttributedCharacterIterator.Attribute.LANGUAGE)); } protected void setUp() { 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 15:18:06.000000000 +0100 +++ modules/text/src/test/java/tests/api/java/text/ChoiceFormatTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -303,24 +303,24 @@ // java.text.ChoiceFormat.parse(java.lang.String, // java.text.ParsePosition) ChoiceFormat format = new ChoiceFormat("1#one|2#two|3#three"); - assertTrue("Case insensitive", format - .parse("One", new ParsePosition(0)).intValue() == 0); + assertEquals("Case insensitive", 0, format + .parse("One", new ParsePosition(0)).intValue()); ParsePosition pos = new ParsePosition(0); Number result = f1.parse("Greater than two", pos); assertTrue("Not a Double1", result instanceof Double); assertTrue("Wrong value ~>2", result.doubleValue() == ChoiceFormat .nextDouble(2)); - assertTrue("Wrong position ~16", pos.getIndex() == 16); + assertEquals("Wrong position ~16", 16, pos.getIndex()); pos = new ParsePosition(0); assertTrue("Incorrect result", Double.isNaN(f1.parse("12one", pos) .doubleValue())); - assertTrue("Wrong position ~0", pos.getIndex() == 0); + assertEquals("Wrong position ~0", 0, pos.getIndex()); pos = new ParsePosition(2); result = f1.parse("12one and two", pos); assertTrue("Not a Double2", result instanceof Double); - assertTrue("Ignored parse position", result.doubleValue() == 1.0); - assertTrue("Wrong position ~5", pos.getIndex() == 5); + assertEquals("Ignored parse position", 1.0, result.doubleValue()); + assertEquals("Wrong position ~5", 5, pos.getIndex()); } /** @@ -371,8 +371,8 @@ String str = "org.apache.harmony.tests.java.lang.share.MyResources2"; cf.applyPattern(str); ptrn = cf.toPattern(); - assertTrue("Return value should be empty string for invalid pattern", - ptrn.length() == 0); + assertEquals("Return value should be empty string for invalid pattern", + 0, ptrn.length()); } /** Index: modules/text/src/test/java/tests/api/java/text/CollationKeyTest.java =================================================================== --- modules/text/src/test/java/tests/api/java/text/CollationKeyTest.java.orig 2006-04-16 15:17:59.000000000 +0100 +++ modules/text/src/test/java/tests/api/java/text/CollationKeyTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -30,7 +30,7 @@ collator.setStrength(Collator.PRIMARY); CollationKey key1 = collator.getCollationKey("abc"); CollationKey key2 = collator.getCollationKey("ABC"); - assertTrue("Should be equal", key1.compareTo(key2) == 0); + assertEquals("Should be equal", 0, key1.compareTo(key2)); } /** @@ -43,7 +43,7 @@ collator.setStrength(Collator.PRIMARY); CollationKey key1 = collator.getCollationKey("abc"); CollationKey key2 = collator.getCollationKey("ABC"); - assertTrue("Should be equal", key1.compareTo(key2) == 0); + assertEquals("Should be equal", 0, key1.compareTo(key2)); } /** Index: modules/text/src/test/java/tests/api/java/text/CollatorTest.java =================================================================== --- modules/text/src/test/java/tests/api/java/text/CollatorTest.java.orig 2006-04-16 15:17:59.000000000 +0100 +++ modules/text/src/test/java/tests/api/java/text/CollatorTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -53,7 +53,7 @@ assertTrue("a) Failed on identical", c.compare(o, o2) < 0); o = "e"; o2 = "e"; - assertTrue("a) Failed on equivalence", c.compare(o, o2) == 0); + assertEquals("a) Failed on equivalence", 0, c.compare(o, o2)); assertTrue("a) Failed on primary expansion", c.compare("\u01db", "v") < 0); @@ -69,10 +69,10 @@ assertTrue("b) Failed on tertiary difference", c.compare(o, o2) < 0); o = "\u0001"; o2 = "\u0002"; - assertTrue("b) Failed on identical", c.compare(o, o2) == 0); + assertEquals("b) Failed on identical", 0, c.compare(o, o2)); o = "e"; o2 = "e"; - assertTrue("b) Failed on equivalence", c.compare(o, o2) == 0); + assertEquals("b) Failed on equivalence", 0, c.compare(o, o2)); c.setStrength(Collator.SECONDARY); o = "E"; @@ -83,13 +83,13 @@ assertTrue("c) Failed on secondary difference", c.compare(o, o2) < 0); o = "e"; o2 = "E"; - assertTrue("c) Failed on tertiary difference", c.compare(o, o2) == 0); + assertEquals("c) Failed on tertiary difference", 0, c.compare(o, o2)); o = "\u0001"; o2 = "\u0002"; - assertTrue("c) Failed on identical", c.compare(o, o2) == 0); + assertEquals("c) Failed on identical", 0, c.compare(o, o2)); o = "e"; o2 = "e"; - assertTrue("c) Failed on equivalence", c.compare(o, o2) == 0); + assertEquals("c) Failed on equivalence", 0, c.compare(o, o2)); c.setStrength(Collator.PRIMARY); o = "E"; @@ -97,16 +97,16 @@ assertTrue("d) Failed on primary difference", c.compare(o, o2) < 0); o = "e"; o2 = "\u00e9"; - assertTrue("d) Failed on secondary difference", c.compare(o, o2) == 0); + assertEquals("d) Failed on secondary difference", 0, c.compare(o, o2)); o = "e"; o2 = "E"; - assertTrue("d) Failed on tertiary difference", c.compare(o, o2) == 0); + assertEquals("d) Failed on tertiary difference", 0, c.compare(o, o2)); o = "\u0001"; o2 = "\u0002"; - assertTrue("d) Failed on identical", c.compare(o, o2) == 0); + assertEquals("d) Failed on identical", 0, c.compare(o, o2)); o = "e"; o2 = "e"; - assertTrue("d) Failed on equivalence", c.compare(o, o2) == 0); + assertEquals("d) Failed on equivalence", 0, c.compare(o, o2)); try { c.compare("e", new StringBuffer("Blah")); 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 15:18:06.000000000 +0100 +++ modules/text/src/test/java/tests/api/java/text/DecimalFormatTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -495,11 +495,11 @@ */ public void test_getGroupingSize() { DecimalFormat df = new DecimalFormat("###0.##"); - assertTrue("Wrong unset size", df.getGroupingSize() == 0); + assertEquals("Wrong unset size", 0, df.getGroupingSize()); df = new DecimalFormat("#,##0.##"); - assertTrue("Wrong set size", df.getGroupingSize() == 3); + assertEquals("Wrong set size", 3, df.getGroupingSize()); df = new DecimalFormat("#,###,###0.##"); - assertTrue("Wrong multiple set size", df.getGroupingSize() == 4); + assertEquals("Wrong multiple set size", 4, df.getGroupingSize()); } /** @@ -507,11 +507,11 @@ */ public void test_getMultiplier() { DecimalFormat df = new DecimalFormat("###0.##"); - assertTrue("Wrong unset multiplier", df.getMultiplier() == 1); + assertEquals("Wrong unset multiplier", 1, df.getMultiplier()); df = new DecimalFormat("###0.##%"); - assertTrue("Wrong percent multiplier", df.getMultiplier() == 100); + assertEquals("Wrong percent multiplier", 100, df.getMultiplier()); df = new DecimalFormat("###0.##\u2030"); - assertTrue("Wrong mille multiplier", df.getMultiplier() == 1000); + assertEquals("Wrong mille multiplier", 1000, df.getMultiplier()); } /** @@ -677,7 +677,7 @@ new DecimalFormatSymbols(Locale.ENGLISH)); df.setGroupingUsed(true); df.setGroupingSize(2); - assertTrue("Value not set", df.getGroupingSize() == 2); + assertEquals("Value not set", 2, df.getGroupingSize()); String result = df.format(123); assertTrue("Invalid format:" + result, result.equals("1,23")); } @@ -688,10 +688,10 @@ public void test_setMaximumFractionDigitsI() { DecimalFormat df = new DecimalFormat("###0.##"); df.setMaximumFractionDigits(3); - assertTrue("Not set", df.getMaximumFractionDigits() == 3); + assertEquals("Not set", 3, df.getMaximumFractionDigits()); assertEquals("Wrong maximum", "1.235", df.format(1.23456)); df.setMinimumFractionDigits(4); - assertTrue("Not changed", df.getMaximumFractionDigits() == 4); + assertEquals("Not changed", 4, df.getMaximumFractionDigits()); assertEquals("Incorrect fraction", "456.0000", df.format(456)); } @@ -701,10 +701,10 @@ public void test_setMaximumIntegerDigitsI() { DecimalFormat df = new DecimalFormat("###0.##"); df.setMaximumIntegerDigits(2); - assertTrue("Not set", df.getMaximumIntegerDigits() == 2); + assertEquals("Not set", 2, df.getMaximumIntegerDigits()); assertEquals("Wrong maximum", "34", df.format(1234)); df.setMinimumIntegerDigits(4); - assertTrue("Not changed", df.getMaximumIntegerDigits() == 4); + assertEquals("Not changed", 4, df.getMaximumIntegerDigits()); assertEquals("Incorrect integer", "0026", df.format(26)); } @@ -714,10 +714,10 @@ public void test_setMinimumFractionDigitsI() { DecimalFormat df = new DecimalFormat("###0.##"); df.setMinimumFractionDigits(4); - assertTrue("Not set", df.getMinimumFractionDigits() == 4); + assertEquals("Not set", 4, df.getMinimumFractionDigits()); assertEquals("Wrong minimum", "1.2300", df.format(1.23)); df.setMaximumFractionDigits(2); - assertTrue("Not changed", df.getMinimumFractionDigits() == 2); + assertEquals("Not changed", 2, df.getMinimumFractionDigits()); assertEquals("Incorrect fraction", "456.00", df.format(456)); } @@ -727,10 +727,10 @@ public void test_setMinimumIntegerDigitsI() { DecimalFormat df = new DecimalFormat("###0.##"); df.setMinimumIntegerDigits(3); - assertTrue("Not set", df.getMinimumIntegerDigits() == 3); + assertEquals("Not set", 3, df.getMinimumIntegerDigits()); assertEquals("Wrong minimum", "012", df.format(12)); df.setMaximumIntegerDigits(2); - assertTrue("Not changed", df.getMinimumIntegerDigits() == 2); + assertEquals("Not changed", 2, df.getMinimumIntegerDigits()); assertEquals("Incorrect integer", "00.7", df.format(0.7)); } @@ -740,9 +740,9 @@ public void test_setMultiplierI() { DecimalFormat df = new DecimalFormat("###0.##"); df.setMultiplier(10); - assertTrue("Wrong multiplier", df.getMultiplier() == 10); + assertEquals("Wrong multiplier", 10, df.getMultiplier()); assertEquals("Wrong format", "50", df.format(5)); - assertTrue("Wrong parse", df.parse("50", new ParsePosition(0)) - .intValue() == 5); + assertEquals("Wrong parse", 5, df.parse("50", new ParsePosition(0)) + .intValue()); } } Index: modules/text/src/test/java/tests/api/java/text/FieldPositionTest.java =================================================================== --- modules/text/src/test/java/tests/api/java/text/FieldPositionTest.java.orig 2006-04-16 15:18:06.000000000 +0100 +++ modules/text/src/test/java/tests/api/java/text/FieldPositionTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -110,8 +110,8 @@ FieldPosition fpos = new FieldPosition(1); fpos.setEndIndex(3); fpos.setBeginIndex(2); - assertTrue("getBeginIndex should have returned 2", - fpos.getBeginIndex() == 2); + assertEquals("getBeginIndex should have returned 2", + 2, fpos.getBeginIndex()); } /** @@ -122,8 +122,8 @@ FieldPosition fpos = new FieldPosition(1); fpos.setBeginIndex(2); fpos.setEndIndex(3); - assertTrue("getEndIndex should have returned 3", - fpos.getEndIndex() == 3); + assertEquals("getEndIndex should have returned 3", + 3, fpos.getEndIndex()); } /** @@ -132,13 +132,11 @@ public void test_getField() { // Test for method int java.text.FieldPosition.getField() FieldPosition fpos = new FieldPosition(65); - assertTrue( - "FieldPosition(65) should have caused getField to return 65", - fpos.getField() == 65); + assertEquals("FieldPosition(65) should have caused getField to return 65", + 65, fpos.getField()); FieldPosition fpos2 = new FieldPosition(DateFormat.Field.MINUTE); - assertTrue( - "FieldPosition(DateFormat.Field.MINUTE) should have caused getField to return -1", - fpos2.getField() == -1); + assertEquals("FieldPosition(DateFormat.Field.MINUTE) should have caused getField to return -1", + -1, fpos2.getField()); } /** @@ -183,8 +181,8 @@ FieldPosition fpos = new FieldPosition(1); fpos.setBeginIndex(2); fpos.setEndIndex(3); - assertTrue("beginIndex should have been set to 2", - fpos.getBeginIndex() == 2); + assertEquals("beginIndex should have been set to 2", + 2, fpos.getBeginIndex()); } /** @@ -195,8 +193,8 @@ FieldPosition fpos = new FieldPosition(1); fpos.setEndIndex(3); fpos.setBeginIndex(2); - assertTrue("EndIndex should have been set to 3", - fpos.getEndIndex() == 3); + assertEquals("EndIndex should have been set to 3", + 3, fpos.getEndIndex()); } /** Index: modules/text/src/test/java/tests/api/java/text/ParseExceptionTest.java =================================================================== --- modules/text/src/test/java/tests/api/java/text/ParseExceptionTest.java.orig 2006-04-16 15:17:59.000000000 +0100 +++ modules/text/src/test/java/tests/api/java/text/ParseExceptionTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -44,7 +44,7 @@ DateFormat df = DateFormat.getInstance(); df.parse("1999HelloWorld"); } catch (ParseException e) { - assertTrue("getErrorOffsetFailed.", e.getErrorOffset() == 4); + assertEquals("getErrorOffsetFailed.", 4, e.getErrorOffset()); } } 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 15:18:06.000000000 +0100 +++ modules/text/src/test/java/tests/api/java/text/ParsePositionTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -29,7 +29,7 @@ ParsePosition pp1 = new ParsePosition(Integer.MIN_VALUE); assertTrue("Initialization failed.", pp1.getIndex() == Integer.MIN_VALUE); - assertTrue("Initialization failed.", pp1.getErrorIndex() == -1); + assertEquals("Initialization failed.", -1, pp1.getErrorIndex()); } catch (Exception e) { fail("Constructor failed."); } @@ -56,7 +56,7 @@ public void test_getErrorIndex() { // Test for method int java.text.ParsePosition.getErrorIndex() pp.setErrorIndex(56); - assertTrue("getErrorIndex failed.", pp.getErrorIndex() == 56); + assertEquals("getErrorIndex failed.", 56, pp.getErrorIndex()); } /** @@ -82,7 +82,7 @@ public void test_setErrorIndexI() { // Test for method void java.text.ParsePosition.setErrorIndex(int) pp.setErrorIndex(4564); - assertTrue("setErrorIndex failed.", pp.getErrorIndex() == 4564); + assertEquals("setErrorIndex failed.", 4564, pp.getErrorIndex()); } /** @@ -91,7 +91,7 @@ public void test_setIndexI() { // Test for method void java.text.ParsePosition.setIndex(int) pp.setIndex(4564); - assertTrue("setErrorIndex failed.", pp.getIndex() == 4564); + assertEquals("setErrorIndex failed.", 4564, pp.getIndex()); } /** 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 15:18:06.000000000 +0100 +++ modules/text/src/test/java/tests/api/java/text/SimpleDateFormatTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -785,16 +785,16 @@ Calendar cal = new GregorianCalendar(); try { cal.setTime(f1.parse("49")); - assertTrue("Incorrect year 2049", cal.get(Calendar.YEAR) == 2049); + assertEquals("Incorrect year 2049", 2049, cal.get(Calendar.YEAR)); cal.setTime(f1.parse("50")); int year = cal.get(Calendar.YEAR); assertTrue("Incorrect year 1950: " + year, year == 1950); f1.applyPattern("y"); cal.setTime(f1.parse("00")); - assertTrue("Incorrect year 2000", cal.get(Calendar.YEAR) == 2000); + assertEquals("Incorrect year 2000", 2000, cal.get(Calendar.YEAR)); f1.applyPattern("yyy"); cal.setTime(f1.parse("50")); - assertTrue("Incorrect year 50", cal.get(Calendar.YEAR) == 50); + assertEquals("Incorrect year 50", 50, cal.get(Calendar.YEAR)); } catch (ParseException e) { fail("ParseException"); } Index: modules/text/src/test/java/tests/api/java/text/StringCharacterIteratorTest.java =================================================================== --- modules/text/src/test/java/tests/api/java/text/StringCharacterIteratorTest.java.orig 2006-04-16 15:17:59.000000000 +0100 +++ modules/text/src/test/java/tests/api/java/text/StringCharacterIteratorTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -24,9 +24,9 @@ */ public void test_ConstructorLjava_lang_String() { StringCharacterIterator it = new StringCharacterIterator("testing"); - assertTrue("Wrong begin index", it.getBeginIndex() == 0); - assertTrue("Wrong end index", it.getEndIndex() == 7); - assertTrue("Wrong current index", it.getIndex() == 0); + assertEquals("Wrong begin index", 0, it.getBeginIndex()); + assertEquals("Wrong end index", 7, it.getEndIndex()); + assertEquals("Wrong current index", 0, it.getIndex()); assertTrue("Wrong current char", it.current() == 't'); assertTrue("Wrong next char", it.next() == 'e'); } @@ -37,9 +37,9 @@ */ public void test_ConstructorLjava_lang_StringI() { StringCharacterIterator it = new StringCharacterIterator("testing", 3); - assertTrue("Wrong begin index", it.getBeginIndex() == 0); - assertTrue("Wrong end index", it.getEndIndex() == 7); - assertTrue("Wrong current index", it.getIndex() == 3); + assertEquals("Wrong begin index", 0, it.getBeginIndex()); + assertEquals("Wrong end index", 7, it.getEndIndex()); + assertEquals("Wrong current index", 3, it.getIndex()); assertTrue("Wrong current char", it.current() == 't'); assertTrue("Wrong next char", it.next() == 'i'); } @@ -51,9 +51,9 @@ public void test_ConstructorLjava_lang_StringIII() { StringCharacterIterator it = new StringCharacterIterator("testing", 2, 6, 4); - assertTrue("Wrong begin index", it.getBeginIndex() == 2); - assertTrue("Wrong end index", it.getEndIndex() == 6); - assertTrue("Wrong current index", it.getIndex() == 4); + assertEquals("Wrong begin index", 2, it.getBeginIndex()); + assertEquals("Wrong end index", 6, it.getEndIndex()); + assertEquals("Wrong current index", 4, it.getIndex()); assertTrue("Wrong current char", it.current() == 'i'); assertTrue("Wrong next char", it.next() == 'n'); } @@ -110,7 +110,7 @@ public void test_getBeginIndex() { StringCharacterIterator it1 = new StringCharacterIterator("testing", 2, 6, 4); - assertTrue("Wrong begin index 2", it1.getBeginIndex() == 2); + assertEquals("Wrong begin index 2", 2, it1.getBeginIndex()); } /** @@ -119,7 +119,7 @@ public void test_getEndIndex() { StringCharacterIterator it1 = new StringCharacterIterator("testing", 2, 6, 4); - assertTrue("Wrong end index 6", it1.getEndIndex() == 6); + assertEquals("Wrong end index 6", 6, it1.getEndIndex()); } /** @@ -128,11 +128,11 @@ public void test_getIndex() { StringCharacterIterator it1 = new StringCharacterIterator("testing", 2, 6, 4); - assertTrue("Wrong index 4", it1.getIndex() == 4); + assertEquals("Wrong index 4", 4, it1.getIndex()); it1.next(); - assertTrue("Wrong index 5", it1.getIndex() == 5); + assertEquals("Wrong index 5", 5, it1.getIndex()); it1.last(); - assertTrue("Wrong index 4/2", it1.getIndex() == 5); + assertEquals("Wrong index 4/2", 5, it1.getIndex()); } /** @@ -196,7 +196,7 @@ it1.previous() == CharacterIterator.DONE); assertTrue("Wrong previous char4", it1.previous() == CharacterIterator.DONE); - assertTrue("Wrong index", it1.getIndex() == 2); + assertEquals("Wrong index", 2, it1.getIndex()); assertTrue("Wrong current char", it1.current() == 's'); } @@ -220,9 +220,9 @@ StringCharacterIterator it1 = new StringCharacterIterator("testing", 2, 6, 4); it1.setText("frog"); - assertTrue("Wrong begin index", it1.getBeginIndex() == 0); - assertTrue("Wrong end index", it1.getEndIndex() == 4); - assertTrue("Wrong current index", it1.getIndex() == 0); + assertEquals("Wrong begin index", 0, it1.getBeginIndex()); + assertEquals("Wrong end index", 4, it1.getEndIndex()); + assertEquals("Wrong current index", 0, it1.getIndex()); } protected void setUp() { Index: support/src/test/java/tests/support/Support_ListTest.java =================================================================== --- support/src/test/java/tests/support/Support_ListTest.java.orig 2006-04-16 15:17:59.000000000 +0100 +++ support/src/test/java/tests/support/Support_ListTest.java 2006-04-16 15:23:14.000000000 +0100 @@ -92,7 +92,7 @@ list.get(49).equals(new Integer(49))); List mySubList = list.subList(50, 53); - assertTrue(mySubList.size() == 3); + assertEquals(3, mySubList.size()); assertTrue( "ListTest - a) sublist Failed--does not contain correct elements", mySubList.get(0).equals(new Integer(500))); @@ -106,9 +106,8 @@ t_listIterator(mySubList); mySubList.clear(); - assertTrue( - "ListTest - Clearing the sublist did not remove the appropriate elements from the original list", - list.size() == 100); + assertEquals("ListTest - Clearing the sublist did not remove the appropriate elements from the original list", + 100, list.size()); t_listIterator(list); ListIterator li = list.listIterator(); @@ -182,25 +181,25 @@ Integer add2 = new Integer(601); li.add(add1); assertTrue("list iterator add(), size()", list.size() == (orgSize + 1)); - assertTrue("list iterator add(), nextIndex()", li.nextIndex() == 1); - assertTrue("list iterator add(), previousIndex()", - li.previousIndex() == 0); + assertEquals("list iterator add(), nextIndex()", 1, li.nextIndex()); + assertEquals("list iterator add(), previousIndex()", + 0, li.previousIndex()); Object next = li.next(); assertTrue("list iterator add(), next(): " + next, next == list.get(1)); li.add(add2); Object previous = li.previous(); assertTrue("list iterator add(), previous(): " + previous, previous == add2); - assertTrue("list iterator add(), nextIndex()2", li.nextIndex() == 2); - assertTrue("list iterator add(), previousIndex()2", - li.previousIndex() == 1); + assertEquals("list iterator add(), nextIndex()2", 2, li.nextIndex()); + assertEquals("list iterator add(), previousIndex()2", + 1, li.previousIndex()); li.remove(); assertTrue("list iterator remove(), size()", list.size() == (orgSize + 1)); - assertTrue("list iterator remove(), nextIndex()", li.nextIndex() == 2); - assertTrue("list iterator remove(), previousIndex()", li - .previousIndex() == 1); + assertEquals("list iterator remove(), nextIndex()", 2, li.nextIndex()); + assertEquals("list iterator remove(), previousIndex()", 1, li + .previousIndex()); assertTrue("list iterator previous()2", li.previous() == list.get(1)); assertTrue("list iterator previous()3", li.previous() == list.get(0)); assertTrue("list iterator next()2", li.next() == list.get(0)); @@ -208,7 +207,7 @@ assertTrue("list iterator hasPrevious()3", !li.hasPrevious()); assertTrue("list iterator hasNext()3", li.hasNext()); assertTrue("list iterator size()", list.size() == orgSize); - assertTrue("list iterator nextIndex()3", li.nextIndex() == 0); - assertTrue("list iterator previousIndex()3", li.previousIndex() == -1); + assertEquals("list iterator nextIndex()3", 0, li.nextIndex()); + assertEquals("list iterator previousIndex()3", -1, li.previousIndex()); } } Index: support/src/test/java/tests/support/Support_MapTest2.java =================================================================== --- support/src/test/java/tests/support/Support_MapTest2.java.orig 2006-04-16 15:17:59.000000000 +0100 +++ support/src/test/java/tests/support/Support_MapTest2.java 2006-04-16 15:18:06.000000000 +0100 @@ -32,9 +32,9 @@ public void runTest() { try { map.put("one", "1"); - assertTrue("size should be one", map.size() == 1); + assertEquals("size should be one", 1, map.size()); map.clear(); - assertTrue("size should be zero", map.size() == 0); + assertEquals("size should be zero", 0, map.size()); assertTrue("Should not have entries", !map.entrySet().iterator() .hasNext()); assertTrue("Should not have keys", !map.keySet().iterator() @@ -46,9 +46,9 @@ try { map.put("one", "1"); - assertTrue("size should be one", map.size() == 1); + assertEquals("size should be one", 1, map.size()); map.remove("one"); - assertTrue("size should be zero", map.size() == 0); + assertEquals("size should be zero", 0, map.size()); assertTrue("Should not have entries", !map.entrySet().iterator() .hasNext()); assertTrue("Should not have keys", !map.keySet().iterator() 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 15:18:06.000000000 +0100 +++ modules/archive/src/test/java/tests/api/java/util/zip/ZipFileTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -181,7 +181,7 @@ in != null); r = in.read(); in.close(); - assertTrue("testdir1/ should not contain data", r == -1); + assertEquals("testdir1/ should not contain data", -1, r); zentry = zfile.getEntry("testdir1"); assertTrue("Could not obtain ZipEntry: testdir1", zentry != null); @@ -189,7 +189,7 @@ assertTrue("testdir1 should not have null input stream", in != null); r = in.read(); in.close(); - assertTrue("testdir1 should not contain data", r == -1); + assertEquals("testdir1 should not contain data", -1, r); zentry = zfile.getEntry("testdir1/testdir1"); assertTrue("Could not obtain ZipEntry: testdir1/testdir1", Index: modules/luni/src/test/java/org/apache/harmony/tests/java/util/ArraysTest.java =================================================================== --- modules/luni/src/test/java/org/apache/harmony/tests/java/util/ArraysTest.java.orig 2006-04-16 15:17:59.000000000 +0100 +++ modules/luni/src/test/java/org/apache/harmony/tests/java/util/ArraysTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -36,10 +36,10 @@ assertTrue("Assert 0: " + specials[i] + " invalid: " + result, result == i); } - assertTrue("Assert 1: Invalid search index for -1d", - Arrays.binarySearch(specials, -1d) == -4); - assertTrue("Assert 2: Invalid search index for 1d", - Arrays.binarySearch(specials, 1d) == -8); + assertEquals("Assert 1: Invalid search index for -1d", + -4, Arrays.binarySearch(specials, -1d)); + assertEquals("Assert 2: Invalid search index for 1d", + -8, Arrays.binarySearch(specials, 1d)); } /** @@ -56,10 +56,10 @@ assertTrue("Assert 0: " + specials[i] + " invalid: " + result, result == i); } - assertTrue("Assert 1: Invalid search index for -1f", - Arrays.binarySearch(specials, -1f) == -4); - assertTrue("Assert 2: Invalid search index for 1f", - Arrays.binarySearch(specials, 1f) == -8); + assertEquals("Assert 1: Invalid search index for -1f", + -4, Arrays.binarySearch(specials, -1f)); + assertEquals("Assert 2: Invalid search index for 1f", + -8, Arrays.binarySearch(specials, 1f)); } /** Index: modules/luni/src/test/java/tests/api/java/lang/FloatTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/lang/FloatTest.java.orig 2006-04-16 15:17:59.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/lang/FloatTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -343,11 +343,10 @@ * @tests java.lang.Float#parseFloat(java.lang.String) */ public void test_parseFloatLjava_lang_String() { - assertTrue("Incorrect float returned, expected zero.", Float - .parseFloat("7.0064923216240853546186479164495e-46") == 0.0); - assertTrue( - "Incorrect float returned, expected minimum float.", - Float.parseFloat("7.0064923216240853546186479164496e-46") == Float.MIN_VALUE); + assertEquals("Incorrect float returned, expected zero.", + 0.0, Float.parseFloat("7.0064923216240853546186479164495e-46"), 0.0); + assertEquals("Incorrect float returned, expected minimum float.", + Float.MIN_VALUE, Float.parseFloat("7.0064923216240853546186479164496e-46"), 0.0); doTestCompareRawBits( "0.000000000000000000000000000000000000011754942807573642917278829910357665133228589927589904276829631184250030649651730385585324256680905818939208984375", Index: modules/luni/src/test/java/tests/api/java/lang/reflect/ProxyTest.java =================================================================== --- modules/luni/src/test/java/tests/api/java/lang/reflect/ProxyTest.java.orig 2006-04-16 15:17:59.000000000 +0100 +++ modules/luni/src/test/java/tests/api/java/lang/reflect/ProxyTest.java 2006-04-16 15:18:06.000000000 +0100 @@ -112,7 +112,7 @@ assertTrue("Failed identity test ", proxy.equals(proxy)); assertTrue("Failed not equals test ", !proxy.equals("")); int[] result = (int[]) proxy.array(new long[] { 100L, -200L }); - assertTrue("Failed base type conversion test ", result[0] == -200); + assertEquals("Failed base type conversion test ", -200, result[0]); boolean worked = false; try { Index: modules/security/src/test/java/common/java/security/DigestInputStreamTest.java =================================================================== --- modules/security/src/test/java/common/java/security/DigestInputStreamTest.java.orig 2006-04-16 15:17:59.000000000 +0100 +++ modules/security/src/test/java/common/java/security/DigestInputStreamTest.java 2006-04-16 15:23:14.000000000 +0100 @@ -161,9 +161,9 @@ dis.read(); } // check that subsequent read() calls return -1 (eos) - assertTrue("retval1", dis.read() == -1); - assertTrue("retval2", dis.read() == -1); - assertTrue("retval3", dis.read() == -1); + assertEquals("retval1", -1, dis.read()); + assertEquals("retval2", -1, dis.read()); + assertEquals("retval3", -1, dis.read()); // check that 3 previous read() calls did not update digest assertTrue("update", Arrays.equals(dis.getMessageDigest().digest(), @@ -331,7 +331,7 @@ public final void testReadbyteArrayintint02() throws IOException { // check precondition - assertTrue(MY_MESSAGE_LEN % CHUNK_SIZE == 0); + assertEquals(0, MY_MESSAGE_LEN % CHUNK_SIZE); for (int ii=0; iiECFieldF2m */ public final void testGetFieldSize() { - assertTrue(new ECFieldF2m(2000).getFieldSize() == 2000); + assertEquals(2000, new ECFieldF2m(2000).getFieldSize()); } /** @@ -566,7 +566,7 @@ * Assertion: returns m value for ECFieldF2m */ public final void testGetM() { - assertTrue(new ECFieldF2m(2000).getM() == 2000); + assertEquals(2000, new ECFieldF2m(2000).getM()); } /** Index: modules/security/src/test/java/common/java/security/spec/ECFieldFpTest.java =================================================================== --- modules/security/src/test/java/common/java/security/spec/ECFieldFpTest.java.orig 2006-04-16 15:17:11.000000000 +0100 +++ modules/security/src/test/java/common/java/security/spec/ECFieldFpTest.java 2006-04-16 15:23:14.000000000 +0100 @@ -142,7 +142,7 @@ * Assertion: returns field size in bits which is prime size */ public final void testGetFieldSize() { - assertTrue(new ECFieldFp(BigInteger.valueOf(23L)).getFieldSize() == 5); + assertEquals(5, new ECFieldFp(BigInteger.valueOf(23L)).getFieldSize()); } /** 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 15:18:06.000000000 +0100 +++ modules/security/src/test/java/common/java/security/spec/PSSParameterSpecTest.java 2006-04-16 16:05:09.000000000 +0100 @@ -207,7 +207,7 @@ */ public final void testGetSaltLength() { PSSParameterSpec pssps = new PSSParameterSpec(20); - assertTrue(pssps.getSaltLength() == 20); + assertEquals(20, pssps.getSaltLength()); } /** @@ -217,7 +217,7 @@ public final void testGetTrailerField() { PSSParameterSpec pssps = new PSSParameterSpec("SHA-1", "MGF1", MGF1ParameterSpec.SHA1, 20, 1); - assertTrue(pssps.getTrailerField() == 1); + assertEquals(1, pssps.getTrailerField()); } /** @@ -250,7 +250,7 @@ * Assertion: default salt length value is 20 */ public final void testDEFAULTsaltLen() { - assertTrue(PSSParameterSpec.DEFAULT.getSaltLength() == 20); + assertEquals(20, PSSParameterSpec.DEFAULT.getSaltLength()); } /** @@ -258,6 +258,6 @@ * Assertion: default trailer field value is 1 */ public final void testDEFAULTtrailerField() { - assertTrue(PSSParameterSpec.DEFAULT.getTrailerField() == 1); + assertEquals(1, PSSParameterSpec.DEFAULT.getTrailerField()); } } Index: modules/security/src/test/java/common/java/security/spec/RSAKeyGenParameterSpecTest.java =================================================================== --- modules/security/src/test/java/common/java/security/spec/RSAKeyGenParameterSpecTest.java.orig 2006-04-16 15:17:11.000000000 +0100 +++ modules/security/src/test/java/common/java/security/spec/RSAKeyGenParameterSpecTest.java 2006-04-16 16:05:57.000000000 +0100 @@ -58,7 +58,7 @@ public final void testGetKeysize() { RSAKeyGenParameterSpec rkgps = new RSAKeyGenParameterSpec(512, BigInteger.valueOf(0L)); - assertTrue(rkgps.getKeysize() == 512); + assertEquals(512, rkgps.getKeysize()); } /** @@ -68,7 +68,7 @@ public final void testGetPublicExponent() { RSAKeyGenParameterSpec rkgps = new RSAKeyGenParameterSpec(512, BigInteger.valueOf(0L)); - assertTrue(rkgps.getPublicExponent().intValue() == 0); + assertEquals(0, rkgps.getPublicExponent().intValue()); } /** @@ -76,7 +76,7 @@ * Assertion: the public exponent value F0 = 3 */ public final void testF0Value() { - assertTrue(RSAKeyGenParameterSpec.F0.intValue() == 3); + assertEquals(3, RSAKeyGenParameterSpec.F0.intValue()); } /** @@ -84,7 +84,7 @@ * Assertion: the public exponent value F0 = 65537 */ public final void testF4Value() { - assertTrue(RSAKeyGenParameterSpec.F4.intValue() == 65537); + assertEquals(65537, RSAKeyGenParameterSpec.F4.intValue()); } } Index: modules/security/src/test/java/common/java/security/spec/RSAOtherPrimeInfoTest.java =================================================================== --- modules/security/src/test/java/common/java/security/spec/RSAOtherPrimeInfoTest.java.orig 2006-04-16 15:17:11.000000000 +0100 +++ modules/security/src/test/java/common/java/security/spec/RSAOtherPrimeInfoTest.java 2006-04-16 15:23:14.000000000 +0100 @@ -118,7 +118,7 @@ new RSAOtherPrimeInfo(BigInteger.valueOf(1L), BigInteger.valueOf(2L), BigInteger.valueOf(3L)); - assertTrue(ropi.getCrtCoefficient().longValue() == 3L); + assertEquals(3L, ropi.getCrtCoefficient().longValue()); } /** @@ -130,7 +130,7 @@ new RSAOtherPrimeInfo(BigInteger.valueOf(1L), BigInteger.valueOf(2L), BigInteger.valueOf(3L)); - assertTrue(ropi.getPrime().longValue() == 1L); + assertEquals(1L, ropi.getPrime().longValue()); } /** @@ -142,7 +142,7 @@ new RSAOtherPrimeInfo(BigInteger.valueOf(1L), BigInteger.valueOf(2L), BigInteger.valueOf(3L)); - assertTrue(ropi.getExponent().longValue() == 2L); + assertEquals(2L, ropi.getExponent().longValue()); } } Index: modules/security/src/test/java/common/java/security/spec/RSAPrivateKeySpecTest.java =================================================================== --- modules/security/src/test/java/common/java/security/spec/RSAPrivateKeySpecTest.java.orig 2006-04-16 15:17:11.000000000 +0100 +++ modules/security/src/test/java/common/java/security/spec/RSAPrivateKeySpecTest.java 2006-04-16 15:23:14.000000000 +0100 @@ -59,7 +59,7 @@ RSAPrivateKeySpec rpks = new RSAPrivateKeySpec(BigInteger.valueOf(1234567890L), BigInteger.valueOf(3L)); - assertTrue(rpks.getModulus().longValue() == 1234567890L); + assertEquals(1234567890L, rpks.getModulus().longValue()); } /** @@ -70,7 +70,7 @@ RSAPrivateKeySpec rpks = new RSAPrivateKeySpec(BigInteger.valueOf(1234567890L), BigInteger.valueOf(3L)); - assertTrue(rpks.getPrivateExponent().longValue() == 3L); + assertEquals(3L, rpks.getPrivateExponent().longValue()); } } 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 15:18:06.000000000 +0100 +++ modules/security/src/test/java/common/org/apache/harmony/security/asn1/der/DerUTCTimeEDTest.java 2006-04-16 15:23:14.000000000 +0100 @@ -102,7 +102,7 @@ ? new DerInputStream(new ByteArrayInputStream(encoded)) : new DerInputStream(encoded); // the difference only fractional-seconds - assertTrue((myDate.getTime()-((Date)uTime.decode(dis)).getTime()) == 187); + assertEquals(187, (myDate.getTime()-((Date)uTime.decode(dis)).getTime())); // midnight myDate = new SimpleDateFormat("MM.dd.yyyy HH:mm"). Index: modules/sql/src/test/java/tests/api/java/sql/DateTest.java =================================================================== --- modules/sql/src/test/java/tests/api/java/sql/DateTest.java.orig 2006-04-16 15:17:46.000000000 +0100 +++ modules/sql/src/test/java/tests/api/java/sql/DateTest.java 2006-04-16 15:23:14.000000000 +0100 @@ -179,7 +179,7 @@ int theHours = theDate.getHours(); // If it worked, it should get the Hours setting - assertTrue(theHours == 23); + assertEquals(23, theHours); fail(); } catch (IllegalArgumentException ie) { /* @@ -200,7 +200,7 @@ int theMinutes = theDate.getMinutes(); // If it worked, it should get the Hours setting - assertTrue(theMinutes == 59); + assertEquals(59, theMinutes); fail(); } catch (IllegalArgumentException ie) { /* @@ -221,7 +221,7 @@ int theSeconds = theDate.getSeconds(); // If it worked, it should get the Hours setting - assertTrue(theSeconds == 23); + assertEquals(23, theSeconds); fail(); } catch (IllegalArgumentException ie) { /* Index: modules/sql/src/test/java/tests/api/java/sql/TimestampTest.java =================================================================== --- modules/sql/src/test/java/tests/api/java/sql/TimestampTest.java.orig 2006-04-16 15:17:46.000000000 +0100 +++ modules/sql/src/test/java/tests/api/java/sql/TimestampTest.java 2006-04-16 15:23:14.000000000 +0100 @@ -557,7 +557,7 @@ assertTrue(theTimestamp.compareTo(theTest) > 0); assertTrue(theTimestamp.compareTo(theTest2) < 0); - assertTrue(theTimestamp.compareTo(theTimestamp2) == 0); + assertEquals(0, theTimestamp.compareTo(theTimestamp2)); } // end for } // end method testcompareToTimestamp @@ -575,7 +575,7 @@ assertTrue(theTimestamp.compareTo(theTest) > 0); assertTrue(theTimestamp.compareTo(theTest2) < 0); - assertTrue(theTimestamp.compareTo(theTimestamp2) == 0); + assertEquals(0, theTimestamp.compareTo(theTimestamp2)); } // end for Object nastyTest = new String("Test ");