### Question:
CredentialReader { public static String getDecryptedString(String CrendentialProviderPath,String alias) { String credential=null; try{ if(CrendentialProviderPath==null || alias==null){ return null; } char[] pass = null; Configuration conf = new Configuration(); String crendentialProviderPrefix=JavaKeyStoreProvider.SCHEME_NAME + ": crendentialProviderPrefix=crendentialProviderPrefix.toLowerCase(); CrendentialProviderPath=CrendentialProviderPath.trim(); alias=alias.trim(); if(CrendentialProviderPath.toLowerCase().startsWith(crendentialProviderPrefix)){ conf.set(CredentialProviderFactory.CREDENTIAL_PROVIDER_PATH, CrendentialProviderPath); }else{ if(CrendentialProviderPath.startsWith("/")){ conf.set(CredentialProviderFactory.CREDENTIAL_PROVIDER_PATH, JavaKeyStoreProvider.SCHEME_NAME + ": }else{ conf.set(CredentialProviderFactory.CREDENTIAL_PROVIDER_PATH, JavaKeyStoreProvider.SCHEME_NAME + ": } } List<CredentialProvider> providers = CredentialProviderFactory.getProviders(conf); List<String> aliasesList=new ArrayList<String>(); CredentialProvider.CredentialEntry credEntry=null; for(CredentialProvider provider: providers) { aliasesList=provider.getAliases(); if(aliasesList!=null && aliasesList.contains(alias.toLowerCase())){ credEntry=null; credEntry= provider.getCredentialEntry(alias); pass = credEntry.getCredential(); if(pass!=null && pass.length>0){ credential=String.valueOf(pass); break; } } } }catch(Exception ex){ ex.printStackTrace(); credential=null; } return credential; }  static String getDecryptedString(String CrendentialProviderPath,String alias);  }### Answer:
@Test public void testPassword() throws Exception { String password=CredentialReader.getDecryptedString(keystoreFile, "TestCredential2"); assertEquals( "PassworD123", password); assertTrue(password,"PassworD123".equals(password)); String[] argsdeleteCommand = new String[] {"delete", "TestCredential2", "-provider", "jceks: buildks buildksOBJ=new buildks(); buildksOBJ.deleteCredential(argsdeleteCommand, true); }