public final void testIsStatePreserved1(){
  byte[] encodedKey=new byte[]{(byte)1,(byte)2,(byte)3,(byte)4};
  byte[] encodedKeyCopy=encodedKey.clone();
  PKCS8EncodedKeySpec meks=new PKCS8EncodedKeySpec(encodedKeyCopy);
  encodedKeyCopy[3]=(byte)5;
  byte[] ek=meks.getEncoded();
  assertTrue(Arrays.equals(encodedKey,ek));
}

public final void testIsStatePreserved1 ( ) { byte [ ] encodedKey = new byte [ ] { ( byte ) 1 , ( byte ) 2 , ( byte ) 3 , ( byte ) 4 } ; byte [ ] encodedKeyCopy = encodedKey . clone ( ) ; PKCS8EncodedKeySpec meks = new PKCS8EncodedKeySpec ( encodedKeyCopy ) ; encodedKeyCopy [ 3 ] = ( byte ) 5 ; byte [ ] ek = meks . getEncoded ( ) ; assertTrue ( Arrays . equals ( encodedKey , ek ) ) ; }
tests that internal state of the object can not be changed by modifying initial array value
