@Test(expected = HystrixRuntimeException.class)
  public void testDependencyUnavailable() throws RealmAuthenticationException {

    stubFor(
        post(urlEqualTo(WS_CUSTOMER_SERVICE_URL))
            .willReturn(aResponse().withFault(Fault.EMPTY_RESPONSE)));

    customerUserRealm.authenticate(EMAIL, PASSWORD, newHashSet(UID), emptySet());
  }
  @Test(expected = RealmAuthenticationException.class)
  public void testNotAuthenticateWithEmptyResponse() throws RealmAuthenticationException {

    stubFor(
        post(urlEqualTo(WS_CUSTOMER_SERVICE_URL))
            .willReturn(
                aResponse()
                    .withStatus(OK.value())
                    .withHeader(ContentTypeHeader.KEY, TEXT_XML_VALUE)
                    .withBody(SOAP_EMPTY_RESPONSE)));

    customerUserRealm.authenticate(EMAIL, PASSWORD, newHashSet(UID), emptySet());
  }
  @Test
  public void testAuthenticate() throws RealmAuthenticationException {

    stubFor(
        post(urlEqualTo(WS_CUSTOMER_SERVICE_URL))
            .willReturn(
                aResponse()
                    .withStatus(OK.value())
                    .withHeader(ContentTypeHeader.KEY, TEXT_XML_VALUE)
                    .withBody(SOAP_RESPONSE)));

    Map<String, String> authenticate =
        customerUserRealm.authenticate(EMAIL, PASSWORD, newHashSet(UID), emptySet());
    assertThat(authenticate.get(SUB)).isEqualTo(CUSTOMER_NUMBER);
  }