Code example for DigestInputStream

Methods: getMessageDigest

0
	 * @tests java.security.DigestInputStream#getMessageDigest() 
	 */ 
	public void test_getMessageDigest() { 
		// Test for method java.security.MessageDigest 
		// java.security.DigestInputStream.getMessageDigest() 
		DigestInputStream dis = new DigestInputStream(inStream, digest);
		assertEquals("getMessageDigest returned a bogus result", digest, dis
				.getMessageDigest());
	} 
 
	/** 
	 * @tests java.security.DigestInputStream#on(boolean) 
	 */ 
    public void test_onZ() throws Exception { 
        // Test for method void java.security.DigestInputStream.on(boolean) 
        MessageDigest originalDigest = (MessageDigest) (digest.clone());
        MessageDigest noChangeDigest = (MessageDigest) (digest.clone());
        DigestInputStream dis = new DigestInputStream(inStream, noChangeDigest);
        // turn off processing 
        dis.on(false);
        // read some data