@Test
  public void adaptedAsyncServerAuthModuleShouldAdaptGetModuleIdCall() {

    // Given
    ServerAuthModule authModule = mock(ServerAuthModule.class);

    // When
    AsyncServerAuthModule asyncAuthModule = JaspiAdapters.adapt(authModule);
    String moduleId = asyncAuthModule.getModuleId();

    // Then
    Assertions.assertThat(moduleId).isEqualTo(authModule.getClass().getCanonicalName());
  }
  @Test
  public void adaptedAsyncServerAuthModuleShouldAdaptGetSupportedMessageTypesCall() {

    // Given
    ServerAuthModule authModule = mock(ServerAuthModule.class);

    given(authModule.getSupportedMessageTypes())
        .willReturn(new Class<?>[] {Request.class, Response.class});

    // When
    AsyncServerAuthModule asyncAuthModule = JaspiAdapters.adapt(authModule);
    asyncAuthModule.getSupportedMessageTypes();

    // Then
    verify(authModule).getSupportedMessageTypes();
  }
  @Test
  public void adaptedAsyncServerAuthModuleShouldAdaptSuccessfulSecureResponseCall()
      throws AuthException {

    // Given
    ServerAuthModule authModule = mock(ServerAuthModule.class);
    MessageInfoContext messageInfo = mock(MessageInfoContext.class);
    Subject serviceSubject = new Subject();

    given(authModule.secureResponse(any(MessageInfo.class), eq(serviceSubject)))
        .willReturn(AuthStatus.SEND_SUCCESS);

    // When
    AsyncServerAuthModule asyncAuthModule = JaspiAdapters.adapt(authModule);
    Promise<AuthStatus, AuthenticationException> promise =
        asyncAuthModule.secureResponse(messageInfo, serviceSubject);

    // Then
    assertThat(promise).succeeded().withObject().isEqualTo(AuthStatus.SEND_SUCCESS);
  }