@Test public void testConvertWhenHandelsekodIsNYFRFM() { final String intygsId = "intygsid"; final LocalDateTime handelsetid = LocalDateTime.now().minusDays(1); final LocalDate sistaSvarsDatum = LocalDate.now().plusWeeks(3); final HandelsekodEnum handelsetyp = HandelsekodEnum.NYFRFM; final Amneskod amneskod = AmneskodCreator.create("KOMPLT", "Komplettering"); final int skickadeFragorTotalt = 8; final int skickadeFragorHanterade = 7; final int skickadeFragorBesvarade = 6; final int skickadeFragorEjBesvarade = 5; final int mottagnaFragorTotalt = 4; final int mottagnaFragorHanterade = 3; final int mottagnaFragorBesvarade = 2; final int mottagnaFragorEjBesvarade = 1; final Intyg intyg = buildIntyg(); ArendeCount skickadeFragor = new ArendeCount(skickadeFragorTotalt, skickadeFragorEjBesvarade, skickadeFragorBesvarade, skickadeFragorHanterade); ArendeCount mottagnaFragor = new ArendeCount(mottagnaFragorTotalt, mottagnaFragorEjBesvarade, mottagnaFragorBesvarade, mottagnaFragorHanterade); NotificationMessage msg = new NotificationMessage(intygsId, "luse", handelsetid, handelsetyp, "address", "", null, skickadeFragor, mottagnaFragor, SchemaVersion.VERSION_3, "ref", amneskod, sistaSvarsDatum); CertificateStatusUpdateForCareType res = NotificationTypeConverter.convert(msg, intyg); assertEquals(intyg, res.getIntyg()); assertEquals(HandelsekodEnum.NYFRFM.value(), res.getHandelse().getHandelsekod().getCode()); assertEquals(HandelsekodEnum.NYFRFM.description(), res.getHandelse().getHandelsekod().getDisplayName()); assertEquals(handelsetid, res.getHandelse().getTidpunkt()); assertEquals(sistaSvarsDatum, res.getHandelse().getSistaDatumForSvar()); assertEquals(amneskod.getCode(), res.getHandelse().getAmne().getCode()); assertEquals(amneskod.getCodeSystem(), res.getHandelse().getAmne().getCodeSystem()); assertEquals(amneskod.getDisplayName(), res.getHandelse().getAmne().getDisplayName()); assertSkickadeFrågor(skickadeFragorTotalt, skickadeFragorHanterade, skickadeFragorBesvarade, skickadeFragorEjBesvarade, res); assertMottagnaFragor(mottagnaFragorTotalt, mottagnaFragorHanterade, mottagnaFragorBesvarade, mottagnaFragorEjBesvarade, res); assertEquals(NotificationTypeConverter.TEMPORARY_ARBETSPLATSKOD, res.getIntyg().getSkapadAv().getEnhet().getArbetsplatskod().getExtension()); assertNull(res.getIntyg().getSkapadAv().getEnhet().getEpost()); }
public static CertificateStatusUpdateForCareType convert(NotificationMessage notificationMessage, Intyg intyg) { CertificateStatusUpdateForCareType destination = new CertificateStatusUpdateForCareType(); complementIntyg(intyg); destination.setIntyg(intyg); decorateWithHandelse(destination, notificationMessage); decorateWithArenden(destination, notificationMessage); destination.setRef(notificationMessage.getReference()); return destination; }
NotificationTypeConverter { public static CertificateStatusUpdateForCareType convert(NotificationMessage notificationMessage, Intyg intyg) { CertificateStatusUpdateForCareType destination = new CertificateStatusUpdateForCareType(); complementIntyg(intyg); destination.setIntyg(intyg); decorateWithHandelse(destination, notificationMessage); decorateWithArenden(destination, notificationMessage); destination.setRef(notificationMessage.getReference()); return destination; } }
NotificationTypeConverter { public static CertificateStatusUpdateForCareType convert(NotificationMessage notificationMessage, Intyg intyg) { CertificateStatusUpdateForCareType destination = new CertificateStatusUpdateForCareType(); complementIntyg(intyg); destination.setIntyg(intyg); decorateWithHandelse(destination, notificationMessage); decorateWithArenden(destination, notificationMessage); destination.setRef(notificationMessage.getReference()); return destination; } private  NotificationTypeConverter(); }
NotificationTypeConverter { public static CertificateStatusUpdateForCareType convert(NotificationMessage notificationMessage, Intyg intyg) { CertificateStatusUpdateForCareType destination = new CertificateStatusUpdateForCareType(); complementIntyg(intyg); destination.setIntyg(intyg); decorateWithHandelse(destination, notificationMessage); decorateWithArenden(destination, notificationMessage); destination.setRef(notificationMessage.getReference()); return destination; } private  NotificationTypeConverter(); static CertificateStatusUpdateForCareType convert(NotificationMessage notificationMessage, Intyg intyg); static Arenden toArenden(ArendeCount source); }
NotificationTypeConverter { public static CertificateStatusUpdateForCareType convert(NotificationMessage notificationMessage, Intyg intyg) { CertificateStatusUpdateForCareType destination = new CertificateStatusUpdateForCareType(); complementIntyg(intyg); destination.setIntyg(intyg); decorateWithHandelse(destination, notificationMessage); decorateWithArenden(destination, notificationMessage); destination.setRef(notificationMessage.getReference()); return destination; } private  NotificationTypeConverter(); static CertificateStatusUpdateForCareType convert(NotificationMessage notificationMessage, Intyg intyg); static Arenden toArenden(ArendeCount source);  }