### Question:
OutboundResponseFromHubToResponseTransformerFactory { public Function<OutboundResponseFromHub, String> get(String authnRequestIssuerEntityId) { if (transactionsConfigProxy.getShouldHubSignResponseMessages(authnRequestIssuerEntityId)) { return transactionsConfigProxy.getShouldHubUseLegacySamlStandard(authnRequestIssuerEntityId) ? outboundLegacyResponseFromHubToStringFunctionSHA256 : outboundSamlProfileResponseFromHubToStringFunctionSHA256; } return simpleProfileOutboundResponseFromHubToResponseTransformerProvider.get(); } @Inject  OutboundResponseFromHubToResponseTransformerFactory(SimpleProfileOutboundResponseFromHubToResponseTransformerProvider simpleProfileOutboundResponseFromHubToResponseTransformerProvider,
                                                               TransactionsConfigProxy transactionsConfigProxy,
                                                               OutboundSamlProfileResponseFromHubToStringFunctionSHA256 outboundSamlProfileResponseFromHubToStringFunctionSHA256,
                                                               OutboundLegacyResponseFromHubToStringFunctionSHA256 outboundLegacyResponseFromHubToStringFunctionSHA256,
                                                               OutboundAuthnResponseFromCountryContainerToStringFunction outboundAuthnResponseFromCountryContainerToStringFunction); Function<OutboundResponseFromHub, String> get(String authnRequestIssuerEntityId); Function<AuthnResponseFromCountryContainerDto, String> getCountryTransformer();  }### Answer:
@Test public void getShouldReturnOutboundLegacyResponseFromHubToStringFunctionSHA256WhenHubShouldSignResponseMessages() { when(transactionsConfigProxy.getShouldHubSignResponseMessages(ENTITY_ID)).thenReturn(true); when(transactionsConfigProxy.getShouldHubUseLegacySamlStandard(ENTITY_ID)).thenReturn(true); Function<OutboundResponseFromHub, String> transformer = outboundResponseFromHubToResponseTransformerFactory.get(ENTITY_ID); assertThat(transformer).isEqualTo(outboundLegacyResponseFromHubToStringFunctionSHA256); }
@Test public void getShouldReturnOutboundSamlProfileResponseFromHubToStringFunctionSHA256WhenHubShouldSignResponseMessages() { when(transactionsConfigProxy.getShouldHubSignResponseMessages(ENTITY_ID)).thenReturn(true); when(transactionsConfigProxy.getShouldHubUseLegacySamlStandard(ENTITY_ID)).thenReturn(false); Function<OutboundResponseFromHub, String> transformer = outboundResponseFromHubToResponseTransformerFactory.get(ENTITY_ID); assertThat(transformer).isEqualTo(outboundSamlProfileResponseFromHubToStringFunctionSHA256); }
@Test public void getShouldReturnSimpleProfileOutboundResponseFromHubToResponseTransformerProviderWhenHubShouldSignResponseMessages() { when(transactionsConfigProxy.getShouldHubSignResponseMessages(ENTITY_ID)).thenReturn(false); when(simpleProfileOutboundResponseFromHubToResponseTransformerProvider.get()).thenReturn(simpleProfileOutboundResponseFromHubToResponseTransformer); Function<OutboundResponseFromHub, String> transformer = outboundResponseFromHubToResponseTransformerFactory.get(ENTITY_ID); assertThat(transformer).isEqualTo(simpleProfileOutboundResponseFromHubToResponseTransformer); }