### Question:
PisCommonPaymentMapper { public PisCommonPaymentData mapToPisCommonPaymentData(PisPaymentInfo paymentInfo) { PisCommonPaymentData commonPaymentData = new PisCommonPaymentData(); commonPaymentData.setPaymentId(paymentInfo.getPaymentId()); commonPaymentData.setPaymentType(paymentInfo.getPaymentType()); commonPaymentData.setPaymentProduct(paymentInfo.getPaymentProduct()); commonPaymentData.setTransactionStatus(paymentInfo.getTransactionStatus()); commonPaymentData.setPayment(paymentInfo.getPaymentData()); commonPaymentData.setTppInfo(tppInfoMapper.mapToTppInfoEntity(paymentInfo.getTppInfo())); commonPaymentData.setPsuDataList(psuDataMapper.mapToPsuDataList(paymentInfo.getPsuDataList(), paymentInfo.getInstanceId())); commonPaymentData.getPsuDataList().forEach(p -> p.setInstanceId(paymentInfo.getInstanceId())); commonPaymentData.setMultilevelScaRequired(paymentInfo.isMultilevelScaRequired()); commonPaymentData.setAspspAccountId(paymentInfo.getAspspAccountId()); AuthorisationTemplateEntity authorisationTemplate = new AuthorisationTemplateEntity(); TppRedirectUri tppRedirectUri = paymentInfo.getTppRedirectUri(); if (tppRedirectUri != null) { authorisationTemplate.setRedirectUri(tppRedirectUri.getUri()); authorisationTemplate.setNokRedirectUri(tppRedirectUri.getNokUri()); } commonPaymentData.setAuthorisationTemplate(authorisationTemplate); commonPaymentData.setInternalRequestId(paymentInfo.getInternalRequestId()); Optional.ofNullable(paymentInfo.getCreationTimestamp()).ifPresent(commonPaymentData::setCreationTimestamp); commonPaymentData.setTppNotificationUri(paymentInfo.getTppNotificationUri()); commonPaymentData.setTppNotificationContentPreferred(paymentInfo.getNotificationSupportedModes()); commonPaymentData.setContentType(paymentInfo.getContentType()); commonPaymentData.setTppBrandLoggingInformation(paymentInfo.getTppBrandLoggingInformation()); commonPaymentData.setInstanceId(paymentInfo.getInstanceId()); return commonPaymentData; }  PisCommonPaymentData mapToPisCommonPaymentData(PisPaymentInfo paymentInfo); List<PisCommonPaymentResponse> mapToPisCommonPaymentResponses(List<PisCommonPaymentData> commonPaymentDatas, Map<String, List<AuthorisationEntity>> authorisations); Optional<PisCommonPaymentResponse> mapToPisCommonPaymentResponse(PisCommonPaymentData commonPaymentData, List<AuthorisationEntity> authorisations); PisPayment mapToPisPayment(PisPaymentData payment);  }### Answer:
@Test public void mapToPisCommonPaymentData() { PsuData psuDataEntity = jsonReader.getObjectFromFile("json/service/mapper/psu-data.json", PsuData.class); PsuIdData psuIdData = jsonReader.getObjectFromFile("json/service/mapper/psu-id-data.json", PsuIdData.class); when(psuDataMapper.mapToPsuDataList(Collections.singletonList(psuIdData), null)) .thenReturn(Collections.singletonList(psuDataEntity)); TppInfoEntity tppInfoEntity = jsonReader.getObjectFromFile("json/service/mapper/tpp-info-entity.json", TppInfoEntity.class); TppInfo tppInfo = jsonReader.getObjectFromFile("json/service/mapper/tpp-info.json", TppInfo.class); when(tppInfoMapper.mapToTppInfoEntity(tppInfo)).thenReturn(tppInfoEntity); PisPaymentInfo pisPaymentInfo = jsonReader.getObjectFromFile("json/service/mapper/pis-common-payment-info.json", PisPaymentInfo.class); PisCommonPaymentData pisCommonPaymentData = pisCommonPaymentMapper.mapToPisCommonPaymentData(pisPaymentInfo); PisCommonPaymentData pisCommonPaymentDataExpected = jsonReader.getObjectFromFile("json/service/mapper/pis-common-payment-data-creation.json", PisCommonPaymentData.class); assertEquals(pisCommonPaymentDataExpected, pisCommonPaymentData); }