### Question:
AbstractHttpExecutable extends AbstractClientTransport { public void setIdentityTokenResolver(IdentityTokenResolver<HR, HR, X509Certificate[]> identityTokenResolver) { this.identityTokenResolver = identityTokenResolver; } protected  AbstractHttpExecutable(final HttpServiceBindingDescriptor bindingDescriptor,
                                  CougarRequestFactory<HR> requestFactory,
                                  Tracer tracer); void init(); @Override void execute(final ExecutionContext ctx, final OperationKey key, final Object[] args,
                        final ExecutionObserver obs, final ExecutionVenue executionVenue, final TimeConstraints timeConstraints); @ManagedAttribute(description = REMOTE_ADDRESS_DESCRIPTION) void setRemoteAddress(final String host); @ManagedAttribute(description = REMOTE_ADDRESS_DESCRIPTION) String getRemoteAddress(); @ManagedAttribute(description = SERVICE_CONTEXT_PATH_DESCRIPTION) String getServiceContextPath(); abstract TransportMetrics getTransportMetrics(); void setDataBindingFactory(DataBindingFactory dataBindingFactory); void setQueryStringGeneratorFactory(QueryStringGeneratorFactory queryStringGeneratorFactory); void setIdentityTokenResolver(IdentityTokenResolver<HR, HR, X509Certificate[]> identityTokenResolver); void setExceptionTransformer(ExceptionTransformer exceptionTransformer); void setExceptionFactory(ExceptionFactory exceptionFactory); void setTransportSSLEnabled(boolean transportSSLEnabled); void setHttpsKeyPassword(String httpsKeyPassword); void setHttpsKeystore(Resource httpsKeystore); void setHttpsKeystoreType(String httpsKeystoreType); void setHttpsTrustPassword(String httpsTrustPassword); void setHttpsTruststore(Resource httpsTruststore); void setHttpsTruststoreType(String httpsTruststoreType); void setConnectTimeout(int timeout); void setIdleTimeout(int idleTimeout); void setHostnameVerificationDisabled(final boolean hostnameVerificationDisabled); void setRequestFactory(CougarRequestFactory<HR> requestFactory); @ManagedAttribute int getIdleTimeout(); @ManagedAttribute int getConnectTimeout(); @ManagedAttribute String getHttpsTruststoreType(); @ManagedAttribute Resource getHttpsTruststore(); @ManagedAttribute String getHttpsKeystoreType(); @ManagedAttribute Resource getHttpsKeystore(); @ManagedAttribute boolean isHostnameVerificationDisabled(); @ManagedAttribute boolean isTransportSSLEnabled(); @ManagedAttribute boolean isHardFailEnumDeserialisation(); void setHardFailEnumDeserialisation(boolean hardFailEnumDeserialisation); @ManagedAttribute boolean isGzipCompressionEnabled(); @ManagedAttribute void setGzipCompressionEnabled(boolean gzipCompressionEnabled);  }### Answer:
@Test public void testIdentityTokenWriting() throws Exception { IdentityResolver resolver = mock((IdentityResolver.class)); IdentityTokenResolver tokenResolver = mock((IdentityTokenResolver.class)); client.setIdentityResolver(resolver); client.setIdentityTokenResolver(tokenResolver); when(tokenResolver.isRewriteSupported()).thenReturn(true); final List<IdentityToken> tokens = new ArrayList<IdentityToken>(); when(resolver.tokenise(any(IdentityChain.class))).thenReturn(tokens); generateEV(tsd, null); makeSimpleCall(createEC(null, null, true)); verify(resolver).tokenise(any(IdentityChain.class)); verify(tokenResolver).rewrite(eq(tokens), any(HttpUriRequest.class)); }
@Test public void testIdentityTokenWritingRewriteOff() throws Exception { IdentityResolver resolver = mock((IdentityResolver.class)); IdentityTokenResolver tokenResolver = mock((IdentityTokenResolver.class)); client.setIdentityResolver(resolver); client.setIdentityTokenResolver(tokenResolver); when(tokenResolver.isRewriteSupported()).thenReturn(false); final List<IdentityToken> tokens = new ArrayList<IdentityToken>(); when(resolver.tokenise(any(IdentityChain.class))).thenReturn(tokens); generateEV(tsd, null); makeSimpleCall(createEC(null, null, true)); verify(resolver, never()).tokenise(any(IdentityChain.class)); verify(tokenResolver, never()).rewrite(eq(tokens), any(HttpUriRequest.class)); }