### Question:
PisAuthorisationService { public Optional<ScaStatus> getAuthorisationScaStatus(String paymentId, String authorisationId) { CmsResponse<ScaStatus> cmsResponse = authorisationServiceEncrypted.getAuthorisationScaStatus(authorisationId, new PisAuthorisationParentHolder(paymentId)); 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 getAuthorisationScaStatus() { ArgumentCaptor<PisAuthorisationParentHolder> authorisationParentHolderCaptor = ArgumentCaptor.forClass(PisAuthorisationParentHolder.class); when(authorisationServiceEncrypted.getAuthorisationScaStatus(eq(AUTHORISATION_ID), any(PisAuthorisationParentHolder.class))) .thenReturn(CmsResponse.<ScaStatus>builder().payload(ScaStatus.PSUIDENTIFIED).build()); Assertions.assertEquals(Optional.of(ScaStatus.PSUIDENTIFIED), pisAuthorisationService.getAuthorisationScaStatus(PAYMENT_ID, AUTHORISATION_ID)); verify(authorisationServiceEncrypted, times(1)).getAuthorisationScaStatus(eq(AUTHORISATION_ID), authorisationParentHolderCaptor.capture()); Assertions.assertEquals(PAYMENT_ID, authorisationParentHolderCaptor.getValue().getParentId()); }
@Test void getAuthorisationScaStatus_error() { ArgumentCaptor<PisAuthorisationParentHolder> authorisationParentHolderCaptor = ArgumentCaptor.forClass(PisAuthorisationParentHolder.class); when(authorisationServiceEncrypted.getAuthorisationScaStatus(eq(AUTHORISATION_ID), any(PisAuthorisationParentHolder.class))) .thenReturn(CmsResponse.<ScaStatus>builder().error(CmsError.TECHNICAL_ERROR).build()); Assertions.assertEquals(Optional.empty(), pisAuthorisationService.getAuthorisationScaStatus(PAYMENT_ID, AUTHORISATION_ID)); verify(authorisationServiceEncrypted, times(1)).getAuthorisationScaStatus(eq(AUTHORISATION_ID), authorisationParentHolderCaptor.capture()); Assertions.assertEquals(PAYMENT_ID, authorisationParentHolderCaptor.getValue().getParentId()); }