### Question:
PisAuthorisationService { public Optional<AuthorisationScaApproachResponse> getAuthorisationScaApproach(String authorisationId) { CmsResponse<AuthorisationScaApproachResponse> cmsResponse = authorisationServiceEncrypted.getAuthorisationScaApproach(authorisationId); if (cmsResponse.hasError()) { return Optional.empty(); } return Optional.ofNullable(cmsResponse.getPayload()); }  CreateAuthorisationResponse createPisAuthorisation(String paymentId, PsuIdData psuData); Xs2aUpdatePisCommonPaymentPsuDataResponse updatePisAuthorisation(Xs2aUpdatePisCommonPaymentPsuDataRequest request, ScaApproach scaApproach); Xs2aUpdatePisCommonPaymentPsuDataResponse updatePisCancellationAuthorisation(Xs2aUpdatePisCommonPaymentPsuDataRequest request, ScaApproach scaApproach); CreateAuthorisationResponse createPisAuthorisationCancellation(String paymentId, PsuIdData psuData); Optional<List<String>> getCancellationAuthorisationSubResources(String paymentId); Optional<List<String>> getAuthorisationSubResources(String paymentId); Optional<ScaStatus> getAuthorisationScaStatus(String paymentId, String authorisationId); Optional<ScaStatus> getCancellationAuthorisationScaStatus(String paymentId, String authorisationId); Optional<AuthorisationScaApproachResponse> getAuthorisationScaApproach(String authorisationId); void updateAuthorisation(UpdateAuthorisationRequest request,
                                    AuthorisationProcessorResponse response); void updateCancellationAuthorisation(UpdateAuthorisationRequest request,
                                                AuthorisationProcessorResponse response);  }### Answer:
@Test void getAuthorisationScaApproach() { AuthorisationScaApproachResponse payload = new AuthorisationScaApproachResponse(ScaApproach.DECOUPLED); when(authorisationServiceEncrypted.getAuthorisationScaApproach(eq(AUTHORISATION_ID))) .thenReturn(CmsResponse.<AuthorisationScaApproachResponse>builder().payload(payload).build()); Assertions.assertEquals(Optional.of(payload), pisAuthorisationService.getAuthorisationScaApproach(AUTHORISATION_ID)); verify(authorisationServiceEncrypted, times(1)).getAuthorisationScaApproach(eq(AUTHORISATION_ID)); }
@Test void getAuthorisationScaApproach_error() { when(authorisationServiceEncrypted.getAuthorisationScaApproach(eq(AUTHORISATION_ID))) .thenReturn(CmsResponse.<AuthorisationScaApproachResponse>builder().error(CmsError.TECHNICAL_ERROR).build()); Assertions.assertEquals(Optional.empty(), pisAuthorisationService.getAuthorisationScaApproach(AUTHORISATION_ID)); verify(authorisationServiceEncrypted, times(1)).getAuthorisationScaApproach(eq(AUTHORISATION_ID)); }