### Question:
LedgersSpiPaymentToMapper { public PaymentTO toPaymentTO_Periodic(SpiPaymentInfo spiPaymentInfo) { return Optional.ofNullable(spiPaymentInfo.getPaymentData()) .filter(ArrayUtils::isNotEmpty) .map(paymentData -> convert(paymentData, PeriodicPaymentInitiationJson.class)) .map(payment -> { PaymentTO paymentTO = new PaymentTO(); paymentTO.setPaymentId(spiPaymentInfo.getPaymentId()); paymentTO.setPaymentType(PaymentTypeTO.valueOf(spiPaymentInfo.getPaymentType().name())); paymentTO.setPaymentProduct(spiPaymentInfo.getPaymentProduct()); paymentTO.setDebtorAccount(mapToAccountReferenceTO(payment.getDebtorAccount())); paymentTO.setStartDate(payment.getStartDate()); paymentTO.setEndDate(payment.getEndDate()); paymentTO.setExecutionRule(Optional.ofNullable(payment.getExecutionRule()) .map(ExecutionRule::toString) .orElse(null)); paymentTO.setFrequency(mapToFrequencyCodeTO(payment.getFrequency())); paymentTO.setDayOfExecution(Optional.ofNullable(payment.getDayOfExecution()) .map(d -> Integer.valueOf(d.toString())) .orElse(null)); paymentTO.setDebtorName(payment.getUltimateDebtor()); paymentTO.setTargets(Collections.singletonList(mapToPaymentTargetTO(payment, spiPaymentInfo))); return paymentTO; }) .orElse(null); }  PaymentTO toPaymentTO_Single(SpiPaymentInfo spiPaymentInfo); PaymentTO toPaymentTO_Bulk(SpiPaymentInfo spiPaymentInfo); PaymentTO toPaymentTO_Periodic(SpiPaymentInfo spiPaymentInfo);  }### Answer:
@Test void toPaymentTO_Periodic_valid() { PaymentTO expectedResult = jsonReader.getObjectFromFile("json/mappers/payment-to-from-periodic-payment-Initiation.json", PaymentTO.class); SpiPaymentInfo spiPaymentInfo = jsonReader.getObjectFromFile("json/mappers/periodic-payment-Initiation.json", SpiPaymentInfo.class); PaymentTO actualResult = ledgersSpiPaymentToMapper.toPaymentTO_Periodic(spiPaymentInfo); assertEquals(expectedResult, actualResult); }