### Question:
X509AliasKeyManager extends X509ExtendedKeyManager { @Override public X509Certificate[] getCertificateChain(String alias) { return delegate.getCertificateChain(alias); } X509AliasKeyManager(String alias, X509ExtendedKeyManager delegate); @Override String chooseClientAlias(String[] keyType, Principal[] issuers, Socket socket); @Override String chooseServerAlias(String keyType, Principal[] issuers, Socket socket); @Override X509Certificate[] getCertificateChain(String alias); @Override String[] getClientAliases(String keyType, Principal[] issuers); @Override PrivateKey getPrivateKey(String alias); @Override String[] getServerAliases(String keyType, Principal[] issuers); @Override String chooseEngineClientAlias(String[] keyType, Principal[] issuers, SSLEngine engine); @Override String chooseEngineServerAlias(String keyType, Principal[] issuers, SSLEngine engine);  }### Answer:
@Test public void testGetCertificateChainDelegates() { String wrapperAlias = "wrapperAlias"; X509Certificate[] certs = new X509Certificate[7]; X509ExtendedKeyManager mock = mock(X509ExtendedKeyManager.class); when(mock.getCertificateChain(any(String.class))).thenReturn(certs); X509ExtendedKeyManager wrapper = new X509AliasKeyManager(wrapperAlias, mock); assertSame("Different object returned", certs, wrapper.getCertificateChain(wrapperAlias)); }