### Question:
RedirectAisAuthorizationService implements AisAuthorizationService { @Override public Optional<CreateConsentAuthorizationResponse> createConsentAuthorization(PsuIdData psuData, String consentId) { return consentService.createConsentAuthorisation(consentId, ScaStatus.RECEIVED, psuData) .map(auth -> { CreateConsentAuthorizationResponse resp = new CreateConsentAuthorizationResponse(); resp.setConsentId(consentId); resp.setAuthorisationId(auth.getAuthorizationId()); resp.setScaStatus(auth.getScaStatus()); resp.setInternalRequestId(auth.getInternalRequestId()); resp.setPsuIdData(psuData); return resp; }); }  @Override Optional<CreateConsentAuthorizationResponse> createConsentAuthorization(PsuIdData psuData, String consentId); @Override AuthorisationProcessorResponse updateConsentPsuData(UpdateAuthorisationRequest request, AuthorisationProcessorResponse response); @Override Optional<Authorisation> getConsentAuthorizationById(String authorizationId); @Override Optional<ScaStatus> getAuthorisationScaStatus(String consentId, String authorisationId); @Override ScaApproach getScaApproachServiceType();  }### Answer:
@Test void createConsentAuthorization_success() { when(xs2aConsentService.createConsentAuthorisation(CONSENT_ID, ScaStatus.RECEIVED, PSU_ID_DATA)) .thenReturn(Optional.of(buildCreateAisConsentAuthorizationResponse())); Optional<CreateConsentAuthorizationResponse> actualResponse = redirectAisAuthorisationService.createConsentAuthorization(PSU_ID_DATA, CONSENT_ID); assertThat(actualResponse.isPresent()).isTrue(); assertThat(actualResponse).isEqualTo(Optional.of(CREATE_CONSENT_AUTHORIZATION_RESPONSE)); }
@Test void createConsentAuthorization_wrongConsentId_fail() { when(xs2aConsentService.createConsentAuthorisation(WRONG_CONSENT_ID, ScaStatus.RECEIVED, PSU_ID_DATA)) .thenReturn(Optional.empty()); Optional<CreateConsentAuthorizationResponse> actualResponse = redirectAisAuthorisationService.createConsentAuthorization(PSU_ID_DATA, WRONG_CONSENT_ID); assertThat(actualResponse.isPresent()).isFalse(); }