### Question:
SecurityUtils { public static Certificate[] loadCertificateChain(HttpsConfig config) throws CertificateException, NoSuchAlgorithmException, KeyStoreException, IOException { if (config.getKeyStore() != null) { KeyStore ks = loadKeyStore(config); return ks.getCertificateChain(config.getKeyAlias()); } return new Certificate[0]; }  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 loadCertificateChainNoKeystore() throws CertificateException, NoSuchAlgorithmException, KeyStoreException, IOException { HttpsConfig httpsConfig = HttpsConfig.builder().build(); Certificate[] certificates = SecurityUtils.loadCertificateChain(httpsConfig); assertEquals(0, certificates.length); }
@Test public void loadCertificateChain() throws CertificateException, NoSuchAlgorithmException, KeyStoreException, IOException { HttpsConfig httpsConfig = httpsConfigBuilder.keyAlias(KEY_ALIAS).build(); Certificate[] certificates = SecurityUtils.loadCertificateChain(httpsConfig); assertTrue(certificates.length > 0); }