### Question:
CardAccountAspectService extends BaseAspectService<CardAccountController> { public ResponseObject<Xs2aCardAccountListHolder> getCardAccountList(ResponseObject<Xs2aCardAccountListHolder> result) { if (!result.hasError()) { Xs2aCardAccountListHolder body = result.getBody(); List<Xs2aCardAccountDetails> cardAccountDetails = body.getCardAccountDetails(); AisConsent aisConsent = body.getAisConsent(); if (aisConsent.getAisConsentRequestType() == AisConsentRequestType.ALL_AVAILABLE_ACCOUNTS) { cardAccountDetails.forEach(acc -> acc.setLinks(null)); } else { cardAccountDetails.forEach(acc -> setLinksForCardAccountDetails(acc, 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 getAccountDetailsListAspect_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.<Xs2aCardAccountListHolder>builder() .body(new Xs2aCardAccountListHolder(Collections.singletonList(accountDetails), aisConsent)) .build(); ResponseObject actualResponse = service.getCardAccountList(responseObject); assertNotNull(accountDetails.getLinks()); assertTrue(accountDetails.getLinks() instanceof CardAccountDetailsLinks); assertFalse(actualResponse.hasError()); }
@Test void getAccountDetailsListAspect_withError_shouldAddTextErrorMessage() { responseObject = ResponseObject.<Xs2aCreatePisCancellationAuthorisationResponse>builder() .fail(AIS_400, of(CONSENT_UNKNOWN_400)) .build(); ResponseObject actualResponse = service.getCardAccountList(responseObject); assertTrue(actualResponse.hasError()); }