### Question:
SpiToXs2aAccountDetailsMapper { public Xs2aAccountDetails mapToXs2aAccountDetails(SpiAccountDetails accountDetails) { return Optional.ofNullable(accountDetails) .map(ad -> new Xs2aAccountDetails( ad.getAspspAccountId(), ad.getResourceId(), ad.getIban(), ad.getBban(), ad.getPan(), ad.getMaskedPan(), ad.getMsisdn(), ad.getCurrency(), ad.getName(), ad.getDisplayName(), ad.getProduct(), mapToAccountType(ad.getCashSpiAccountType()), mapToAccountStatus(ad.getSpiAccountStatus()), ad.getBic(), ad.getLinkedAccounts(), mapToXs2aUsageType(ad.getUsageType()), ad.getDetails(), balanceMapper.mapToXs2aBalanceList(ad.getBalances()), accountDetails.getOwnerName(), Optional.ofNullable(accountDetails.getOwnerAddress()).map(spiToXs2aAddressMapper::mapToAddress).orElse(null) ) ) .orElse(null); }  Xs2aAccountDetails mapToXs2aAccountDetails(SpiAccountDetails accountDetails); Xs2aCardAccountDetails mapToXs2aCardAccountDetails(SpiCardAccountDetails cardAccountDetails); List<Xs2aAccountDetails> mapToXs2aAccountDetailsList(List<SpiAccountDetails> accountDetails); List<Xs2aCardAccountDetails> mapToXs2aCardAccountDetailsList(List<SpiCardAccountDetails> cardAccountDetails);  }### Answer:
@Test void mapToXs2aAccountDetails() { SpiAccountDetails spiAccountDetails = jsonReader.getObjectFromFile("json/SpiAccountDetails.json", SpiAccountDetails.class); Xs2aAccountDetails expectedXs2aAccountDetails = jsonReader.getObjectFromFile("json/Xs2aAccountDetails.json", Xs2aAccountDetails.class); List<SpiAccountBalance> spiAccountBalances = jsonReader.getObjectFromFile("json/SpiAccountBalanceForAccount.json", new TypeReference<List<SpiAccountBalance>>() { }); List<Xs2aBalance> xs2aBalances = jsonReader.getObjectFromFile("json/Xs2aBalanceForAccount.json", new TypeReference<List<Xs2aBalance>>() { }); when(balanceMapper.mapToXs2aBalanceList(spiAccountBalances)).thenReturn(xs2aBalances); Xs2aAccountDetails actualXs2aAccountDetails = spiToXs2aAccountDetailsMapper.mapToXs2aAccountDetails(spiAccountDetails); assertEquals(expectedXs2aAccountDetails, actualXs2aAccountDetails); }