@Test public void testListCertificatesForCareWithQA() { final Personnummer personnummer = Personnummer.createPersonnummer("191212121212").get(); final String enhet = "enhetHsaId"; final LocalDate deadline = LocalDate.of(2017, 1, 1); final String reference = "ref"; Handelse handelse = new Handelse(); handelse.setCode(HandelsekodEnum.SKAPAT); handelse.setTimestamp(LocalDateTime.now()); handelse.setAmne(ArendeAmne.AVSTMN); handelse.setSistaDatumForSvar(deadline); when(intygService.listCertificatesForCareWithQA(any(IntygWithNotificationsRequest.class))).thenReturn(Arrays.asList( new IntygWithNotificationsResponse(null, Arrays.asList(handelse), new ArendeCount(1, 1, 1, 1), new ArendeCount(2, 2, 2, 2), reference))); ListCertificatesForCareWithQAType request = new ListCertificatesForCareWithQAType(); PersonId personId = new PersonId(); personId.setExtension(personnummer.getPersonnummer()); request.setPersonId(personId); HsaId hsaId = new HsaId(); hsaId.setExtension(enhet); request.getEnhetsId().add(hsaId); ListCertificatesForCareWithQAResponseType response = responder.listCertificatesForCareWithQA("logicalAdress", request); assertNotNull(response); assertNotNull(response.getList()); assertNotNull(response.getList().getItem()); assertEquals(1, response.getList().getItem().size()); assertEquals(1, response.getList().getItem().get(0).getHandelser().getHandelse().size()); assertEquals(reference, response.getList().getItem().get(0).getRef()); assertEquals(deadline, response.getList().getItem().get(0).getHandelser().getHandelse().get(0).getSistaDatumForSvar()); assertEquals(HandelsekodEnum.SKAPAT.name(), response.getList().getItem().get(0).getHandelser().getHandelse().get(0).getHandelsekod().getCode()); assertEquals(ArendeAmne.AVSTMN.name(), response.getList().getItem().get(0).getHandelser().getHandelse().get(0).getAmne().getCode()); }
@Override public ListCertificatesForCareWithQAResponseType listCertificatesForCareWithQA(String s, ListCertificatesForCareWithQAType request) { Objects.requireNonNull(request.getEnhetsId()); if (!validate(request)) { throw new IllegalArgumentException(); } ListCertificatesForCareWithQAResponseType response = new ListCertificatesForCareWithQAResponseType(); List list = new List(); IntygWithNotificationsRequest.Builder builder = new IntygWithNotificationsRequest.Builder() .setPersonnummer(Personnummer.createPersonnummer(request.getPersonId().getExtension()).get()); if (!request.getEnhetsId().isEmpty()) { builder = builder.setEnhetId(request.getEnhetsId().stream().map(HsaId::getExtension).collect(Collectors.toList())); } if (request.getVardgivarId() != null) { builder = builder.setVardgivarId(request.getVardgivarId().getExtension()); } if (request.getFromTidpunkt() != null) { builder = builder.setStartDate(request.getFromTidpunkt()); } if (request.getTomTidpunkt() != null) { builder = builder.setEndDate(request.getTomTidpunkt()); } java.util.List<IntygWithNotificationsResponse> intygWithNotifications = intygService.listCertificatesForCareWithQA(builder.build()); for (IntygWithNotificationsResponse intygHolder : intygWithNotifications) { ListItem item = new ListItem(); item.setIntyg(intygHolder.getIntyg()); HandelseList handelseList = new HandelseList(); handelseList.getHandelse().addAll(intygHolder.getNotifications().stream() .map(ListCertificatesForCareWithQAResponderImpl::toHandelse) .collect(Collectors.toList())); item.setHandelser(handelseList); item.setSkickadeFragor(toArenden(intygHolder.getSentQuestions())); item.setMottagnaFragor(toArenden(intygHolder.getReceivedQuestions())); item.setRef(intygHolder.getRef()); list.getItem().add(item); } response.setList(list); return response; }
ListCertificatesForCareWithQAResponderImpl implements ListCertificatesForCareWithQAResponderInterface { @Override public ListCertificatesForCareWithQAResponseType listCertificatesForCareWithQA(String s, ListCertificatesForCareWithQAType request) { Objects.requireNonNull(request.getEnhetsId()); if (!validate(request)) { throw new IllegalArgumentException(); } ListCertificatesForCareWithQAResponseType response = new ListCertificatesForCareWithQAResponseType(); List list = new List(); IntygWithNotificationsRequest.Builder builder = new IntygWithNotificationsRequest.Builder() .setPersonnummer(Personnummer.createPersonnummer(request.getPersonId().getExtension()).get()); if (!request.getEnhetsId().isEmpty()) { builder = builder.setEnhetId(request.getEnhetsId().stream().map(HsaId::getExtension).collect(Collectors.toList())); } if (request.getVardgivarId() != null) { builder = builder.setVardgivarId(request.getVardgivarId().getExtension()); } if (request.getFromTidpunkt() != null) { builder = builder.setStartDate(request.getFromTidpunkt()); } if (request.getTomTidpunkt() != null) { builder = builder.setEndDate(request.getTomTidpunkt()); } java.util.List<IntygWithNotificationsResponse> intygWithNotifications = intygService.listCertificatesForCareWithQA(builder.build()); for (IntygWithNotificationsResponse intygHolder : intygWithNotifications) { ListItem item = new ListItem(); item.setIntyg(intygHolder.getIntyg()); HandelseList handelseList = new HandelseList(); handelseList.getHandelse().addAll(intygHolder.getNotifications().stream() .map(ListCertificatesForCareWithQAResponderImpl::toHandelse) .collect(Collectors.toList())); item.setHandelser(handelseList); item.setSkickadeFragor(toArenden(intygHolder.getSentQuestions())); item.setMottagnaFragor(toArenden(intygHolder.getReceivedQuestions())); item.setRef(intygHolder.getRef()); list.getItem().add(item); } response.setList(list); return response; } }
ListCertificatesForCareWithQAResponderImpl implements ListCertificatesForCareWithQAResponderInterface { @Override public ListCertificatesForCareWithQAResponseType listCertificatesForCareWithQA(String s, ListCertificatesForCareWithQAType request) { Objects.requireNonNull(request.getEnhetsId()); if (!validate(request)) { throw new IllegalArgumentException(); } ListCertificatesForCareWithQAResponseType response = new ListCertificatesForCareWithQAResponseType(); List list = new List(); IntygWithNotificationsRequest.Builder builder = new IntygWithNotificationsRequest.Builder() .setPersonnummer(Personnummer.createPersonnummer(request.getPersonId().getExtension()).get()); if (!request.getEnhetsId().isEmpty()) { builder = builder.setEnhetId(request.getEnhetsId().stream().map(HsaId::getExtension).collect(Collectors.toList())); } if (request.getVardgivarId() != null) { builder = builder.setVardgivarId(request.getVardgivarId().getExtension()); } if (request.getFromTidpunkt() != null) { builder = builder.setStartDate(request.getFromTidpunkt()); } if (request.getTomTidpunkt() != null) { builder = builder.setEndDate(request.getTomTidpunkt()); } java.util.List<IntygWithNotificationsResponse> intygWithNotifications = intygService.listCertificatesForCareWithQA(builder.build()); for (IntygWithNotificationsResponse intygHolder : intygWithNotifications) { ListItem item = new ListItem(); item.setIntyg(intygHolder.getIntyg()); HandelseList handelseList = new HandelseList(); handelseList.getHandelse().addAll(intygHolder.getNotifications().stream() .map(ListCertificatesForCareWithQAResponderImpl::toHandelse) .collect(Collectors.toList())); item.setHandelser(handelseList); item.setSkickadeFragor(toArenden(intygHolder.getSentQuestions())); item.setMottagnaFragor(toArenden(intygHolder.getReceivedQuestions())); item.setRef(intygHolder.getRef()); list.getItem().add(item); } response.setList(list); return response; }  }
ListCertificatesForCareWithQAResponderImpl implements ListCertificatesForCareWithQAResponderInterface { @Override public ListCertificatesForCareWithQAResponseType listCertificatesForCareWithQA(String s, ListCertificatesForCareWithQAType request) { Objects.requireNonNull(request.getEnhetsId()); if (!validate(request)) { throw new IllegalArgumentException(); } ListCertificatesForCareWithQAResponseType response = new ListCertificatesForCareWithQAResponseType(); List list = new List(); IntygWithNotificationsRequest.Builder builder = new IntygWithNotificationsRequest.Builder() .setPersonnummer(Personnummer.createPersonnummer(request.getPersonId().getExtension()).get()); if (!request.getEnhetsId().isEmpty()) { builder = builder.setEnhetId(request.getEnhetsId().stream().map(HsaId::getExtension).collect(Collectors.toList())); } if (request.getVardgivarId() != null) { builder = builder.setVardgivarId(request.getVardgivarId().getExtension()); } if (request.getFromTidpunkt() != null) { builder = builder.setStartDate(request.getFromTidpunkt()); } if (request.getTomTidpunkt() != null) { builder = builder.setEndDate(request.getTomTidpunkt()); } java.util.List<IntygWithNotificationsResponse> intygWithNotifications = intygService.listCertificatesForCareWithQA(builder.build()); for (IntygWithNotificationsResponse intygHolder : intygWithNotifications) { ListItem item = new ListItem(); item.setIntyg(intygHolder.getIntyg()); HandelseList handelseList = new HandelseList(); handelseList.getHandelse().addAll(intygHolder.getNotifications().stream() .map(ListCertificatesForCareWithQAResponderImpl::toHandelse) .collect(Collectors.toList())); item.setHandelser(handelseList); item.setSkickadeFragor(toArenden(intygHolder.getSentQuestions())); item.setMottagnaFragor(toArenden(intygHolder.getReceivedQuestions())); item.setRef(intygHolder.getRef()); list.getItem().add(item); } response.setList(list); return response; }  @Override ListCertificatesForCareWithQAResponseType listCertificatesForCareWithQA(String s, ListCertificatesForCareWithQAType request); }
ListCertificatesForCareWithQAResponderImpl implements ListCertificatesForCareWithQAResponderInterface { @Override public ListCertificatesForCareWithQAResponseType listCertificatesForCareWithQA(String s, ListCertificatesForCareWithQAType request) { Objects.requireNonNull(request.getEnhetsId()); if (!validate(request)) { throw new IllegalArgumentException(); } ListCertificatesForCareWithQAResponseType response = new ListCertificatesForCareWithQAResponseType(); List list = new List(); IntygWithNotificationsRequest.Builder builder = new IntygWithNotificationsRequest.Builder() .setPersonnummer(Personnummer.createPersonnummer(request.getPersonId().getExtension()).get()); if (!request.getEnhetsId().isEmpty()) { builder = builder.setEnhetId(request.getEnhetsId().stream().map(HsaId::getExtension).collect(Collectors.toList())); } if (request.getVardgivarId() != null) { builder = builder.setVardgivarId(request.getVardgivarId().getExtension()); } if (request.getFromTidpunkt() != null) { builder = builder.setStartDate(request.getFromTidpunkt()); } if (request.getTomTidpunkt() != null) { builder = builder.setEndDate(request.getTomTidpunkt()); } java.util.List<IntygWithNotificationsResponse> intygWithNotifications = intygService.listCertificatesForCareWithQA(builder.build()); for (IntygWithNotificationsResponse intygHolder : intygWithNotifications) { ListItem item = new ListItem(); item.setIntyg(intygHolder.getIntyg()); HandelseList handelseList = new HandelseList(); handelseList.getHandelse().addAll(intygHolder.getNotifications().stream() .map(ListCertificatesForCareWithQAResponderImpl::toHandelse) .collect(Collectors.toList())); item.setHandelser(handelseList); item.setSkickadeFragor(toArenden(intygHolder.getSentQuestions())); item.setMottagnaFragor(toArenden(intygHolder.getReceivedQuestions())); item.setRef(intygHolder.getRef()); list.getItem().add(item); } response.setList(list); return response; }  @Override ListCertificatesForCareWithQAResponseType listCertificatesForCareWithQA(String s, ListCertificatesForCareWithQAType request);  }