public void testGetAlgorithm() throws Exception {
  String secret="secret string";
  String algorithm="DES";
  KeyGenerator kg=KeyGenerator.getInstance(algorithm);
  Key key=kg.generateKey();
  Cipher cipher=Cipher.getInstance(algorithm);
  cipher.init(Cipher.ENCRYPT_MODE,key);
  SealedObject so=new SealedObject(secret,cipher);
  assertEquals("The algorithm name should be the same as used " + "in cipher.",algorithm,so.getAlgorithm());
}

public void testGetAlgorithm ( ) throws Exception { String secret = "secret string" ; String algorithm = "DES" ; KeyGenerator kg = KeyGenerator . getInstance ( algorithm ) ; Key key = kg . generateKey ( ) ; Cipher cipher = Cipher . getInstance ( algorithm ) ; cipher . init ( Cipher . ENCRYPT_MODE , key ) ; SealedObject so = new SealedObject ( secret , cipher ) ; assertEquals ( "The algorithm name should be the same as used " + "in cipher." , algorithm , so . getAlgorithm ( ) ) ; }
getalgorithm ( ) method testing . tests if the returned value equals to the corresponding value of cipher object .
