### Question:
CmsToXs2aPaymentSupportMapper { public BulkPayment mapToBulkPayment(CommonPaymentData commonPayment) { if (commonPayment == null) { return null; } byte[] paymentData = commonPayment.getPaymentData(); BulkPayment originalBulkPayment = rawToXs2aPaymentMapper.mapToBulkPayment(paymentData); BulkPayment bulkPayment = enrichWithCommonProperties(originalBulkPayment, commonPayment); List<SinglePayment> payments = bulkPayment.getPayments(); if (payments != null) { bulkPayment.setPayments(enrichBulkPaymentParts(commonPayment, payments)); } return bulkPayment; }  SinglePayment mapToSinglePayment(CommonPaymentData commonPayment); PeriodicPayment mapToPeriodicPayment(CommonPaymentData commonPayment); BulkPayment mapToBulkPayment(CommonPaymentData commonPayment);  }### Answer:
@Test void mapToBulkPayment() { BulkPayment rawBulkPayment = jsonReader.getObjectFromFile("json/support/mapper/raw-xs2a-bulk-payment.json", BulkPayment.class); when(rawToXs2aPaymentMapper.mapToBulkPayment(PAYMENT_BODY)).thenReturn(rawBulkPayment); BulkPayment expectedBulkPayment = jsonReader.getObjectFromFile("json/support/mapper/enriched-xs2a-bulk-payment.json", BulkPayment.class); CommonPaymentData commonPaymentData = buildCommonPaymentData(); BulkPayment actual = cmsToXs2APaymentSupportMapper.mapToBulkPayment(commonPaymentData); assertEquals(expectedBulkPayment, actual); }
@Test void mapToBulkPayment_nullPayments() { BulkPayment rawBulkPayment = jsonReader.getObjectFromFile("json/support/mapper/raw-xs2a-bulk-payment.json", BulkPayment.class); rawBulkPayment.setPayments(null); when(rawToXs2aPaymentMapper.mapToBulkPayment(PAYMENT_BODY)).thenReturn(rawBulkPayment); BulkPayment expectedBulkPayment = jsonReader.getObjectFromFile("json/support/mapper/enriched-xs2a-bulk-payment.json", BulkPayment.class); expectedBulkPayment.setPayments(null); CommonPaymentData commonPaymentData = buildCommonPaymentData(); BulkPayment actual = cmsToXs2APaymentSupportMapper.mapToBulkPayment(commonPaymentData); assertEquals(expectedBulkPayment, actual); }
@Test void mapToBulkPayment_null() { BulkPayment actual = cmsToXs2APaymentSupportMapper.mapToBulkPayment(null); assertNull(actual); }