### Question:
LedgersSpiAccountMapper { public SpiExchangeRate toSpiExchangeRate(ExchangeRateTO exchangeRate) { return Optional.ofNullable(exchangeRate) .map(e -> new SpiExchangeRate( e.getCurrencyFrom().getCurrencyCode(), e.getRateFrom(), e.getCurrency().getCurrencyCode(), e.getRateTo(), e.getRateDate(), e.getRateContract())) .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 toSpiExchangeRateWithRealData() { ExchangeRateTO inputData = jsonReader.getObjectFromFile("json/mappers/exchange-rate-to.json", ExchangeRateTO.class); SpiExchangeRate actualResult = ledgersSpiAccountMapper.toSpiExchangeRate(inputData); SpiExchangeRate expectedResult = jsonReader.getObjectFromFile("json/mappers/spi-exchange-rate.json", SpiExchangeRate.class); assertEquals(expectedResult, actualResult); }
@Test void toSpiExchangeRateWithNull() { SpiExchangeRate actualResult = ledgersSpiAccountMapper.toSpiExchangeRate(null); assertNull(actualResult); }