### Question:
PaymentAuthorisationAspectService extends BaseAspectService<PaymentController> { public ResponseObject<Xs2aUpdatePisCommonPaymentPsuDataResponse> updatePisAuthorizationAspect(ResponseObject<Xs2aUpdatePisCommonPaymentPsuDataResponse> result, Xs2aUpdatePisCommonPaymentPsuDataRequest request) { if (!result.hasError()) { Xs2aUpdatePisCommonPaymentPsuDataResponse body = result.getBody(); body.setLinks(new UpdatePisPsuDataLinks(getHttpUrl(), scaApproachResolver, request, body.getScaStatus(), body.getChosenScaMethod())); } return result; } @Autowired  PaymentAuthorisationAspectService(ScaApproachResolver scaApproachResolver,
                                             AspspProfileServiceWrapper aspspProfileServiceWrapper, RedirectLinkBuilder redirectLinkBuilder,
                                             RedirectIdService redirectIdService, RequestProviderService requestProviderService); ResponseObject<AuthorisationResponse> createPisAuthorizationAspect(ResponseObject<AuthorisationResponse> result,
                                                                              Xs2aCreatePisAuthorisationRequest request); ResponseObject<Xs2aUpdatePisCommonPaymentPsuDataResponse> updatePisAuthorizationAspect(ResponseObject<Xs2aUpdatePisCommonPaymentPsuDataResponse> result,
                                                                                                  Xs2aUpdatePisCommonPaymentPsuDataRequest request);  }### Answer:
@Test void updatePisCancellationAuthorizationAspect_success() { AspspSettings aspspSettings = new JsonReader().getObjectFromFile("json/aspect/aspsp-settings.json", AspspSettings.class); when(aspspProfileServiceWrapper.isForceXs2aBaseLinksUrl()).thenReturn(aspspSettings.getCommon().isForceXs2aBaseLinksUrl()); when(aspspProfileServiceWrapper.getXs2aBaseLinksUrl()).thenReturn(aspspSettings.getCommon().getXs2aBaseLinksUrl()); when(updatePisCommonPaymentPsuDataResponse.getScaStatus()).thenReturn(ScaStatus.PSUAUTHENTICATED); responseObject = ResponseObject.<Xs2aUpdatePisCommonPaymentPsuDataResponse>builder() .body(updatePisCommonPaymentPsuDataResponse) .build(); ResponseObject actualResponse = service.updatePisAuthorizationAspect(responseObject, updateRequest); verify(updatePisCommonPaymentPsuDataResponse, times(1)).setLinks(any(UpdatePisPsuDataLinks.class)); assertFalse(actualResponse.hasError()); }
@Test void updatePisCancellationAuthorizationAspect_withError_shouldAddTextErrorMessage() { responseObject = ResponseObject.<Xs2aUpdatePisCommonPaymentPsuDataResponse>builder() .fail(AIS_400, of(CONSENT_UNKNOWN_400)) .build(); ResponseObject actualResponse = service.updatePisAuthorizationAspect(responseObject, updateRequest); assertTrue(actualResponse.hasError()); }