public void testPBEKeySpec1(){
  try {
    PBEKeySpec pbeks=new PBEKeySpec(null);
    assertTrue("An empty char[] should be used in case of null " + "char array.",pbeks.getPassword().length == 0);
  }
 catch (  NullPointerException e) {
    fail("Unexpected NullPointerException was thrown.");
  }
  char[] password=new char[]{'1','2','3','4','5'};
  PBEKeySpec pbeks=new PBEKeySpec(password);
  password[0]++;
  assertFalse("The change of password specified in the constructor " + "should not cause the change of internal array.",password[0] == pbeks.getPassword()[0]);
}

public void testPBEKeySpec1 ( ) { try { PBEKeySpec pbeks = new PBEKeySpec ( null ) ; assertTrue ( "An empty char[] should be used in case of null " + "char array." , pbeks . getPassword ( ) . length == 0 ) ; } catch ( NullPointerException e ) { fail ( "Unexpected NullPointerException was thrown." ) ; } char [ ] password = new char [ ] { '1' , '2' , '3' , '4' , '5' } ; PBEKeySpec pbeks = new PBEKeySpec ( password ) ; password [ 0 ] ++ ; assertFalse ( "The change of password specified in the constructor " + "should not cause the change of internal array." , password [ 0 ] == pbeks . getPassword ( ) [ 0 ] ) ; }
pbekeyspec ( char [ ] password ) method testing . tests the behavior of the method in the case of null input char array and tests that input array is copied during the object initialization .
