### Question:
SoapIdentityTokenResolver extends X509IdentityTokenResolver<HttpCommand, OMElement> { @Override public void resolve(HttpCommand httpCommand, OMElement omElement, DehydratedExecutionContextBuilder builder) { List<IdentityToken> tokens = new ArrayList<>(); if (httpCommand.getIdentityTokenResolver() != null) { X509Certificate[] certificateChain = resolveCertificates(httpCommand.getRequest()); tokens = httpCommand.getIdentityTokenResolver().resolve(omElement, certificateChain); } builder.setIdentityTokens(tokens); } SoapIdentityTokenResolver(); @Override void resolve(HttpCommand httpCommand, OMElement omElement, DehydratedExecutionContextBuilder builder);  }### Answer:
@Test public void resolveCallsTokenResolver() { IdentityTokenResolver tokenResolver = mock(IdentityTokenResolver.class); when(httpCommand.getIdentityTokenResolver()).thenReturn(tokenResolver); List<IdentityToken> tokens = Arrays.asList(new IdentityToken("SomeToken", "SomeValue")); when(tokenResolver.resolve(credsContainer, null)).thenReturn(tokens); identityTokenResolver.resolve(httpCommand, credsContainer, builder); verify(tokenResolver, times(1)).resolve(credsContainer, null); assertEquals(tokens, builder.getIdentityTokens()); }
@Test public void certificatesObtained() { IdentityTokenResolver tokenResolver = mock(IdentityTokenResolver.class); when(httpCommand.getIdentityTokenResolver()).thenReturn(tokenResolver); X509Certificate cert = mock(X509Certificate.class); X509Certificate[] certs = new X509Certificate[] { cert }; when(request.getAttribute(X509IdentityTokenResolver.CERTIFICATE_ATTRIBUTE_NAME)).thenReturn(certs); when(tokenResolver.resolve(credsContainer, certs)).thenReturn(new ArrayList<>()); identityTokenResolver.resolve(httpCommand, credsContainer, builder); verify(tokenResolver, times(1)).resolve(credsContainer, certs); }