You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by sm...@apache.org on 2006/04/26 09:12:49 UTC
svn commit: r397123 [2/7] - in
/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java:
org/apache/harmony/tests/java/util/ tests/api/java/io/ tests/api/java/lang/
tests/api/java/lang/ref/ tests/api/java/lang/reflect/ tests/api/java/net/ ...
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/OutputStreamWriterTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/OutputStreamWriterTest.java?rev=397123&r1=397122&r2=397123&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/OutputStreamWriterTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/OutputStreamWriterTest.java Wed Apr 26 00:12:16 2006
@@ -525,8 +525,8 @@
writer.write(new char[] { '\u3048' });
writer.close();
// there should not be a mode switch between writes
- assertTrue("invalid conversion 4", new String(bout.toByteArray(),
- "ISO8859_1").equals("\u001b$B$($(\u001b(B"));
+ assertEquals("invalid conversion 4", "\u001b$B$($(\u001b(B", new String(bout.toByteArray(),
+ "ISO8859_1"));
} catch (UnsupportedEncodingException e) {
// Can't test missing converter
System.out.println(e);
@@ -562,8 +562,8 @@
try {
osw = new OutputStreamWriter(fos, "8859_1");
} catch (UnsupportedEncodingException e) {
- assertTrue("Returned incorrect encoding", osw.getEncoding().equals(
- "8859_1"));
+ assertEquals("Returned incorrect encoding",
+ "8859_1", osw.getEncoding());
}
}
@@ -596,7 +596,7 @@
osw.close();
openInputStream();
int c = isr.read();
- assertTrue("Incorrect char returned", (char) c == 'T');
+ assertEquals("Incorrect char returned", 'T', (char) c);
} catch (Exception e) {
fail("Exception during write test : " + e.getMessage());
}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/PipedOutputStreamTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/PipedOutputStreamTest.java?rev=397123&r1=397122&r2=397123&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/PipedOutputStreamTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/PipedOutputStreamTest.java Wed Apr 26 00:12:16 2006
@@ -141,8 +141,8 @@
out.write("HelloWorld".getBytes(), 0, 10);
assertTrue("Bytes written before flush", reader.available() != 0);
out.flush();
- assertTrue("Wrote incorrect bytes", reader.read(10).equals(
- "HelloWorld"));
+ assertEquals("Wrote incorrect bytes",
+ "HelloWorld", reader.read(10));
} catch (IOException e) {
fail("IOException during write test : " + e.getMessage());
}
@@ -160,8 +160,8 @@
rt.start();
out.write("HelloWorld".getBytes(), 0, 10);
out.flush();
- assertTrue("Wrote incorrect bytes", reader.read(10).equals(
- "HelloWorld"));
+ assertEquals("Wrote incorrect bytes",
+ "HelloWorld", reader.read(10));
} catch (IOException e) {
fail("IOException during write test : " + e.getMessage());
}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/PrintStreamTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/PrintStreamTest.java?rev=397123&r1=397122&r2=397123&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/PrintStreamTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/PrintStreamTest.java Wed Apr 26 00:12:16 2006
@@ -123,7 +123,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());
@@ -149,9 +149,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];
@@ -173,7 +172,7 @@
os = new java.io.PrintStream(bos, true);
os.print('t');
bis = new java.io.ByteArrayInputStream(bos.toByteArray());
- assertTrue("Incorrect char written", bis.read() == 't');
+ assertEquals("Incorrect char written", 't', bis.read());
}
/**
@@ -186,8 +185,8 @@
os.print(2345.76834720202);
bis = new java.io.ByteArrayInputStream(bos.toByteArray());
bis.read(rbuf, 0, 16);
- assertTrue("Incorrect double written", new String(rbuf, 0, 16)
- .equals("2345.76834720202"));
+ assertEquals("Incorrect double written", "2345.76834720202", new String(rbuf, 0, 16)
+ );
}
/**
@@ -201,8 +200,8 @@
os.flush();
bis = new java.io.ByteArrayInputStream(bos.toByteArray());
bis.read(rbuf, 0, 8);
- assertTrue("Incorrect float written", new String(rbuf, 0, 8)
- .equals("29.08764"));
+ assertEquals("Incorrect float written", "29.08764", new String(rbuf, 0, 8)
+ );
}
@@ -216,8 +215,8 @@
byte[] rbuf = new byte[18];
bis = new java.io.ByteArrayInputStream(bos.toByteArray());
bis.read(rbuf, 0, 9);
- assertTrue("Incorrect int written", new String(rbuf, 0, 9)
- .equals("768347202"));
+ assertEquals("Incorrect int written", "768347202", new String(rbuf, 0, 9)
+ );
}
/**
@@ -231,8 +230,8 @@
os.close();
bis = new java.io.ByteArrayInputStream(bos.toByteArray());
bis.read(rbuf, 0, 13);
- assertTrue("Incorrect long written", new String(rbuf, 0, 13)
- .equals("9875645283333"));
+ assertEquals("Incorrect long written", "9875645283333", new String(rbuf, 0, 13)
+ );
}
/**
@@ -246,8 +245,8 @@
bis = new java.io.ByteArrayInputStream(bos.toByteArray());
byte[] nullbytes = new byte[4];
bis.read(nullbytes, 0, 4);
- assertTrue("null should be written", new String(nullbytes, 0, 4)
- .equals("null"));
+ assertEquals("null should be written", "null", new String(nullbytes, 0, 4)
+ );
try {
bis.close();
bos.close();
@@ -261,8 +260,8 @@
bis = new java.io.ByteArrayInputStream(bos1.toByteArray());
byte[] rbytes = new byte[2];
bis.read(rbytes, 0, 2);
- assertTrue("Incorrect Object written", new String(rbytes, 0, 2)
- .equals("[]"));
+ assertEquals("Incorrect Object written", "[]", new String(rbytes, 0, 2)
+ );
}
/**
@@ -275,8 +274,8 @@
bis = new java.io.ByteArrayInputStream(bos.toByteArray());
byte[] nullbytes = new byte[4];
bis.read(nullbytes, 0, 4);
- assertTrue("null should be written", new String(nullbytes, 0, 4)
- .equals("null"));
+ assertEquals("null should be written", "null", new String(nullbytes, 0, 4)
+ );
try {
bis.close();
bos.close();
@@ -290,8 +289,8 @@
bis = new java.io.ByteArrayInputStream(bos1.toByteArray());
byte rbytes[] = new byte[100];
bis.read(rbytes, 0, 11);
- assertTrue("Incorrect string written", new String(rbytes, 0, 11)
- .equals("Hello World"));
+ assertEquals("Incorrect string written", "Hello World", new String(rbytes, 0, 11)
+ );
}
/**
@@ -361,7 +360,7 @@
os = new java.io.PrintStream(bos, true);
os.println('t');
bis = new java.io.ByteArrayInputStream(bos.toByteArray());
- assertTrue("Incorrect char written", bis.read() == 't');
+ assertEquals("Incorrect char written", 't', bis.read());
assertTrue("Newline not written", (c = bis.read()) == '\r' || c == '\n');
}
@@ -376,8 +375,8 @@
bis = new java.io.ByteArrayInputStream(bos.toByteArray());
byte[] rbuf = new byte[100];
bis.read(rbuf, 0, 16);
- assertTrue("Incorrect double written", new String(rbuf, 0, 16)
- .equals("2345.76834720202"));
+ assertEquals("Incorrect double written", "2345.76834720202", new String(rbuf, 0, 16)
+ );
assertTrue("Newline not written", (c = bis.read()) == '\r' || c == '\n');
}
@@ -392,8 +391,8 @@
os.println(29.08764f);
bis = new java.io.ByteArrayInputStream(bos.toByteArray());
bis.read(rbuf, 0, 8);
- assertTrue("Incorrect float written", new String(rbuf, 0, 8)
- .equals("29.08764"));
+ assertEquals("Incorrect float written", "29.08764", new String(rbuf, 0, 8)
+ );
assertTrue("Newline not written", (c = bis.read()) == '\r' || c == '\n');
}
@@ -408,8 +407,8 @@
byte[] rbuf = new byte[100];
bis = new java.io.ByteArrayInputStream(bos.toByteArray());
bis.read(rbuf, 0, 9);
- assertTrue("Incorrect int written", new String(rbuf, 0, 9)
- .equals("768347202"));
+ assertEquals("Incorrect int written", "768347202", new String(rbuf, 0, 9)
+ );
assertTrue("Newline not written", (c = bis.read()) == '\r' || c == '\n');
}
@@ -424,8 +423,8 @@
bis = new java.io.ByteArrayInputStream(bos.toByteArray());
byte[] rbuf = new byte[100];
bis.read(rbuf, 0, 13);
- assertTrue("Incorrect long written", new String(rbuf, 0, 13)
- .equals("9875645283333"));
+ assertEquals("Incorrect long written", "9875645283333", new String(rbuf, 0, 13)
+ );
assertTrue("Newline not written", (c = bis.read()) == '\r' || c == '\n');
}
@@ -440,8 +439,8 @@
bis = new java.io.ByteArrayInputStream(bos.toByteArray());
byte[] rbytes = new byte[2];
bis.read(rbytes, 0, 2);
- assertTrue("Incorrect Vector written", new String(rbytes, 0, 2)
- .equals("[]"));
+ assertEquals("Incorrect Vector written", "[]", new String(rbytes, 0, 2)
+ );
assertTrue("Newline not written", (c = (char) bis.read()) == '\r'
|| c == '\n');
}
@@ -457,8 +456,8 @@
bis = new java.io.ByteArrayInputStream(bos.toByteArray());
byte rbytes[] = new byte[100];
bis.read(rbytes, 0, 11);
- assertTrue("Incorrect string written", new String(rbytes, 0, 11)
- .equals("Hello World"));
+ assertEquals("Incorrect string written", "Hello World", new String(rbytes, 0, 11)
+ );
assertTrue("Newline not written", (c = (char) bis.read()) == '\r'
|| c == '\n');
}
@@ -474,8 +473,8 @@
bis = new java.io.ByteArrayInputStream(bos.toByteArray());
byte[] rbuf = new byte[100];
bis.read(rbuf, 0, 4);
- assertTrue("Incorrect boolean written", new String(rbuf, 0, 4)
- .equals("true"));
+ assertEquals("Incorrect boolean written", "true", new String(rbuf, 0, 4)
+ );
assertTrue("Newline not written", (c = bis.read()) == '\r' || c == '\n');
}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/PrintWriterTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/PrintWriterTest.java?rev=397123&r1=397122&r2=397123&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/PrintWriterTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/PrintWriterTest.java Wed Apr 26 00:12:16 2006
@@ -98,8 +98,8 @@
pw = new PrintWriter(sw = new Support_StringWriter());
pw.print("Hello");
pw.flush();
- assertTrue("Failed to construct proper writer", sw.toString().equals(
- "Hello"));
+ assertEquals("Failed to construct proper writer",
+ "Hello", sw.toString());
}
/**
@@ -111,8 +111,8 @@
pw = new PrintWriter(sw = new Support_StringWriter(), true);
pw.print("Hello");
// Auto-flush should have happened
- assertTrue("Failed to construct proper writer", sw.toString().equals(
- "Hello"));
+ assertEquals("Failed to construct proper writer",
+ "Hello", sw.toString());
}
/**
@@ -172,9 +172,8 @@
} catch (NullPointerException e) {
r = 1;
}
- assertTrue(
- "null pointer exception for printing null char[] is not caught",
- r == 1);
+ assertEquals("null pointer exception for printing null char[] is not caught",
+ 1, r);
}
/**
@@ -184,8 +183,8 @@
// Test for method void java.io.PrintWriter.print(char)
pw.print('c');
pw.flush();
- assertTrue("Wrote incorrect char string", new String(bao.toByteArray())
- .equals("c"));
+ assertEquals("Wrote incorrect char string", "c", new String(bao.toByteArray())
+ );
}
/**
@@ -219,8 +218,8 @@
// Test for method void java.io.PrintWriter.print(int)
pw.print(4908765);
pw.flush();
- assertTrue("Wrote incorrect int string", new String(bao.toByteArray())
- .equals("4908765"));
+ assertEquals("Wrote incorrect int string", "4908765", new String(bao.toByteArray())
+ );
}
/**
@@ -230,8 +229,8 @@
// Test for method void java.io.PrintWriter.print(long)
pw.print(49087650000L);
pw.flush();
- assertTrue("Wrote incorrect long string", new String(bao.toByteArray())
- .equals("49087650000"));
+ assertEquals("Wrote incorrect long string", "49087650000", new String(bao.toByteArray())
+ );
}
/**
@@ -241,14 +240,14 @@
// Test for method void java.io.PrintWriter.print(java.lang.Object)
pw.print((Object) null);
pw.flush();
- assertTrue("Did not write null", new String(bao.toByteArray())
- .equals("null"));
+ assertEquals("Did not write null", "null", new String(bao.toByteArray())
+ );
bao.reset();
pw.print(new Bogus());
pw.flush();
- assertTrue("Wrote in incorrect Object string", new String(bao
- .toByteArray()).equals("Bogus"));
+ assertEquals("Wrote in incorrect Object string", "Bogus", new String(bao
+ .toByteArray()));
}
/**
@@ -258,14 +257,14 @@
// Test for method void java.io.PrintWriter.print(java.lang.String)
pw.print((String) null);
pw.flush();
- assertTrue("did not write null", new String(bao.toByteArray())
- .equals("null"));
+ assertEquals("did not write null", "null", new String(bao.toByteArray())
+ );
bao.reset();
pw.print("Hello World");
pw.flush();
- assertTrue("Wrote incorrect string", new String(bao.toByteArray())
- .equals("Hello World"));
+ assertEquals("Wrote incorrect string", "Hello World", new String(bao.toByteArray())
+ );
}
/**
@@ -275,8 +274,8 @@
// Test for method void java.io.PrintWriter.print(boolean)
pw.print(true);
pw.flush();
- assertTrue("Wrote in incorrect boolean string", new String(bao
- .toByteArray()).equals("true"));
+ assertEquals("Wrote in incorrect boolean string", "true", new String(bao
+ .toByteArray()));
}
/**
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/PushbackReaderTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/PushbackReaderTest.java?rev=397123&r1=397122&r2=397123&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/PushbackReaderTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/PushbackReaderTest.java Wed Apr 26 00:12:16 2006
@@ -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);
}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/SerializablePermissionTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/SerializablePermissionTest.java?rev=397123&r1=397122&r2=397123&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/SerializablePermissionTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/SerializablePermissionTest.java Wed Apr 26 00:12:16 2006
@@ -24,9 +24,9 @@
*/
public void test_ConstructorLjava_lang_String() {
// Test for method java.io.SerializablePermission(java.lang.String)
- assertTrue("permission ill-formed", new SerializablePermission(
- "enableSubclassImplementation").getName().equals(
- "enableSubclassImplementation"));
+ assertEquals("permission ill-formed",
+ "enableSubclassImplementation", new SerializablePermission(
+ "enableSubclassImplementation").getName());
}
/**
@@ -36,9 +36,9 @@
public void test_ConstructorLjava_lang_StringLjava_lang_String() {
// Test for method java.io.SerializablePermission(java.lang.String,
// java.lang.String)
- assertTrue("permission ill-formed", new SerializablePermission(
- "enableSubclassImplementation", "").getName().equals(
- "enableSubclassImplementation"));
+ assertEquals("permission ill-formed",
+ "enableSubclassImplementation", new SerializablePermission(
+ "enableSubclassImplementation", "").getName());
}
/**
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/SerializationStressTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/SerializationStressTest.java?rev=397123&r1=397122&r2=397123&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/SerializationStressTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/SerializationStressTest.java Wed Apr 26 00:12:16 2006
@@ -398,7 +398,7 @@
oos.write('T');
oos.close();
ois = new ObjectInputStream(loadStream());
- assertTrue("Read incorrect byte", ois.read() == 'T');
+ assertEquals("Read incorrect byte", 'T', ois.read());
ois.close();
} catch (IOException e) {
fail("IOException serializing data : " + e.getMessage());
@@ -414,8 +414,8 @@
ois = new ObjectInputStream(loadStream());
ois.read(buf, 0, 10);
ois.close();
- assertTrue("Read incorrect bytes", new String(buf, 0, 10)
- .equals("HelloWorld"));
+ assertEquals("Read incorrect bytes", "HelloWorld", new String(buf, 0, 10)
+ );
} catch (IOException e) {
fail("IOException serializing data : " + e.getMessage());
}
@@ -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());
}
@@ -455,8 +455,8 @@
ois = new ObjectInputStream(loadStream());
ois.readFully(buf);
ois.close();
- assertTrue("Wrote incorrect bytes value", new String(buf, 0, 10)
- .equals("HelloWorld"));
+ assertEquals("Wrote incorrect bytes value", "HelloWorld", new String(buf, 0, 10)
+ );
} catch (IOException e) {
fail("IOException serializing data : " + e.getMessage());
}
@@ -468,7 +468,7 @@
oos.writeChar('T');
oos.close();
ois = new ObjectInputStream(loadStream());
- assertTrue("Wrote incorrect char value", ois.readChar() == 'T');
+ assertEquals("Wrote incorrect char value", 'T', ois.readChar());
} catch (IOException e) {
fail("IOException serializing data : " + e.getMessage());
}
@@ -488,8 +488,8 @@
for (int i = 0; i < avail; ++i)
buf[i] = ois.readChar();
ois.close();
- assertTrue("Wrote incorrect chars", new String(buf, 0, 10)
- .equals("HelloWorld"));
+ assertEquals("Wrote incorrect chars", "HelloWorld", new String(buf, 0, 10)
+ );
} catch (IOException e) {
fail("IOException serializing data : " + e.getMessage());
}
@@ -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());
}
@@ -569,8 +569,8 @@
oos.writeUTF("HelloWorld");
oos.close();
ois = new ObjectInputStream(loadStream());
- assertTrue("Wrote incorrect UTF value", ois.readUTF().equals(
- "HelloWorld"));
+ assertEquals("Wrote incorrect UTF value",
+ "HelloWorld", ois.readUTF());
} catch (IOException e) {
fail("IOException serializing data : " + e.getMessage());
}
@@ -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);
@@ -679,9 +679,9 @@
assertTrue("incorrect output", Arrays.equals(input, result));
ois = new ObjectInputStreamSubclass(loadStream());
- assertTrue("Wrong result from readObject()", ois.readObject()
- .equals("R"));
- assertTrue("Wrong result from readByte()", ois.readByte() == 24);
+ assertEquals("Wrong result from readObject()", "R", ois.readObject()
+ );
+ assertEquals("Wrong result from readByte()", 24, ois.readByte());
ois.close();
} catch (IOException e1) {
fail("IOException : " + e1.getMessage());
@@ -770,7 +770,7 @@
} catch (ClassNotFoundException e) {
fail(e.toString());
}
- assertTrue("String not resolved", "ABC".equals(result.field1));
+ assertEquals("String not resolved", "ABC", result.field1);
assertTrue("Second reference not resolved",
result.field1 == result.field2);
} catch (IOException e) {
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/SerializationStressTest1.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/SerializationStressTest1.java?rev=397123&r1=397122&r2=397123&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/SerializationStressTest1.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/SerializationStressTest1.java Wed Apr 26 00:12:16 2006
@@ -742,8 +742,8 @@
objLoaded = dumpAndReload(objToSave);
// non-serializable inst var has to be initialized from top
// constructor
- assertTrue(MSG_TEST_FAILED + objToSave,
- ((SpecTest) objLoaded).instVar == null);
+ assertNull(MSG_TEST_FAILED + objToSave,
+ ((SpecTest) objLoaded).instVar);
// instVar from non-serialized class, cant be saved/restored
// by serialization but serialized ivar has to be restored as it
// was in the object when dumped
@@ -780,8 +780,8 @@
objLoaded = dumpAndReload(objToSave);
// non-serializable inst var cant be saved, and it is not init'ed
// from top constructor in this case
- assertTrue(MSG_TEST_FAILED + objToSave,
- ((SpecTestSubclass) objLoaded).transientInstVar == null);
+ assertNull(MSG_TEST_FAILED + objToSave,
+ ((SpecTestSubclass) objLoaded).transientInstVar);
// transient slot, cant be saved/restored by serialization
} catch (IOException e) {
fail("Exception serializing " + objToSave + "\t->"
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/SerializationStressTest2.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/SerializationStressTest2.java?rev=397123&r1=397122&r2=397123&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/SerializationStressTest2.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/SerializationStressTest2.java Wed Apr 26 00:12:16 2006
@@ -1297,8 +1297,8 @@
System.out.println("Obj = " + objToSave);
objLoaded = dumpAndReload(objToSave);
// Has to have worked
- assertTrue(MSG_TEST_FAILED + objToSave,
- ((NestedPutField) objLoaded).field1 != null);
+ assertNotNull(MSG_TEST_FAILED + objToSave,
+ ((NestedPutField) objLoaded).field1);
} catch (IOException e) {
fail("IOException serializing " + objToSave + " : "
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/StreamTokenizerTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/StreamTokenizerTest.java?rev=397123&r1=397122&r2=397123&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/StreamTokenizerTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/StreamTokenizerTest.java Wed Apr 26 00:12:16 2006
@@ -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");
@@ -156,8 +155,8 @@
st.lowerCaseMode(true);
try {
st.nextToken();
- assertTrue("sval not converted to lowercase.", st.sval
- .equals("helloworld"));
+ assertEquals("sval not converted to lowercase.", "helloworld", st.sval
+ );
} catch (Exception e) {
fail("Exception during test : " + e.getMessage());
}
@@ -225,7 +224,7 @@
tokenizer.eolIsSignificant(true);
assertTrue("Wrong token 2,1", tokenizer.nextToken() == '\n');
assertTrue("Wrong token 2,2", tokenizer.nextToken() == '\n');
- assertTrue("Wrong token 2,3", tokenizer.nextToken() == '#');
+ assertEquals("Wrong token 2,3", '#', tokenizer.nextToken());
} catch (IOException e) {
fail("IOException during test 2 : " + e.getMessage());
}
@@ -255,8 +254,8 @@
setTest("azbc iof z 893");
st.ordinaryChars('a', 'z');
try {
- assertTrue("OrdinaryChars failed.", st.nextToken() == 'a');
- assertTrue("OrdinaryChars failed.", st.nextToken() == 'z');
+ assertEquals("OrdinaryChars failed.", 'a', st.nextToken());
+ assertEquals("OrdinaryChars failed.", 'z', st.nextToken());
} catch (Exception e) {
fail("Exception during test : " + e.getMessage());
}
@@ -272,7 +271,7 @@
assertTrue("Base behavior failed.",
st.nextToken() == StreamTokenizer.TT_NUMBER);
st.ordinaryChars('0', '9');
- assertTrue("setOrdinary failed.", st.nextToken() == '6');
+ assertEquals("setOrdinary failed.", '6', st.nextToken());
st.parseNumbers();
assertTrue("parseNumbers failed.",
st.nextToken() == StreamTokenizer.TT_NUMBER);
@@ -305,12 +304,12 @@
setTest("<Hello World< HelloWorldH");
st.quoteChar('<');
try {
- assertTrue("QuoteChar failed.", st.nextToken() == '<');
- assertTrue("QuoteChar failed.", st.sval.equals("Hello World"));
+ assertEquals("QuoteChar failed.", '<', st.nextToken());
+ assertEquals("QuoteChar failed.", "Hello World", st.sval);
st.quoteChar('H');
st.nextToken();
- assertTrue("QuoteChar failed for word.", st.sval
- .equals("elloWorld"));
+ assertEquals("QuoteChar failed for word.", "elloWorld", st.sval
+ );
} catch (Exception e) {
fail("Exception during test : " + e.getMessage());
}
@@ -346,7 +345,7 @@
st.ordinaryChar('/');
st.slashSlashComments(true);
try {
- assertTrue("Test failed.", st.nextToken() == '/');
+ assertEquals("Test failed.", '/', st.nextToken());
assertTrue("Test failed.",
st.nextToken() == StreamTokenizer.TT_WORD);
} catch (Exception e) {
@@ -405,17 +404,17 @@
try {
assertTrue("WordChar failed1.",
st.nextToken() == StreamTokenizer.TT_WORD);
- assertTrue("WordChar failed2.", st.sval.equals("A893"));
+ assertEquals("WordChar failed2.", "A893", st.sval);
assertTrue("WordChar failed3.",
st.nextToken() == StreamTokenizer.TT_NUMBER);
st.nextToken();
- assertTrue("WordChar failed4.", st.sval.equals("B87"));
+ assertEquals("WordChar failed4.", "B87", st.sval);
setTest(" Hello World");
st.wordChars(' ', ' ');
st.nextToken();
- assertTrue("WordChars failed for whitespace.", st.sval
- .equals("Hello World"));
+ assertEquals("WordChars failed for whitespace.", "Hello World", st.sval
+ );
setTest(" Hello World\r\n \'Hello World\' Hello\' World");
st.wordChars(' ', ' ');
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/StringBufferInputStreamTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/StringBufferInputStreamTest.java?rev=397123&r1=397122&r2=397123&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/StringBufferInputStreamTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/StringBufferInputStreamTest.java Wed Apr 26 00:12:16 2006
@@ -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());
}
/**
@@ -45,7 +45,7 @@
byte[] buf = new byte[5];
sbis.skip(6);
sbis.read(buf, 0, 5);
- assertTrue("Returned incorrect chars", new String(buf).equals("World"));
+ assertEquals("Returned incorrect chars", "World", new String(buf));
}
/**
@@ -54,7 +54,7 @@
public void test_read$BII() {
// Test for method int java.io.StringBufferInputStream.read(byte [],
// int, int)
- assertTrue("Read returned incorrect char", sbis.read() == 'H');
+ assertEquals("Read returned incorrect char", 'H', sbis.read());
}
/**
@@ -63,9 +63,9 @@
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');
+ assertEquals("Failed to reset", 'H', sbis.read());
}
/**
@@ -74,8 +74,8 @@
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);
- assertTrue("Skip positioned at incorrect char", sbis.read() == 'W');
+ assertEquals("Unable to skip correct umber of chars", 6, s);
+ assertEquals("Skip positioned at incorrect char", 'W', sbis.read());
}
/**
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/StringReaderTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/StringReaderTest.java?rev=397123&r1=397122&r2=397123&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/StringReaderTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/StringReaderTest.java Wed Apr 26 00:12:16 2006
@@ -86,7 +86,7 @@
try {
sr = new StringReader(testString);
int r = sr.read();
- assertTrue("Failed to read char", r == 'T');
+ assertEquals("Failed to read char", 'T', r);
sr = new StringReader(new String(new char[] { '\u8765' }));
assertTrue("Wrong double byte char", sr.read() == '\u8765');
} catch (Exception e) {
@@ -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());
}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/StringWriterTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/StringWriterTest.java?rev=397123&r1=397122&r2=397123&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/StringWriterTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/StringWriterTest.java Wed Apr 26 00:12:16 2006
@@ -49,7 +49,7 @@
// Test for method void java.io.StringWriter.flush()
sw.flush();
sw.write('c');
- assertTrue("Failed to flush char", sw.toString().equals("c"));
+ assertEquals("Failed to flush char", "c", sw.toString());
}
/**
@@ -61,8 +61,8 @@
sw.write("This is a test string");
StringBuffer sb = sw.getBuffer();
- assertTrue("Incorrect buffer returned", sb.toString().equals(
- "This is a test string"));
+ assertEquals("Incorrect buffer returned",
+ "This is a test string", sb.toString());
}
/**
@@ -71,8 +71,8 @@
public void test_toString() {
// Test for method java.lang.String java.io.StringWriter.toString()
sw.write("This is a test string");
- assertTrue("Incorrect string returned", sw.toString().equals(
- "This is a test string"));
+ assertEquals("Incorrect string returned",
+ "This is a test string", sw.toString());
}
/**
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/ArrayIndexOutOfBoundsExceptionTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/ArrayIndexOutOfBoundsExceptionTest.java?rev=397123&r1=397122&r2=397123&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/ArrayIndexOutOfBoundsExceptionTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/ArrayIndexOutOfBoundsExceptionTest.java Wed Apr 26 00:12:16 2006
@@ -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);
}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/AssertionErrorTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/AssertionErrorTest.java?rev=397123&r1=397122&r2=397123&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/AssertionErrorTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/AssertionErrorTest.java Wed Apr 26 00:12:16 2006
@@ -21,8 +21,8 @@
*/
public void test_ObjectConstructor() {
AssertionError error = new AssertionError(new String("hi"));
- assertTrue("non-null cause", error.getCause() == null);
- assertTrue(error.getMessage().equals("hi"));
+ assertNull("non-null cause", error.getCause());
+ assertEquals("hi", error.getMessage());
Exception exc = new NullPointerException();
error = new AssertionError(exc);
assertTrue("non-null cause", error.getCause() == exc);
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/BooleanTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/BooleanTest.java?rev=397123&r1=397122&r2=397123&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/BooleanTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/BooleanTest.java Wed Apr 26 00:12:16 2006
@@ -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());
}
/**
@@ -113,10 +113,10 @@
*/
public void test_toString() {
// Test for method java.lang.String java.lang.Boolean.toString()
- assertTrue("Boolean true value printed wrong.", t.toString().equals(
- "true"));
- assertTrue("Boolean false value printed wrong.", f.toString().equals(
- "false"));
+ assertEquals("Boolean true value printed wrong.",
+ "true", t.toString());
+ assertEquals("Boolean false value printed wrong.",
+ "false", f.toString());
}
/**
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/ByteTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/ByteTest.java?rev=397123&r1=397122&r2=397123&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/ByteTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/ByteTest.java Wed Apr 26 00:12:16 2006
@@ -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)));
}
/**
@@ -159,8 +159,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());
}
/**
@@ -168,8 +168,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());
}
/**
@@ -177,8 +177,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());
}
/**
@@ -191,7 +191,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
@@ -234,15 +234,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",
@@ -308,12 +308,12 @@
*/
public void test_toString() {
// Test for method java.lang.String java.lang.Byte.toString()
- assertTrue("Returned incorrect String", new Byte((byte) 127).toString()
- .equals("127"));
- assertTrue("Returned incorrect String", new Byte((byte) -127)
- .toString().equals("-127"));
- assertTrue("Returned incorrect String", new Byte((byte) -128)
- .toString().equals("-128"));
+ assertEquals("Returned incorrect String", "127", new Byte((byte) 127).toString()
+ );
+ assertEquals("Returned incorrect String", "-127", new Byte((byte) -127)
+ .toString());
+ assertEquals("Returned incorrect String", "-128", new Byte((byte) -128)
+ .toString());
}
/**
@@ -321,12 +321,12 @@
*/
public void test_toStringB() {
// Test for method java.lang.String java.lang.Byte.toString(byte)
- assertTrue("Returned incorrect String", Byte.toString((byte) 127)
- .equals("127"));
- assertTrue("Returned incorrect String", Byte.toString((byte) -127)
- .equals("-127"));
- assertTrue("Returned incorrect String", Byte.toString((byte) -128)
- .equals("-128"));
+ assertEquals("Returned incorrect String", "127", Byte.toString((byte) 127)
+ );
+ assertEquals("Returned incorrect String", "-127", Byte.toString((byte) -127)
+ );
+ assertEquals("Returned incorrect String", "-128", Byte.toString((byte) -128)
+ );
}
/**
@@ -335,14 +335,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");
@@ -359,20 +359,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);
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/CharacterTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/CharacterTest.java?rev=397123&r1=397122&r2=397123&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/CharacterTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/CharacterTest.java Wed Apr 26 00:12:16 2006
@@ -22,7 +22,7 @@
*/
public void test_ConstructorC() {
// Test for method java.lang.Character(char)
- assertTrue("Constructor failed", new Character('T').charValue() == 'T');
+ assertEquals("Constructor failed", 'T', new Character('T').charValue());
}
/**
@@ -30,8 +30,8 @@
*/
public void test_charValue() {
// Test for method char java.lang.Character.charValue()
- assertTrue("Incorrect char value returned", new Character('T')
- .charValue() == 'T');
+ assertEquals("Incorrect char value returned", 'T', new Character('T')
+ .charValue());
}
/**
@@ -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
@@ -59,8 +59,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));
}
/**
@@ -102,18 +102,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'));
}
/**
@@ -142,9 +142,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);
}
/**
@@ -152,8 +152,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());
}
/**
@@ -405,7 +405,7 @@
*/
public void test_toLowerCaseC() {
// Test for method char java.lang.Character.toLowerCase(char)
- assertTrue("Failed to change case", Character.toLowerCase('T') == 't');
+ assertEquals("Failed to change case", 't', Character.toLowerCase('T'));
}
/**
@@ -413,8 +413,8 @@
*/
public void test_toString() {
// Test for method java.lang.String java.lang.Character.toString()
- assertTrue("Incorrect String returned", new Character('T').toString()
- .equals("T"));
+ assertEquals("Incorrect String returned", "T", new Character('T').toString()
+ );
}
/**
@@ -422,12 +422,12 @@
*/
public void test_toTitleCaseC() {
// Test for method char java.lang.Character.toTitleCase(char)
- assertTrue("Incorrect title case for a",
- Character.toTitleCase('a') == 'A');
- assertTrue("Incorrect title case for A",
- Character.toTitleCase('A') == 'A');
- assertTrue("Incorrect title case for 1",
- Character.toTitleCase('1') == '1');
+ assertEquals("Incorrect title case for a",
+ 'A', Character.toTitleCase('a'));
+ assertEquals("Incorrect title case for A",
+ 'A', Character.toTitleCase('A'));
+ assertEquals("Incorrect title case for 1",
+ '1', Character.toTitleCase('1'));
}
/**
@@ -435,12 +435,12 @@
*/
public void test_toUpperCaseC() {
// Test for method char java.lang.Character.toUpperCase(char)
- assertTrue("Incorrect upper case for a",
- Character.toUpperCase('a') == 'A');
- assertTrue("Incorrect upper case for A",
- Character.toUpperCase('A') == 'A');
- assertTrue("Incorrect upper case for 1",
- Character.toUpperCase('1') == '1');
+ assertEquals("Incorrect upper case for a",
+ 'A', Character.toUpperCase('a'));
+ assertEquals("Incorrect upper case for A",
+ 'A', Character.toUpperCase('A'));
+ assertEquals("Incorrect upper case for 1",
+ '1', Character.toUpperCase('1'));
}
/**
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/ClassLoaderTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/ClassLoaderTest.java?rev=397123&r1=397122&r2=397123&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/ClassLoaderTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/ClassLoaderTest.java Wed Apr 26 00:12:16 2006
@@ -25,11 +25,11 @@
// java.lang.ClassLoader.getResource(java.lang.String)
java.net.URL u = ClassLoader.getSystemClassLoader().getResource(
"hyts_Foo.c");
- assertTrue("Unable to find resource", u != null);
+ assertNotNull("Unable to find resource", u);
java.io.InputStream is = null;
try {
is = u.openStream();
- assertTrue("Resource returned is invalid", is != null);
+ assertNotNull("Resource returned is invalid", is);
is.close();
} catch (java.io.IOException e) {
fail("IOException getting stream for resource : " + e.getMessage());
@@ -45,9 +45,9 @@
// Need better test...
java.io.InputStream is = null;
- assertTrue("Failed to find resource: hyts_Foo.c",
+ assertNotNull("Failed to find resource: hyts_Foo.c",
(is = ClassLoader.getSystemClassLoader().getResourceAsStream(
- "hyts_Foo.c")) != null);
+ "hyts_Foo.c")));
try {
is.close();
} catch (java.io.IOException e) {
@@ -63,7 +63,7 @@
// java.lang.ClassLoader.getSystemClassLoader()
ClassLoader cl = ClassLoader.getSystemClassLoader();
java.io.InputStream is = cl.getResourceAsStream("hyts_Foo.c");
- assertTrue("Failed to find resource from system classpath", is != null);
+ assertNotNull("Failed to find resource from system classpath", is);
try {
is.close();
} catch (java.io.IOException e) {
@@ -78,8 +78,8 @@
// Test for method java.net.URL
// java.lang.ClassLoader.getSystemResource(java.lang.String)
// Need better test...
- assertTrue("Failed to find resource: hyts_Foo.c", ClassLoader
- .getSystemResource("hyts_Foo.c") != null);
+ assertNotNull("Failed to find resource: hyts_Foo.c", ClassLoader
+ .getSystemResource("hyts_Foo.c"));
}
/**
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/ClassTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/ClassTest.java?rev=397123&r1=397122&r2=397123&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/ClassTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/ClassTest.java Wed Apr 26 00:12:16 2006
@@ -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);
}
/**
@@ -391,8 +391,8 @@
.getComponentType() == int.class);
assertTrue("Object array does not have Object component type",
Object[].class.getComponentType() == Object.class);
- assertTrue("Object has non-null component type", Object.class
- .getComponentType() == null);
+ assertNull("Object has non-null component type", Object.class
+ .getComponentType());
}
/**
@@ -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);
}
/**
@@ -451,8 +451,8 @@
try {
java.lang.reflect.Constructor c = TestClass.class
.getDeclaredConstructor(new Class[0]);
- assertTrue("Incorrect constructor returned", ((TestClass) (c
- .newInstance(new Object[0]))).cValue() == null);
+ assertNull("Incorrect constructor returned", ((TestClass) (c
+ .newInstance(new Object[0]))).cValue());
c = TestClass.class
.getDeclaredConstructor(new Class[] { Object.class });
} catch (NoSuchMethodException e) {
@@ -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) {
@@ -737,11 +737,11 @@
System.setSecurityManager(new SecurityManager());
try {
java.net.URL res = Object.class.getResource("Object.class");
- assertTrue("Object.class should not be found", res == null);
+ assertNull("Object.class should not be found", res);
- assertTrue("Security: the file " + name
+ assertNotNull("Security: the file " + name
+ " can not be found in this directory", ClassTest.class
- .getResource(name) != null);
+ .getResource(name));
} finally {
System.setSecurityManager(null);
}
@@ -762,27 +762,27 @@
fail(
"Should be able to find the class tests.api.java.lang.ClassTest");
}
- assertTrue("the file " + name + " can not be found in this directory",
- clazz.getResourceAsStream(name) != null);
+ assertNotNull("the file " + name + " can not be found in this directory",
+ clazz.getResourceAsStream(name));
System.setSecurityManager(new SecurityManager());
try {
InputStream res = Object.class.getResourceAsStream("Object.class");
- assertTrue("Object.class should not be found", res == null);
+ assertNull("Object.class should not be found", res);
InputStream is = ClassTest.class.getResourceAsStream(name);
- assertTrue("Security: the file " + name
- + " can not be found in this directory", is != null);
+ assertNotNull("Security: the file " + name
+ + " can not be found in this directory", is);
} finally {
System.setSecurityManager(null);
}
name = "hyts_Foo.c";
- assertTrue("the file " + name
+ assertNull("the file " + name
+ " should not be found in this directory", clazz
- .getResourceAsStream(name) == null);
- assertTrue("the file " + name
+ .getResourceAsStream(name));
+ assertNotNull("the file " + name
+ " can not be found in the root directory", clazz
- .getResourceAsStream("/" + name) != null);
+ .getResourceAsStream("/" + name));
try {
clazz = Class.forName("java.lang.Object");
@@ -790,12 +790,12 @@
fail("Should be able to find the class java.lang.Object");
}
InputStream str = clazz.getResourceAsStream("Class.class");
- assertTrue(
+ assertNotNull(
"java.lang.Object couldn't find its class with getResource...",
- str != null);
+ str);
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.");
@@ -803,11 +803,11 @@
InputStream str2 = getClass().getResourceAsStream(
Support_Resources.RESOURCE_PACKAGE + "hyts_compressD.txt");
- assertTrue("Can't find resource", str2 != null);
+ assertNotNull("Can't find resource", str2);
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 : "
@@ -822,17 +822,17 @@
public void test_getSuperclass() {
// Test for method java.lang.Class java.lang.Class.getSuperclass()
- assertTrue("Object has a superclass???",
- Object.class.getSuperclass() == null);
+ assertNull("Object has a superclass???",
+ Object.class.getSuperclass());
assertTrue(
"Normal class has bogus superclass",
java.io.FileInputStream.class.getSuperclass() == java.io.InputStream.class);
assertTrue("Array class has bogus superclass",
java.io.FileInputStream[].class.getSuperclass() == Object.class);
- assertTrue("Base class has a superclass",
- int.class.getSuperclass() == null);
- assertTrue("Interface class has a superclass", Cloneable.class
- .getSuperclass() == null);
+ assertNull("Base class has a superclass",
+ int.class.getSuperclass());
+ assertNull("Interface class has a superclass", Cloneable.class
+ .getSuperclass());
}
/**
@@ -980,8 +980,8 @@
} catch (ClassNotFoundException e) {
fail("Should be able to find the class java.lang.Object");
}
- assertTrue("new object instance was null",
- clazz.newInstance() != null);
+ assertNotNull("new object instance was null",
+ clazz.newInstance());
} catch (Exception e) {
fail("Unexpected exception " + e + " in newInstance()");
}
@@ -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.
}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/CompilerTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/CompilerTest.java?rev=397123&r1=397122&r2=397123&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/CompilerTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/CompilerTest.java Wed Apr 26 00:12:16 2006
@@ -24,8 +24,8 @@
// Test for method java.lang.Object
// java.lang.Compiler.command(java.lang.Object)
try {
- assertTrue("Incorrect behavior.",
- Compiler.command(new Object()) == null);
+ assertNull("Incorrect behavior.",
+ Compiler.command(new Object()));
} catch (Exception e) {
fail("Exception during test : " + e.getMessage());
}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/DoubleTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/DoubleTest.java?rev=397123&r1=397122&r2=397123&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/DoubleTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/DoubleTest.java Wed Apr 26 00:12:16 2006
@@ -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());
}
/**
@@ -377,9 +377,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());
}
/**
@@ -428,8 +427,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());
}
/**
@@ -438,7 +437,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());
}
/**
@@ -505,15 +504,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);
@@ -669,7 +668,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());
}
/**
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/ErrorTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/ErrorTest.java?rev=397123&r1=397122&r2=397123&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/ErrorTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/ErrorTest.java Wed Apr 26 00:12:16 2006
@@ -40,8 +40,8 @@
if (true)
throw new Error("Throw an Error");
} catch (Error e) {
- assertTrue("Incorrect message string generated", e.getMessage()
- .equals("Throw an Error"));
+ assertEquals("Incorrect message string generated", "Throw an Error", e.getMessage()
+ );
return;
}
fail("Failed to generate Error");
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/ExceptionInInitializerErrorTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/ExceptionInInitializerErrorTest.java?rev=397123&r1=397122&r2=397123&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/ExceptionInInitializerErrorTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/ExceptionInInitializerErrorTest.java Wed Apr 26 00:12:16 2006
@@ -27,8 +27,8 @@
} catch (ExceptionInInitializerError e) {
assertTrue("Initializer failed." + e.toString(), e.toString()
.equals("java.lang.ExceptionInInitializerError"));
- assertTrue("Initializer failed.", e.getException() == null);
- assertTrue("Initializer failed.", e.getMessage() == null);
+ assertNull("Initializer failed.", e.getException());
+ assertNull("Initializer failed.", e.getMessage());
return;
}
fail("Constructor failed.");
@@ -60,8 +60,8 @@
}
fail("Constructor failed.");
} catch (ExceptionInInitializerError e) {
- assertTrue("Initializer failed." + e.getMessage(),
- e.getMessage() == null);
+ assertNull("Initializer failed." + e.getMessage(),
+ e.getMessage());
assertTrue("Initializer failed." + e.toString(),
e.getException() != null
&& e.getException().getMessage().equals(
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/ExceptionTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/ExceptionTest.java?rev=397123&r1=397122&r2=397123&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/ExceptionTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/ExceptionTest.java Wed Apr 26 00:12:16 2006
@@ -40,8 +40,8 @@
if (true)
throw new Exception("Throw an Error");
} catch (Exception e) {
- assertTrue("Incorrect message string generated", e.getMessage()
- .equals("Throw an Error"));
+ assertEquals("Incorrect message string generated", "Throw an Error", e.getMessage()
+ );
return;
}
fail("Failed to generate Error");
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/FloatTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/FloatTest.java?rev=397123&r1=397122&r2=397123&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/FloatTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/FloatTest.java Wed Apr 26 00:12:16 2006
@@ -349,11 +349,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",
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/IllegalArgumentExceptionTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/IllegalArgumentExceptionTest.java?rev=397123&r1=397122&r2=397123&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/IllegalArgumentExceptionTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/IllegalArgumentExceptionTest.java Wed Apr 26 00:12:16 2006
@@ -37,8 +37,8 @@
public void test_Constructor() {
// Test for method java.lang.IllegalArgumentException()
IllegalArgumentException ill = new IllegalArgumentException();
- assertTrue("failed to create an instance of illegalArgumentException",
- ill.getMessage() == null);
+ assertNull("failed to create an instance of illegalArgumentException",
+ ill.getMessage());
try {
try {
new java.io.ByteArrayOutputStream(-12);
@@ -58,9 +58,8 @@
// Test for method java.lang.IllegalArgumentException(java.lang.String)
IllegalArgumentException ill = new IllegalArgumentException(
"testing illArg exception");
- assertTrue(
- "failed to create instance of illegalArgumentException(string)",
- ill.getMessage().equals("testing illArg exception"));
+ assertEquals("failed to create instance of illegalArgumentException(string)",
+ "testing illArg exception", ill.getMessage());
}
/**
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/IllegalStateExceptionTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/IllegalStateExceptionTest.java?rev=397123&r1=397122&r2=397123&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/IllegalStateExceptionTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/lang/IllegalStateExceptionTest.java Wed Apr 26 00:12:16 2006
@@ -28,8 +28,8 @@
public void test_Constructor() {
// Test for method java.lang.IllegalStateException()
IllegalStateException ill = new IllegalStateException();
- assertTrue("failed to create an instance of illegalStateException", ill
- .getMessage() == null);
+ assertNull("failed to create an instance of illegalStateException",
+ ill.getMessage());
}
/**
@@ -39,9 +39,8 @@
// Test for method java.lang.IllegalStateException(java.lang.String)
IllegalStateException ill = new IllegalStateException(
"testing illState exception");
- assertTrue(
- "failed to create instance of illegalStateException(string)",
- ill.getMessage().equals("testing illState exception"));
+ assertEquals("failed to create instance of illegalStateException(string)",
+ "testing illState exception", ill.getMessage());
}
/**