public void test_setKeyEntryLjava_lang_StringLjava_security_Key$C$Ljava_security_cert_Certificate() throws Exception {
  CertificateFactory cf=CertificateFactory.getInstance("X.509");
  X509Certificate cert[]=new X509Certificate[2];
  cert[0]=(X509Certificate)cf.generateCertificate(certArray);
  cert[1]=(X509Certificate)cf.generateCertificate(certArray2);
  KeyStore keyTest=KeyStore.getInstance(KeyStore.getDefaultType());
  try {
    keyTest.setKeyEntry("alias3",getPrivateKey(),pssWord,cert);
    fail();
  }
 catch (  KeyStoreException expected) {
  }
  keyTest.load(null,null);
  keyTest.setKeyEntry("alias3",getPrivateKey(),pssWord,cert);
  assertTrue("the entry specified by the alias alias3 is not a keyEntry",keyTest.isKeyEntry("alias3"));
  try {
    keyTest.setKeyEntry("alias4",getPrivateKey(),pssWord,new Certificate[]{});
    fail();
  }
 catch (  IllegalArgumentException expected) {
  }
}

public void test_setKeyEntryLjava_lang_StringLjava_security_Key$C$Ljava_security_cert_Certificate ( ) throws Exception { CertificateFactory cf = CertificateFactory . getInstance ( "X.509" ) ; X509Certificate cert [ ] = new X509Certificate [ 2 ] ; cert [ 0 ] = ( X509Certificate ) cf . generateCertificate ( certArray ) ; cert [ 1 ] = ( X509Certificate ) cf . generateCertificate ( certArray2 ) ; KeyStore keyTest = KeyStore . getInstance ( KeyStore . getDefaultType ( ) ) ; try { keyTest . setKeyEntry ( "alias3" , getPrivateKey ( ) , pssWord , cert ) ; fail ( ) ; } catch ( KeyStoreException expected ) { } keyTest . load ( null , null ) ; keyTest . setKeyEntry ( "alias3" , getPrivateKey ( ) , pssWord , cert ) ; assertTrue ( "the entry specified by the alias alias3 is not a keyEntry" , keyTest . isKeyEntry ( "alias3" ) ) ; try { keyTest . setKeyEntry ( "alias4" , getPrivateKey ( ) , pssWord , new Certificate [ ] { } ) ; fail ( ) ; } catch ( IllegalArgumentException expected ) { } }
java . security . keystore # setkeyentry ( java . lang . string , java . security . key , char [ ] , java . security . cert . certificate [ ] )
