### Question:
PsuDataMapper { public PsuData mapToPsuData(PsuIdData psuIdData, String instanceId) { return Optional.ofNullable(psuIdData) .filter(PsuIdData::isNotEmpty) .map(psu -> new PsuData( psu.getPsuId(), psu.getPsuIdType(), psu.getPsuCorporateId(), psu.getPsuCorporateIdType(), psu.getPsuIpAddress(), mapToAdditionalPsuData(psu.getAdditionalPsuIdData()) )) .map(psu -> setInstanceId(psu, instanceId)) .orElse(null); }  List<PsuData> mapToPsuDataList(List<PsuIdData> psuIdDataList, String instanceId); List<PsuIdData> mapToPsuIdDataList(List<PsuData> psuIdDataList); PsuData mapToPsuData(PsuIdData psuIdData, String instanceId); PsuIdData mapToPsuIdData(PsuData psuData);  }### Answer:
@Test void mapToPsuData_WithAdditionalPsuIdData() { PsuIdData psuIdData = jsonReader.getObjectFromFile("json/service/mapper/psu-id-data.json", PsuIdData.class); PsuData expected = jsonReader.getObjectFromFile("json/service/mapper/psu-data.json", PsuData.class); PsuData psuData = psuDataMapper.mapToPsuData(psuIdData, DEFAULT_SERVICE_INSTANCE_ID); assertEquals(expected, psuData); }
@Test void mapToPsuData_WithoutAdditionalPsuIdData() { PsuIdData psuIdData = jsonReader.getObjectFromFile("json/service/mapper/psu-id-data-with-additional-psu-id-data.json", PsuIdData.class); PsuData expected = jsonReader.getObjectFromFile("json/service/mapper/psu-data-with-additional-psu-data.json", PsuData.class); PsuData psuData = psuDataMapper.mapToPsuData(psuIdData, DEFAULT_SERVICE_INSTANCE_ID); assertEquals(expected, psuData); }