### Question:
Xs2aConsentService { public Optional<CreateAuthorisationResponse> createConsentAuthorisation(String consentId, ScaStatus scaStatus, PsuIdData psuData) { String tppRedirectURI = requestProviderService.getTppRedirectURI(); String tppNOKRedirectURI = requestProviderService.getTppNokRedirectURI(); CreateAuthorisationRequest request = xs2aConsentAuthorisationMapper.mapToAuthorisationRequest(scaStatus, psuData, scaApproachResolver.resolveScaApproach(), tppRedirectURI, tppNOKRedirectURI); return authorisationService.createAuthorisation(request, consentId, AuthorisationType.CONSENT); }  Optional<CreateAuthorisationResponse> createConsentAuthorisation(String consentId, ScaStatus scaStatus, PsuIdData psuData); Optional<ScaStatus> getAuthorisationScaStatus(String consentId, String authorisationId);  }### Answer:
@Test void createAisConsentAuthorization_success() { when(scaApproachResolver.resolveScaApproach()) .thenReturn(SCA_APPROACH); when(aisConsentAuthorisationMapper.mapToAuthorisationRequest(SCA_STATUS, PSU_DATA, SCA_APPROACH, REDIRECT_URI, NOK_REDIRECT_URI)) .thenReturn(AIS_CONSENT_AUTHORISATION_REQUEST); when(authorisationService.createAuthorisation(AIS_CONSENT_AUTHORISATION_REQUEST, CONSENT_ID, AuthorisationType.CONSENT)) .thenReturn(Optional.of(buildCreateAisConsentAuthorizationResponse())); when(requestProviderService.getTppRedirectURI()) .thenReturn(REDIRECT_URI); when(requestProviderService.getTppNokRedirectURI()) .thenReturn(NOK_REDIRECT_URI); Optional<CreateAuthorisationResponse> actualResponse = xs2aConsentService.createConsentAuthorisation(CONSENT_ID, SCA_STATUS, PSU_DATA); assertThat(actualResponse.isPresent()).isTrue(); assertThat(actualResponse.get()).isEqualTo(buildCreateAisConsentAuthorizationResponse()); }
@Test void createAisConsentAuthorization_false() { when(requestProviderService.getTppRedirectURI()).thenReturn("ok.uri"); when(requestProviderService.getTppNokRedirectURI()).thenReturn("nok.uri"); when(scaApproachResolver.resolveScaApproach()).thenReturn(SCA_APPROACH); CreateAuthorisationRequest request = new CreateAuthorisationRequest(); when(aisConsentAuthorisationMapper.mapToAuthorisationRequest(SCA_STATUS, PSU_DATA, SCA_APPROACH, "ok.uri", "nok.uri")) .thenReturn(request); when(authorisationService.createAuthorisation(request, CONSENT_ID, AuthorisationType.CONSENT)) .thenReturn(Optional.empty()); Optional<CreateAuthorisationResponse> actualResponse = xs2aConsentService.createConsentAuthorisation(CONSENT_ID, SCA_STATUS, PSU_DATA); assertThat(actualResponse.isPresent()).isFalse(); }