### Question:
SpiffeKeyManager extends X509ExtendedKeyManager { @Override public X509Certificate[] getCertificateChain(final String alias) { if (!Objects.equals(alias, DEFAULT_ALIAS)) { return new X509Certificate[0]; } val x509Svid = x509SvidSource.getX509Svid(); return x509Svid.getChainArray(); } SpiffeKeyManager(@NonNull final X509SvidSource x509SvidSource); @Override X509Certificate[] getCertificateChain(final String alias); @Override PrivateKey getPrivateKey(final String alias); @Override String[] getClientAliases(final String keyType, final Principal[] issuers); @Override String chooseClientAlias(final String[] keyTypes, final Principal[] issuers, final Socket socket); @Override String chooseEngineClientAlias(final String[] keyTypes, final Principal[] issuers, final SSLEngine sslEngine); @Override String[] getServerAliases(final String keyType, final Principal[] issuers); @Override String chooseEngineServerAlias(final String keyType, final Principal[] issuers, final SSLEngine sslEngine); @Override String chooseServerAlias(final String keyType, final Principal[] issuers, final Socket socket);  }### Answer:
@Test void getCertificateChain() throws CertificateException { val certificateChain = spiffeKeyManager.getCertificateChain(DEFAULT_ALIAS); val spiffeId = CertificateUtils.getSpiffeId(certificateChain[0]); assertAll( () -> assertEquals(1, certificateChain.length), () -> assertEquals("spiffe: ); }
@Test void getCertificateChain_aliasNotSupported() { X509Certificate[] chain = spiffeKeyManager.getCertificateChain("other_alias"); assertEquals(0, chain.length); }