### Question:
LedgersSpiAccountMapper { public SpiAccountDetails toSpiAccountDetails(AccountDetailsTO accountDetails) { return Optional.ofNullable(accountDetails) .map(d -> new SpiAccountDetails( d.getIban(), d.getId(), d.getIban(), d.getBban(), d.getPan(), d.getMaskedPan(), d.getMsisdn(), d.getCurrency(), d.getName(), MockAccountData.DISPLAY_NAME, d.getProduct(), SpiAccountType.valueOf(d.getAccountType().name()), SpiAccountStatus.valueOf(d.getAccountStatus().name()), d.getBic(), d.getLinkedAccounts(), SpiUsageType.valueOf(d.getUsageType().name()), d.getDetails(), toSpiAccountBalancesList(d.getBalances()), null, null)) .orElse(null); }  SpiAccountDetails toSpiAccountDetails(AccountDetailsTO accountDetails); SpiCardAccountDetails toSpiCardAccountDetails(AccountDetailsTO accountDetails); abstract List<SpiTransaction> toSpiTransactions(List<TransactionTO> transactions); abstract List<SpiCardTransaction> toSpiCardTransactions(List<TransactionTO> transactions); SpiTransaction toSpiTransaction(TransactionTO transaction); SpiCardTransaction toSpiCardTransaction(TransactionTO transaction); SpiAccountReference toSpiAccountReference(AccountReferenceTO reference); abstract List<SpiAccountBalance> toSpiAccountBalancesList(List<AccountBalanceTO> accountBalanceTOS); @Mapping(target = "spiBalanceType", expression = "java(mapToSpiBalanceType(accountBalanceTO.getBalanceType()))") @Mapping(source = "amount", target = "spiBalanceAmount") abstract SpiAccountBalance accountBalanceTOToSpiAccountBalance(AccountBalanceTO accountBalanceTO); abstract List<SpiExchangeRate> toSpiExchangeRateList(List<ExchangeRateTO> exchangeRates); SpiExchangeRate toSpiExchangeRate(ExchangeRateTO exchangeRate); SpiAmount toSpiAmount(AmountTO amount); abstract FundsConfirmationRequestTO toFundsConfirmationTO(SpiPsuData psuData, SpiFundsConfirmationRequest spiFundsConfirmationRequest); abstract AccountReferenceTO mapToAccountReferenceTO(SpiAccountReference spiAccountReference); String mapToRemittanceString(RemittanceInformationStructuredTO remittanceInformationStructuredTO);  }### Answer:
@Test void toSpiAccountDetailsListWithRealData() { AccountDetailsTO inputData = jsonReader.getObjectFromFile("json/mappers/account-details-to.json", AccountDetailsTO.class); SpiAccountDetails actualResult = ledgersSpiAccountMapper.toSpiAccountDetails(inputData); SpiAccountDetails expectedResult = jsonReader.getObjectFromFile("json/mappers/spi-account-details.json", SpiAccountDetails.class); assertEquals(expectedResult, actualResult); }
@Test void toSpiAccountDetailsListWithNull() { SpiAccountDetails actualResult = ledgersSpiAccountMapper.toSpiAccountDetails(null); assertNull(actualResult); }