### Question:
SuccessfulMatchStateController extends AbstractSuccessfulMatchStateController<SuccessfulMatchState> { @Override public ResponseFromHub getPreparedResponse() { Collection<String> enabledIdentityProviders = identityProvidersConfigProxy.getEnabledIdentityProvidersForAuthenticationResponseProcessing( state.getRequestIssuerEntityId(), state.isRegistering(), state.getLevelOfAssurance()); if (!enabledIdentityProviders.contains(state.getIdentityProviderEntityId())) { throw new IdpDisabledException(state.getIdentityProviderEntityId()); } return getResponse(); } SuccessfulMatchStateController(
            final SuccessfulMatchState state,
            final ResponseFromHubFactory responseFromHubFactory,
            final IdentityProvidersConfigProxy identityProvidersConfigProxy); @Override ResponseFromHub getPreparedResponse();  }### Answer:
@Test(expected = IdpDisabledException.class) public void getPreparedResponse_shouldThrowWhenIdpIsDisabled() { when(identityProvidersConfigProxy.getEnabledIdentityProvidersForAuthenticationResponseProcessing(any(String.class), anyBoolean(), any(LevelOfAssurance.class))) .thenReturn(emptyList()); controller.getPreparedResponse(); }
@Test public void getPreparedResponse_shouldReturnResponse() { final List<String> enabledIdentityProviders = singletonList(state.getIdentityProviderEntityId()); final ResponseFromHub expectedResponseFromHub = ResponseFromHubBuilder.aResponseFromHubDto().build(); when(identityProvidersConfigProxy.getEnabledIdentityProvidersForAuthenticationResponseProcessing(eq(state.getRequestIssuerEntityId()), anyBoolean(), any(LevelOfAssurance.class))) .thenReturn(enabledIdentityProviders); when(responseFromHubFactory.createSuccessResponseFromHub( state.getRequestId(), state.getMatchingServiceAssertion(), state.getRelayState(), state.getRequestIssuerEntityId(), state.getAssertionConsumerServiceUri())) .thenReturn(expectedResponseFromHub); final ResponseFromHub result = controller.getPreparedResponse(); assertThat(result).isEqualTo(expectedResponseFromHub); }