### Question:
CmsToXs2aPaymentMapper { public CommonPayment mapToXs2aCommonPayment(CommonPaymentData response) { return Optional.ofNullable(response) .map(r -> { CommonPayment commonPayment = new CommonPayment(); commonPayment.setPaymentId(r.getExternalId()); commonPayment.setTransactionStatus(r.getTransactionStatus()); commonPayment.setPaymentProduct(r.getPaymentProduct()); commonPayment.setPaymentType(r.getPaymentType()); commonPayment.setPaymentData(r.getPaymentData()); commonPayment.setPsuDataList(r.getPsuData()); commonPayment.setStatusChangeTimestamp(r.getStatusChangeTimestamp()); commonPayment.setCreationTimestamp(r.getCreationTimestamp()); return commonPayment; } ) .orElse(null); }  CommonPayment mapToXs2aCommonPayment(CommonPaymentData response);  }### Answer:
@Test void mapToXs2aCommonPayment() { PisCommonPaymentResponse pisCommonPaymentResponse = buildPisCommonPaymentResponse(); CommonPayment commonPayment = cmsToXs2aPaymentMapper.mapToXs2aCommonPayment(pisCommonPaymentResponse); assertNotNull(commonPayment); assertEquals(PAYMENT_ID, commonPayment.getPaymentId()); assertEquals(PAYMENT_PRODUCT, commonPayment.getPaymentProduct()); assertEquals(TRANSACTION_STATUS, commonPayment.getTransactionStatus()); assertEquals(PAYMENT_TYPE, commonPayment.getPaymentType()); assertEquals(PAYMENT_DATA, commonPayment.getPaymentData()); assertEquals(PSU_ID_DATA_LIST, commonPayment.getPsuDataList()); assertEquals(STATUS_CHANGE_TIMESTAMP, commonPayment.getStatusChangeTimestamp()); assertEquals(pisCommonPaymentResponse.getCreationTimestamp(), commonPayment.getCreationTimestamp()); }
@Test void mapToXs2aCommonPayment_withNullPisCommonPaymentResponse_shouldReturnNull() { CommonPayment commonPayment = cmsToXs2aPaymentMapper.mapToXs2aCommonPayment(null); assertNull(commonPayment); }