public void testClearPassword(){
  char[] password=new char[]{'1','2','3','4','5'};
  PBEKeySpec pbeks=new PBEKeySpec(password);
  pbeks.clearPassword();
  try {
    pbeks.getPassword();
    fail("An IllegalStateException should be was thrown " + "after the clearing the password.");
  }
 catch (  IllegalStateException e) {
  }
}

public void testClearPassword ( ) { char [ ] password = new char [ ] { '1' , '2' , '3' , '4' , '5' } ; PBEKeySpec pbeks = new PBEKeySpec ( password ) ; pbeks . clearPassword ( ) ; try { pbeks . getPassword ( ) ; fail ( "An IllegalStateException should be was thrown " + "after the clearing the password." ) ; } catch ( IllegalStateException e ) { } }
clearpassword ( ) method testing . tests that internal copy of password is cleared after the method call .
