Methods Summary |
---|
public void | testManifestDigest_Equals()
InputStream is = new ByteArrayInputStream(MESSAGE_1);
ManifestDigest expected =
new ManifestDigest(MessageDigest.getInstance("SHA-256").digest(MESSAGE_1));
ManifestDigest actual = ManifestDigest.fromInputStream(is);
assertEquals(expected, actual);
ManifestDigest unexpected = new ManifestDigest(new byte[0]);
assertFalse(unexpected.equals(actual));
|
public void | testManifestDigest_FromInputStream_Null()
assertNull("Attributes were null, so ManifestDigest.fromAttributes should return null",
ManifestDigest.fromInputStream(null));
|
public void | testManifestDigest_FromInputStream_ThrowsIoException()
InputStream is = new InputStream() {
@Override
public int read() throws IOException {
throw new IOException();
}
};
assertNull("InputStream threw exception, so ManifestDigest should be null",
ManifestDigest.fromInputStream(is));
|
public void | testManifestDigest_Parcel()
InputStream is = new ByteArrayInputStream(MESSAGE_1);
ManifestDigest digest = ManifestDigest.fromInputStream(is);
Parcel p = Parcel.obtain();
digest.writeToParcel(p, 0);
p.setDataPosition(0);
ManifestDigest fromParcel = ManifestDigest.CREATOR.createFromParcel(p);
assertEquals("ManifestDigest going through parceling should be the same as before: "
+ digest.toString() + " and " + fromParcel.toString(), digest,
fromParcel);
|