### Question:
CardAccountAspectService extends BaseAspectService<CardAccountController> { public ResponseObject<Xs2aCardAccountDetailsHolder> getCardAccountDetails(ResponseObject<Xs2aCardAccountDetailsHolder> result) { if (!result.hasError()) { Xs2aCardAccountDetailsHolder body = result.getBody(); setLinksForCardAccountDetails(body.getCardAccountDetails(), body.getAisConsent()); } return result; } @Autowired  CardAccountAspectService(AspspProfileServiceWrapper aspspProfileServiceWrapper); ResponseObject<Xs2aCardAccountListHolder> getCardAccountList(ResponseObject<Xs2aCardAccountListHolder> result); ResponseObject<Xs2aCardAccountDetailsHolder> getCardAccountDetails(ResponseObject<Xs2aCardAccountDetailsHolder> result); ResponseObject<Xs2aCardTransactionsReport> getTransactionsReportByPeriod(ResponseObject<Xs2aCardTransactionsReport> result,
                                                                                    Xs2aTransactionsReportByPeriodRequest request);  }### Answer:
@Test void getCardAccountDetailsAspect_success() { AspspSettings aspspSettings = jsonReader.getObjectFromFile("json/aspect/aspsp-settings.json", AspspSettings.class); when(aspspProfileServiceWrapper.isForceXs2aBaseLinksUrl()) .thenReturn(aspspSettings.getCommon().isForceXs2aBaseLinksUrl()); when(aspspProfileServiceWrapper.getXs2aBaseLinksUrl()) .thenReturn(aspspSettings.getCommon().getXs2aBaseLinksUrl()); responseObject = ResponseObject.<Xs2aCardAccountDetailsHolder>builder() .body(new Xs2aCardAccountDetailsHolder(accountDetails, aisConsent)) .build(); ResponseObject actualResponse = service.getCardAccountDetails(responseObject); assertNotNull(accountDetails.getLinks()); assertTrue(accountDetails.getLinks() instanceof CardAccountDetailsLinks); assertFalse(actualResponse.hasError()); }
@Test void getAccountDetailsAspect_withError_shouldAddTextErrorMessage() { responseObject = ResponseObject.<Xs2aCreatePisCancellationAuthorisationResponse>builder() .fail(AIS_400, of(CONSENT_UNKNOWN_400)) .build(); ResponseObject actualResponse = service.getCardAccountDetails(responseObject); assertTrue(actualResponse.hasError()); }