@Test
  public void adaptedAsyncServerAuthModuleShouldAdaptSuccessfulGetInitializeCall()
      throws AuthException {

    // Given
    ServerAuthModule authModule = mock(ServerAuthModule.class);
    MessagePolicy requestPolicy = mock(MessagePolicy.class);
    MessagePolicy responsePolicy = mock(MessagePolicy.class);
    CallbackHandler handler = mock(CallbackHandler.class);
    Map<String, Object> options = Collections.emptyMap();

    // When
    AsyncServerAuthModule asyncAuthModule = JaspiAdapters.adapt(authModule);
    Promise<Void, AuthenticationException> promise =
        asyncAuthModule.initialize(requestPolicy, responsePolicy, handler, options);

    // Then
    assertThat(promise).succeeded().withObject().isNull();
    verify(authModule).initialize(requestPolicy, responsePolicy, handler, options);
  }
  @Test
  public void adaptedAsyncServerAuthModuleShouldAdaptFailedGetInitializeCall()
      throws AuthException {

    // Given
    ServerAuthModule authModule = mock(ServerAuthModule.class);
    MessagePolicy requestPolicy = mock(MessagePolicy.class);
    MessagePolicy responsePolicy = mock(MessagePolicy.class);
    CallbackHandler handler = mock(CallbackHandler.class);
    Map<String, Object> options = Collections.emptyMap();

    doThrow(AuthException.class)
        .when(authModule)
        .initialize(requestPolicy, responsePolicy, handler, options);

    // When
    AsyncServerAuthModule asyncAuthModule = JaspiAdapters.adapt(authModule);
    Promise<Void, AuthenticationException> promise =
        asyncAuthModule.initialize(requestPolicy, responsePolicy, handler, options);

    // Then
    assertThat(promise).failedWithException().isInstanceOf(AuthenticationException.class);
  }