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/25 14:06:40 UTC
svn commit: r396855 - in
/incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util:
jar/ zip/
Author: smishura
Date: Tue Apr 25 05:06:23 2006
New Revision: 396855
URL: http://svn.apache.org/viewcvs?rev=396855&view=rev
Log:
Apply patch for HARMONY-353 (improvements to junit test method usage) for archive module. All archive tests passed on Windows.
Modified:
incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/jar/AttributesTest.java
incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/jar/JarEntryTest.java
incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/jar/JarFileTest.java
incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/jar/JarInputStreamTest.java
incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/jar/ManifestTest.java
incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/zip/Adler32Test.java
incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/zip/CRC32Test.java
incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/zip/CheckedInputStreamTest.java
incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/zip/CheckedOutputStreamTest.java
incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/zip/DeflaterOutputStreamTest.java
incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/zip/DeflaterTest.java
incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/zip/GZIPInputStreamTest.java
incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/zip/GZIPOutputStreamTest.java
incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/zip/InflaterInputStreamTest.java
incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/zip/InflaterTest.java
incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/zip/ZipEntryTest.java
incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/zip/ZipFileTest.java
incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/zip/ZipInputStreamTest.java
incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/zip/ZipOutputStreamTest.java
Modified: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/jar/AttributesTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/jar/AttributesTest.java?rev=396855&r1=396854&r2=396855&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/jar/AttributesTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/jar/AttributesTest.java Tue Apr 25 05:06:23 2006
@@ -49,14 +49,14 @@
public void test_clear() {
// Test for method void java.util.jar.Attributes.clear()
a.clear();
- assertTrue("a) All entries should be null after clear",
- a.get("1") == null);
- assertTrue("b) All entries should be null after clear",
- a.get("2") == null);
- assertTrue("c) All entries should be null after clear",
- a.get("3") == null);
- assertTrue("d) All entries should be null after clear",
- a.get("4") == null);
+ assertNull("a) All entries should be null after clear",
+ a.get("1"));
+ assertNull("b) All entries should be null after clear",
+ a.get("2"));
+ assertNull("c) All entries should be null after clear",
+ a.get("3"));
+ assertNull("d) All entries should be null after clear",
+ a.get("4"));
assertTrue("Should not contain any keys", !a.containsKey("1"));
}
@@ -124,8 +124,8 @@
public void test_getLjava_lang_Object() {
// Test for method java.lang.Object
// java.util.jar.Attributes.get(java.lang.Object)
- assertTrue("a) Incorrect value returned", a.getValue("1").equals("one"));
- assertTrue("b) Incorrect value returned", a.getValue("0") == null);
+ assertEquals("a) Incorrect value returned", "one", a.getValue("1"));
+ assertNull("b) Incorrect value returned", a.getValue("0"));
}
/**
@@ -177,10 +177,10 @@
b.putValue("5", "go");
b.putValue("6", "roku");
a.putAll(b);
- assertTrue("Should not have been replaced", a.getValue("1").equals(
- "one"));
- assertTrue("Should have been replaced", a.getValue("3").equals("san"));
- assertTrue("Should have been added", a.getValue("5").equals("go"));
+ assertEquals("Should not have been replaced",
+ "one", a.getValue("1"));
+ assertEquals("Should have been replaced", "san", a.getValue("3"));
+ assertEquals("Should have been added", "go", a.getValue("5"));
}
@@ -192,9 +192,9 @@
// java.util.jar.Attributes.remove(java.lang.Object)
a.remove(new Attributes.Name("1"));
a.remove(new Attributes.Name("3"));
- assertTrue("Should have been removed", a.getValue("1") == null);
- assertTrue("Should not have been removed", a.getValue("4").equals(
- "four"));
+ assertNull("Should have been removed", a.getValue("1"));
+ assertEquals("Should not have been removed",
+ "four", a.getValue("4"));
}
/**
@@ -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);
Modified: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/jar/JarEntryTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/jar/JarEntryTest.java?rev=396855&r1=396854&r2=396855&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/jar/JarEntryTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/jar/JarEntryTest.java Tue Apr 25 05:06:23 2006
@@ -49,15 +49,15 @@
*/
public void test_ConstructorLjava_util_zip_ZipEntry() {
// Test for method java.util.jar.JarEntry(java.util.zip.ZipEntry)
- assertTrue("Jar file is null", jarFile != null);
+ assertNotNull("Jar file is null", jarFile);
zipEntry = jarFile.getEntry(entryName);
- assertTrue("Zip entry is null", zipEntry != null);
+ assertNotNull("Zip entry is null", zipEntry);
jarEntry = new JarEntry(zipEntry);
- assertTrue("Jar entry is null", jarEntry != null);
+ assertNotNull("Jar entry is null", jarEntry);
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());
}
/**
@@ -79,16 +79,16 @@
try {
jarEntry = attrJar.getJarEntry(attEntryName);
- assertTrue("Should have Manifest attributes", jarEntry
- .getAttributes() != null);
+ assertNotNull("Should have Manifest attributes", jarEntry
+ .getAttributes());
} catch (Exception e) {
fail("Exception during 2nd test: " + e.toString());
}
try {
jarEntry = attrJar.getJarEntry(attEntryName2);
- assertTrue("Shouldn't have any Manifest attributes", jarEntry
- .getAttributes() == null);
+ assertNull("Shouldn't have any Manifest attributes", jarEntry
+ .getAttributes());
attrJar.close();
} catch (Exception e) {
fail("Exception during 1st test: " + e.toString());
@@ -103,8 +103,8 @@
// java.util.jar.JarEntry.getCertificates()
zipEntry = jarFile.getEntry(entryName2);
jarEntry = new JarEntry(zipEntry);
- assertTrue("Shouldn't have any Certificates", jarEntry
- .getCertificates() == null);
+ assertNull("Shouldn't have any Certificates", jarEntry
+ .getCertificates());
}
/**
Modified: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/jar/JarFileTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/jar/JarFileTest.java?rev=396855&r1=396854&r2=396855&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/jar/JarFileTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/jar/JarFileTest.java Tue Apr 25 05:06:23 2006
@@ -149,8 +149,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());
@@ -234,8 +234,8 @@
try {
Support_Resources.copyFile(resources, null, jarName);
JarFile jarFile = new JarFile(new File(resources, jarName));
- assertTrue("Error--Manifest not returned",
- jarFile.getManifest() != null);
+ assertNotNull("Error--Manifest not returned",
+ jarFile.getManifest());
jarFile.close();
} catch (Exception e) {
fail("Exception during 1st test: " + e.toString());
@@ -243,8 +243,8 @@
try {
Support_Resources.copyFile(resources, null, jarName2);
JarFile jarFile = new JarFile(new File(resources, jarName2));
- assertTrue("Error--should have returned null", jarFile
- .getManifest() == null);
+ assertNull("Error--should have returned null", jarFile
+ .getManifest());
jarFile.close();
} catch (Exception e) {
fail("Exception during 2nd test: " + e.toString());
@@ -254,8 +254,8 @@
// jarName3 was created using the following test
Support_Resources.copyFile(resources, null, jarName3);
JarFile jarFile = new JarFile(new File(resources, jarName3));
- assertTrue("Should find manifest without verifying", jarFile
- .getManifest() != null);
+ assertNotNull("Should find manifest without verifying", jarFile
+ .getManifest());
jarFile.close();
} catch (Exception e) {
fail("Exception during 3rd test: " + e.toString());
@@ -286,8 +286,8 @@
jarOut.write(65);
jarOut.close();
JarFile jar = new JarFile(file.getAbsolutePath(), false);
- assertTrue("Should find manifest without verifying", jar
- .getManifest() != null);
+ assertNotNull("Should find manifest without verifying", jar
+ .getManifest());
jar.close();
file.delete();
} catch (IOException e) {
@@ -328,7 +328,7 @@
try {
JarFile jf = new JarFile(localFile);
InputStream in = jf.getInputStream(new JarEntry("invalid"));
- assertTrue("Got stream for non-existent entry", in == null);
+ assertNull("Got stream for non-existent entry", in);
} catch (Exception e) {
fail("Exception during test 2: " + e);
}
@@ -360,7 +360,7 @@
JarEntry entry = new JarEntry(entryName3);
InputStream in = jar.getInputStream(entry);
in.read(new byte[1077]);
- assertTrue("found certificates", entry.getCertificates() == null);
+ assertNull("found certificates", entry.getCertificates());
} catch (Exception e) {
fail("Exception during test 4: " + e);
}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/jar/JarInputStreamTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/jar/JarInputStreamTest.java?rev=396855&r1=396854&r2=396855&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/jar/JarInputStreamTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/jar/JarInputStreamTest.java Tue Apr 25 05:06:23 2006
@@ -54,8 +54,8 @@
.getInputStream();
boolean hasCorrectEntry = false;
JarInputStream jis = new JarInputStream(is);
- assertTrue("The jar input stream should have a manifest", jis
- .getManifest() != null);
+ assertNotNull("The jar input stream should have a manifest", jis
+ .getManifest());
JarEntry je = jis.getNextJarEntry();
while (je != null) {
if (je.getName().equals(entryName))
@@ -84,13 +84,13 @@
.getInputStream();
JarInputStream jis = new JarInputStream(is);
m = jis.getManifest();
- assertTrue("The jar input stream should not have a manifest",
- m == null);
+ assertNull("The jar input stream should not have a manifest",
+ m);
is = new URL(jarName).openConnection().getInputStream();
jis = new JarInputStream(is);
m = jis.getManifest();
- assertTrue("The jar input stream should have a manifest", m != null);
+ assertNotNull("The jar input stream should have a manifest", m);
} catch (Exception e) {
fail("Exception during test: " + e.toString());
}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/jar/ManifestTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/jar/ManifestTest.java?rev=396855&r1=396854&r2=396855&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/jar/ManifestTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/jar/ManifestTest.java Tue Apr 25 05:06:23 2006
@@ -71,45 +71,40 @@
fail("IOException");
}
Attributes main = manifest.getMainAttributes();
- assertTrue("Bundle-Name not correct", main.getValue("Bundle-Name")
- .equals("ClientSupport"));
- assertTrue(
- "Bundle-Description not correct",
- main
+ assertEquals("Bundle-Name not correct", "ClientSupport", main.getValue("Bundle-Name")
+ );
+ assertEquals("Bundle-Description not correct",
+
+ "Provides SessionService, AuthenticationService. Extends RegistryService.", main
.getValue("Bundle-Description")
- .equals(
- "Provides SessionService, AuthenticationService. Extends RegistryService."));
- assertTrue("Bundle-Activator not correct", main.getValue(
- "Bundle-Activator").equals(
- "com.ibm.ive.eccomm.client.support.ClientSupportActivator"));
- assertTrue(
- "Import-Package not correct",
- main
+ );
+ assertEquals("Bundle-Activator not correct",
+ "com.ibm.ive.eccomm.client.support.ClientSupportActivator", main.getValue(
+ "Bundle-Activator"));
+ assertEquals("Import-Package not correct",
+
+ "com.ibm.ive.eccomm.client.services.log,com.ibm.ive.eccomm.client.services.registry,com.ibm.ive.eccomm.service.registry; specification-version=1.0.0,com.ibm.ive.eccomm.service.session; specification-version=1.0.0,com.ibm.ive.eccomm.service.framework; specification-version=1.2.0,org.osgi.framework; specification-version=1.0.0,org.osgi.service.log; specification-version=1.0.0,com.ibm.ive.eccomm.flash; specification-version=1.2.0,com.ibm.ive.eccomm.client.xml,com.ibm.ive.eccomm.client.http.common,com.ibm.ive.eccomm.client.http.client", main
.getValue("Import-Package")
- .equals(
- "com.ibm.ive.eccomm.client.services.log,com.ibm.ive.eccomm.client.services.registry,com.ibm.ive.eccomm.service.registry; specification-version=1.0.0,com.ibm.ive.eccomm.service.session; specification-version=1.0.0,com.ibm.ive.eccomm.service.framework; specification-version=1.2.0,org.osgi.framework; specification-version=1.0.0,org.osgi.service.log; specification-version=1.0.0,com.ibm.ive.eccomm.flash; specification-version=1.2.0,com.ibm.ive.eccomm.client.xml,com.ibm.ive.eccomm.client.http.common,com.ibm.ive.eccomm.client.http.client"));
- assertTrue(
- "Import-Service not correct",
- main
+ );
+ assertEquals("Import-Service not correct",
+
+ "org.osgi.service.log.LogReaderServiceorg.osgi.service.log.LogService,com.ibm.ive.eccomm.service.registry.RegistryService", main
.getValue("Import-Service")
- .equals(
- "org.osgi.service.log.LogReaderServiceorg.osgi.service.log.LogService,com.ibm.ive.eccomm.service.registry.RegistryService"));
- assertTrue(
- "Export-Package not correct",
- main
+ );
+ assertEquals("Export-Package not correct",
+
+ "com.ibm.ive.eccomm.client.services.authentication; specification-version=1.0.0,com.ibm.ive.eccomm.service.authentication; specification-version=1.0.0,com.ibm.ive.eccomm.common; specification-version=1.0.0,com.ibm.ive.eccomm.client.services.registry.store; specification-version=1.0.0", main
.getValue("Export-Package")
- .equals(
- "com.ibm.ive.eccomm.client.services.authentication; specification-version=1.0.0,com.ibm.ive.eccomm.service.authentication; specification-version=1.0.0,com.ibm.ive.eccomm.common; specification-version=1.0.0,com.ibm.ive.eccomm.client.services.registry.store; specification-version=1.0.0"));
- assertTrue(
- "Export-Service not correct",
- main
+ );
+ assertEquals("Export-Service not correct",
+
+ "com.ibm.ive.eccomm.service.authentication.AuthenticationService,com.ibm.ive.eccomm.service.session.SessionService", main
.getValue("Export-Service")
- .equals(
- "com.ibm.ive.eccomm.service.authentication.AuthenticationService,com.ibm.ive.eccomm.service.session.SessionService"));
- assertTrue("Bundle-Vendor not correct", main.getValue("Bundle-Vendor")
- .equals("IBM"));
- assertTrue("Bundle-Version not correct", main
- .getValue("Bundle-Version").equals("1.2.0"));
+ );
+ assertEquals("Bundle-Vendor not correct", "IBM", main.getValue("Bundle-Vendor")
+ );
+ assertEquals("Bundle-Version not correct", "1.2.0", main
+ .getValue("Bundle-Version"));
}
/**
@@ -129,10 +124,10 @@
public void test_getAttributesLjava_lang_String() {
// Test for method java.util.jar.Attributes
// java.util.jar.Manifest.getAttributes(java.lang.String)
- assertTrue("Should not exist",
- m2.getAttributes("Doesn't Exist") == null);
- assertTrue("Should exist", m2.getAttributes("HasAttributes.txt").get(
- new Attributes.Name("MyAttribute")).equals("OK"));
+ assertNull("Should not exist",
+ m2.getAttributes("Doesn't Exist"));
+ assertEquals("Should exist", "OK", m2.getAttributes("HasAttributes.txt").get(
+ new Attributes.Name("MyAttribute")));
}
/**
@@ -141,10 +136,10 @@
public void test_getEntries() {
// Test for method java.util.Map java.util.jar.Manifest.getEntries()
Map myMap = m2.getEntries();
- assertTrue("Shouldn't exist", myMap.get("Doesn't exist") == null);
- assertTrue("Should exist",
- ((Attributes) myMap.get("HasAttributes.txt")).get(
- new Attributes.Name("MyAttribute")).equals("OK"));
+ assertNull("Shouldn't exist", myMap.get("Doesn't exist"));
+ assertEquals("Should exist",
+ "OK", ((Attributes) myMap.get("HasAttributes.txt")).get(
+ new Attributes.Name("MyAttribute")));
}
@@ -155,8 +150,8 @@
// Test for method java.util.jar.Attributes
// java.util.jar.Manifest.getMainAttributes()
Attributes a = m.getMainAttributes();
- assertTrue("Manifest_Version should return 1.0", a.get(
- Attributes.Name.MANIFEST_VERSION).equals("1.0"));
+ assertEquals("Manifest_Version should return 1.0", "1.0", a.get(
+ Attributes.Name.MANIFEST_VERSION));
}
/**
Modified: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/zip/Adler32Test.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/zip/Adler32Test.java?rev=396855&r1=396854&r2=396855&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/zip/Adler32Test.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/zip/Adler32Test.java Tue Apr 25 05:06:23 2006
@@ -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);
}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/zip/CRC32Test.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/zip/CRC32Test.java?rev=396855&r1=396854&r2=396855&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/zip/CRC32Test.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/zip/CRC32Test.java Tue Apr 25 05:06:23 2006
@@ -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() {
Modified: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/zip/CheckedInputStreamTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/zip/CheckedInputStreamTest.java?rev=396855&r1=396854&r2=396855&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/zip/CheckedInputStreamTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/zip/CheckedInputStreamTest.java Tue Apr 25 05:06:23 2006
@@ -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");
Modified: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/zip/CheckedOutputStreamTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/zip/CheckedOutputStreamTest.java?rev=396855&r1=396854&r2=396855&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/zip/CheckedOutputStreamTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/zip/CheckedOutputStreamTest.java Tue Apr 25 05:06:23 2006
@@ -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");
Modified: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/zip/DeflaterOutputStreamTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/zip/DeflaterOutputStreamTest.java?rev=396855&r1=396854&r2=396855&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/zip/DeflaterOutputStreamTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/zip/DeflaterOutputStreamTest.java Tue Apr 25 05:06:23 2006
@@ -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();
Modified: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/zip/DeflaterTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/zip/DeflaterTest.java?rev=396855&r1=396854&r2=396855&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/zip/DeflaterTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/zip/DeflaterTest.java Tue Apr 25 05:06:23 2006
@@ -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 {
Modified: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/zip/GZIPInputStreamTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/zip/GZIPInputStreamTest.java?rev=396855&r1=396854&r2=396855&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/zip/GZIPInputStreamTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/zip/GZIPInputStreamTest.java Tue Apr 25 05:06:23 2006
@@ -61,10 +61,10 @@
+ "/GZIPInputStream/hyts_gInput.txt").toURL();
TestGZIPInputStream inGZIP = new TestGZIPInputStream(gInput
.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);
+ assertNotNull("the constructor for GZIPInputStream is null",
+ inGZIP);
+ assertEquals("the CRC value of the inputStream is not zero", 0, inGZIP
+ .getChecksum().getValue());
inGZIP.close();
} catch (IOException e) {
fail(
@@ -85,10 +85,10 @@
+ "/GZIPInputStream/hyts_gInput.txt").toURL();
TestGZIPInputStream inGZIP = new TestGZIPInputStream(gInput
.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);
+ assertNotNull("the constructor for GZIPInputStream is null",
+ inGZIP);
+ 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);
Modified: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/zip/GZIPOutputStreamTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/zip/GZIPOutputStreamTest.java?rev=396855&r1=396854&r2=396855&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/zip/GZIPOutputStreamTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/zip/GZIPOutputStreamTest.java Tue Apr 25 05:06:23 2006
@@ -46,10 +46,10 @@
try {
FileOutputStream outFile = new FileOutputStream("GZIPOutCon.txt");
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);
+ assertNotNull("the constructor for GZIPOutputStream is null",
+ outGZIP);
+ assertEquals("the CRC value of the outputStream is not zero", 0, outGZIP
+ .getChecksum().getValue());
outGZIP.close();
} catch (IOException e) {
fail(
@@ -66,10 +66,10 @@
FileOutputStream outFile = new FileOutputStream("GZIPOutCon.txt");
TestGZIPOutputStream outGZIP = new TestGZIPOutputStream(outFile,
100);
- assertTrue("the constructor for GZIPOutputStream is null",
- outGZIP != null);
- assertTrue("the CRC value of the outputStream is not zero", outGZIP
- .getChecksum().getValue() == 0);
+ assertNotNull("the constructor for GZIPOutputStream is null",
+ outGZIP);
+ 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(
Modified: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/zip/InflaterInputStreamTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/zip/InflaterInputStreamTest.java?rev=396855&r1=396854&r2=396855&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/zip/InflaterInputStreamTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/zip/InflaterInputStreamTest.java Tue Apr 25 05:06:23 2006
@@ -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();
Modified: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/zip/InflaterTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/zip/InflaterTest.java?rev=396855&r1=396854&r2=396855&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/zip/InflaterTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/zip/InflaterTest.java Tue Apr 25 05:06:23 2006
@@ -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);
}
/**
@@ -372,8 +367,8 @@
// test method of java.util.zip.inflater.Inflater()
try {
Inflater inflate = new Inflater();
- assertTrue("failed to create the instance of inflater",
- inflate != null);
+ assertNotNull("failed to create the instance of inflater",
+ inflate);
} catch (Exception e) {
@@ -390,7 +385,7 @@
// doesn't or vice versa.
byte byteArray[] = { 1, 3, 4, 7, 8, 'e', 'r', 't', 'y', '5' };
Inflater inflate = new Inflater(true);
- assertTrue("failed to create the instance of inflater", inflate != null);
+ assertNotNull("failed to create the instance of inflater", inflate);
byte outPutInf[] = new byte[500];
int r = 0;
try {
@@ -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() {
Modified: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/zip/ZipEntryTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/zip/ZipEntryTest.java?rev=396855&r1=396854&r2=396855&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/zip/ZipEntryTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/zip/ZipEntryTest.java Tue Apr 25 05:06:23 2006
@@ -47,7 +47,7 @@
public void test_ConstructorLjava_lang_String() {
// Test for method java.util.zip.ZipEntry(java.lang.String)
zentry = zfile.getEntry("File3.txt");
- assertTrue("Failed to create ZipEntry", zentry != null);
+ assertNotNull("Failed to create ZipEntry", zentry);
try {
zentry = zfile.getEntry(null);
fail("NullPointerException not thrown");
@@ -81,10 +81,10 @@
public void test_getComment() {
// Test for method java.lang.String java.util.zip.ZipEntry.getComment()
ZipEntry zipEntry = new ZipEntry("zippy.zip");
- assertTrue("Incorrect Comment Returned.", zipEntry.getComment() == null);
+ assertNull("Incorrect Comment Returned.", zipEntry.getComment());
zipEntry.setComment("This Is A Comment");
- assertTrue("Incorrect Comment Returned.", zipEntry.getComment().equals(
- "This Is A Comment"));
+ assertEquals("Incorrect Comment Returned.",
+ "This Is A Comment", zipEntry.getComment());
}
/**
@@ -109,8 +109,8 @@
*/
public void test_getExtra() {
// Test for method byte [] java.util.zip.ZipEntry.getExtra()
- assertTrue("Incorrect extra information returned",
- zentry.getExtra() == null);
+ assertNull("Incorrect extra information returned",
+ zentry.getExtra());
byte[] ba = { 'T', 'E', 'S', 'T' };
zentry = new ZipEntry("test.tst");
zentry.setExtra(ba);
@@ -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());
}
/**
@@ -138,9 +138,8 @@
*/
public void test_getName() {
// Test for method java.lang.String java.util.zip.ZipEntry.getName()
- assertTrue(
- "Incorrect name returned - Note return result somewhat ambiguous in spec",
- zentry.getName().equals("File1.txt"));
+ assertEquals("Incorrect name returned - Note return result somewhat ambiguous in spec",
+ "File1.txt", zentry.getName());
}
/**
@@ -179,11 +178,11 @@
// java.util.zip.ZipEntry.setComment(java.lang.String)
zentry = zfile.getEntry("File1.txt");
zentry.setComment("Set comment using api");
- assertTrue("Comment not correctly set", zentry.getComment().equals(
- "Set comment using api"));
+ assertEquals("Comment not correctly set",
+ "Set comment using api", zentry.getComment());
String n = null;
zentry.setComment(n);
- assertTrue("Comment not correctly set", zentry.getComment() == null);
+ assertNull("Comment not correctly set", zentry.getComment());
StringBuffer s = new StringBuffer();
for (int i = 0; i < 0xFFFF; i++)
s.append('a');
@@ -209,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);
@@ -227,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");
@@ -252,9 +251,9 @@
// Test for method void java.util.zip.ZipEntry.setExtra(byte [])
zentry = zfile.getEntry("File1.txt");
zentry.setExtra("Test setting extra information".getBytes());
- assertTrue("Extra information not written properly", new String(zentry
+ assertEquals("Extra information not written properly", "Test setting extra information", new String(zentry
.getExtra(), 0, zentry.getExtra().length)
- .equals("Test setting extra information"));
+ );
zentry = new ZipEntry("test.tst");
byte[] ba = new byte[0xFFFF];
try {
@@ -314,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");
@@ -386,12 +385,12 @@
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);
- assertTrue("ZipEntry Created With Incorrect Comment.", zentry2
- .getComment().equals("Testing"));
+ 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.",
zentry2.getCrc() == orgCrc);
assertTrue("ZipEntry Created With Incorrect Time.",
Modified: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/zip/ZipFileTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/zip/ZipFileTest.java?rev=396855&r1=396854&r2=396855&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/zip/ZipFileTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/zip/ZipFileTest.java Tue Apr 25 05:06:23 2006
@@ -100,12 +100,12 @@
out.close();
/*
* ZipFile zip = new ZipFile(file); ZipEntry entry1 =
- * zip.getEntry("File1.txt"); assertTrue("Did not find entry",
- * entry1 != null); entry1 = null; zip = null;
+ * zip.getEntry("File1.txt"); assertNotNull("Did not find entry",
+ * entry1); entry1 = null; zip = null;
*/
- assertTrue("Did not find entry",
- test_finalize1(test_finalize2(file)) != null);
+ assertNotNull("Did not find entry",
+ test_finalize1(test_finalize2(file)));
System.gc();
System.gc();
System.runFinalization();
@@ -166,40 +166,40 @@
// Test for method java.util.zip.ZipEntry
// java.util.zip.ZipFile.getEntry(java.lang.String)
java.util.zip.ZipEntry zentry = zfile.getEntry("File1.txt");
- assertTrue("Could not obtain ZipEntry", zentry != null);
+ assertNotNull("Could not obtain ZipEntry", zentry);
zentry = zfile.getEntry("testdir1/File1.txt");
- assertTrue("Could not obtain ZipEntry: testdir1/File1.txt",
- zentry != null);
+ assertNotNull("Could not obtain ZipEntry: testdir1/File1.txt",
+ zentry);
try {
int r;
InputStream in;
zentry = zfile.getEntry("testdir1/");
- assertTrue("Could not obtain ZipEntry: testdir1/", zentry != null);
+ assertNotNull("Could not obtain ZipEntry: testdir1/", zentry);
in = zfile.getInputStream(zentry);
- assertTrue("testdir1/ should not have null input stream",
- in != null);
+ assertNotNull("testdir1/ should not have null input stream",
+ in);
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);
+ assertNotNull("Could not obtain ZipEntry: testdir1", zentry);
in = zfile.getInputStream(zentry);
- assertTrue("testdir1 should not have null input stream", in != null);
+ assertNotNull("testdir1 should not have null input stream", in);
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",
- zentry != null);
+ assertNotNull("Could not obtain ZipEntry: testdir1/testdir1",
+ zentry);
in = zfile.getInputStream(zentry);
byte[] buf = new byte[256];
r = in.read(buf);
in.close();
- assertTrue("incorrect contents", new String(buf, 0, r)
- .equals("This is also text"));
+ assertEquals("incorrect contents", "This is also text", new String(buf, 0, r)
+ );
} catch (IOException e) {
fail("Unexpected: " + e);
}
@@ -218,8 +218,8 @@
byte[] rbuf = new byte[1000];
int r;
is.read(rbuf, 0, r = (int) zentry.getSize());
- assertTrue("getInputStream read incorrect data", new String(rbuf,
- 0, r).equals("This is text"));
+ assertEquals("getInputStream read incorrect data", "This is text", new String(rbuf,
+ 0, r));
} catch (java.io.IOException e) {
fail("IOException during getInputStream");
} finally {
Modified: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/zip/ZipInputStreamTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/zip/ZipInputStreamTest.java?rev=396855&r1=396854&r2=396855&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/zip/ZipInputStreamTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/zip/ZipInputStreamTest.java Tue Apr 25 05:06:23 2006
@@ -76,7 +76,7 @@
// Test for method java.util.zip.ZipEntry
// java.util.zip.ZipInputStream.getNextEntry()
try {
- assertTrue("getNextEntry failed", zis.getNextEntry() != null);
+ assertNotNull("getNextEntry failed", zis.getNextEntry());
} catch (java.io.IOException e) {
fail("Exception during getNextEntry test");
}
@@ -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);
}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/zip/ZipOutputStreamTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/zip/ZipOutputStreamTest.java?rev=396855&r1=396854&r2=396855&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/zip/ZipOutputStreamTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/tests/api/java/util/zip/ZipOutputStreamTest.java Tue Apr 25 05:06:23 2006
@@ -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());
}