### Question:
AccountAspectService extends BaseAspectService<AccountController> { public ResponseObject<Xs2aAccountListHolder> getAccountDetailsListAspect(ResponseObject<Xs2aAccountListHolder> result) { if (!result.hasError()) { Xs2aAccountListHolder body = result.getBody(); List<Xs2aAccountDetails> accountDetails = body.getAccountDetails(); if (body.getAisConsent().getAisConsentRequestType() == AisConsentRequestType.ALL_AVAILABLE_ACCOUNTS) { accountDetails.forEach(acc -> acc.setLinks(null)); } else { accountDetails.forEach(acc -> acc.setLinks(new AccountDetailsLinks(getHttpUrl(), acc.getResourceId(), body.getAisConsent()))); } } return result; } @Autowired  AccountAspectService(AspspProfileServiceWrapper aspspProfileServiceWrapper); ResponseObject<Xs2aAccountDetailsHolder> getAccountDetailsAspect(ResponseObject<Xs2aAccountDetailsHolder> result); ResponseObject<Xs2aAccountListHolder> getAccountDetailsListAspect(ResponseObject<Xs2aAccountListHolder> result);  }### 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.<Xs2aAccountListHolder>builder() .body(new Xs2aAccountListHolder(Collections.singletonList(accountDetails), aisConsent)) .build(); ResponseObject actualResponse = service.getAccountDetailsListAspect(responseObject); assertNotNull(accountDetails.getLinks()); assertTrue(accountDetails.getLinks() instanceof AccountDetailsLinks); assertFalse(actualResponse.hasError()); }
@Test void getAccountDetailsListAspect_withError_shouldAddTextErrorMessage() { responseObject = ResponseObject.<Xs2aCreatePisCancellationAuthorisationResponse>builder() .fail(AIS_400, of(CONSENT_UNKNOWN_400)) .build(); ResponseObject actualResponse = service.getAccountDetailsListAspect(responseObject); assertTrue(actualResponse.hasError()); }