@Test public void testConvertToCertificateEventDTO() { CertificateEvent event = new CertificateEvent(); event.setCertificateId(CERTIFICATE_ID); event.setEventCode(EventCode.SKAPAT); CertificateEventDTO dto = converter.convertToCertificateEventDTO(event); assertNotNull(dto); assertEquals(CERTIFICATE_ID, dto.getCertificateId()); assertEquals(EventCode.SKAPAT, dto.getEventCode()); }
public CertificateEventDTO convertToCertificateEventDTO(CertificateEvent event) { CertificateEventDTO eventDto = new CertificateEventDTO(event); if (event.getEventCode() == EventCode.ERSATTER || event.getEventCode() == EventCode.FORLANGER || event.getEventCode() == EventCode.SKAPATFRAN || event.getEventCode() == EventCode.KOPIERATFRAN || event.getEventCode() == EventCode.KOMPLETTERAR) { Optional<ExtendedEventMessage> dataForExtendedMessage = getDataForExtendedMessage(event); dataForExtendedMessage.ifPresent(message -> eventDto.setExtendedMessage(message)); } return eventDto; }
CertificateEventConverter { public CertificateEventDTO convertToCertificateEventDTO(CertificateEvent event) { CertificateEventDTO eventDto = new CertificateEventDTO(event); if (event.getEventCode() == EventCode.ERSATTER || event.getEventCode() == EventCode.FORLANGER || event.getEventCode() == EventCode.SKAPATFRAN || event.getEventCode() == EventCode.KOPIERATFRAN || event.getEventCode() == EventCode.KOMPLETTERAR) { Optional<ExtendedEventMessage> dataForExtendedMessage = getDataForExtendedMessage(event); dataForExtendedMessage.ifPresent(message -> eventDto.setExtendedMessage(message)); } return eventDto; } }
CertificateEventConverter { public CertificateEventDTO convertToCertificateEventDTO(CertificateEvent event) { CertificateEventDTO eventDto = new CertificateEventDTO(event); if (event.getEventCode() == EventCode.ERSATTER || event.getEventCode() == EventCode.FORLANGER || event.getEventCode() == EventCode.SKAPATFRAN || event.getEventCode() == EventCode.KOPIERATFRAN || event.getEventCode() == EventCode.KOMPLETTERAR) { Optional<ExtendedEventMessage> dataForExtendedMessage = getDataForExtendedMessage(event); dataForExtendedMessage.ifPresent(message -> eventDto.setExtendedMessage(message)); } return eventDto; }  }
CertificateEventConverter { public CertificateEventDTO convertToCertificateEventDTO(CertificateEvent event) { CertificateEventDTO eventDto = new CertificateEventDTO(event); if (event.getEventCode() == EventCode.ERSATTER || event.getEventCode() == EventCode.FORLANGER || event.getEventCode() == EventCode.SKAPATFRAN || event.getEventCode() == EventCode.KOPIERATFRAN || event.getEventCode() == EventCode.KOMPLETTERAR) { Optional<ExtendedEventMessage> dataForExtendedMessage = getDataForExtendedMessage(event); dataForExtendedMessage.ifPresent(message -> eventDto.setExtendedMessage(message)); } return eventDto; }  CertificateEventDTO convertToCertificateEventDTO(CertificateEvent event); }
CertificateEventConverter { public CertificateEventDTO convertToCertificateEventDTO(CertificateEvent event) { CertificateEventDTO eventDto = new CertificateEventDTO(event); if (event.getEventCode() == EventCode.ERSATTER || event.getEventCode() == EventCode.FORLANGER || event.getEventCode() == EventCode.SKAPATFRAN || event.getEventCode() == EventCode.KOPIERATFRAN || event.getEventCode() == EventCode.KOMPLETTERAR) { Optional<ExtendedEventMessage> dataForExtendedMessage = getDataForExtendedMessage(event); dataForExtendedMessage.ifPresent(message -> eventDto.setExtendedMessage(message)); } return eventDto; }  CertificateEventDTO convertToCertificateEventDTO(CertificateEvent event);  }