### Question:
SecurityUtils { public static String readSecret(HttpsConfig config) { if (config.getKeyStore() != null) { try { Key key = loadKey(config); if (key == null) { throw new UnrecoverableKeyException(String.format( "No key with private key entry could be used in the keystore. Provided key alias: %s", config.getKeyAlias() == null ? "<not provided>" : config.getKeyAlias())); } return Base64.getEncoder().encodeToString(key.getEncoded()); } catch (UnrecoverableKeyException e) { apimlLog.log("org.zowe.apiml.common.errorReadingSecretKey", e.getMessage()); throw new HttpsConfigError("Error reading secret key: " + e.getMessage(), e, HttpsConfigError.ErrorCode.HTTP_CLIENT_INITIALIZATION_FAILED, config); } } return null; }  static String readSecret(HttpsConfig config); static Key loadKey(HttpsConfig config); static Certificate[] loadCertificateChain(HttpsConfig config); static Set<String> loadCertificateChainBase64(HttpsConfig config); static PublicKey loadPublicKey(HttpsConfig config); static Key findPrivateKeyByPublic(HttpsConfig config, byte[] publicKey); static KeyStore loadKeyStore(HttpsConfig config); static URL keyRingUrl(String uri, String trustStore); static String replaceFourSlashes(String storeUri); static KeyPair generateKeyPair(String algorithm, int keySize); static final String SAFKEYRING; }### Answer:
@Test public void testReadSecret() { HttpsConfig httpsConfig = httpsConfigBuilder.keyAlias(KEY_ALIAS).build(); String secretKey = SecurityUtils.readSecret(httpsConfig); assertNotNull(secretKey); }
@Test(expected = HttpsConfigError.class) public void testReadSecretWithIncorrectKeyAlias() { HttpsConfig httpsConfig = httpsConfigBuilder.keyAlias(WRONG_PARAMETER).build(); String secretKey = SecurityUtils.readSecret(httpsConfig); assertNull(secretKey); }