public void test_getChecksum() {
// test method java.util.zip.checkedOutputStream.getChecksum()
byte byteArray[] = { 1, 2, 3, 'e', 'r', 't', 'g', 3, 6 };
try {
FileOutputStream outFile = new FileOutputStream("chkOut.txt");
CheckedOutputStream chkOut = new CheckedOutputStream(outFile,
new Adler32());
chkOut.write(byteArray[4]);
// ran JDK and found that checkSum value is 7536755
// System.out.print(chkOut.getChecksum().getValue());
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());
assertEquals("the checkSum value for writeBII is incorrect ", 51708133, chkOut
.getChecksum().getValue());
outFile.close();
} catch (IOException e) {
fail("Unable to find file");
} catch (SecurityException e) {