@Test public void testCloseCompletionsAsHandledNoMatches() { final String intygId = "intygId"; when(fragasvarRepositoryMock.findByIntygsReferensIntygsId(intygId)).thenReturn(new ArrayList<>()); service.closeCompletionsAsHandled(intygId); verify(fragasvarRepositoryMock).findByIntygsReferensIntygsId(intygId); verify(fragasvarRepositoryMock, never()).save(any(FragaSvar.class)); verifyNoInteractions(certificateEventService); verifyNoInteractions(notificationServiceMock); verifyNoInteractions(arendeDraftService); }
@Override public void closeCompletionsAsHandled(String intygId) { List<FragaSvar> completionFragaSvar = fragaSvarRepository.findByIntygsReferensIntygsId(intygId).stream() .filter(fs -> Amne.KOMPLETTERING_AV_LAKARINTYG == fs.getAmne()).collect(Collectors.toList()); for (FragaSvar completion : completionFragaSvar) { if (Status.CLOSED != completion.getStatus()) { closeQuestionAsHandled(completion); } } }
FragaSvarServiceImpl implements FragaSvarService { @Override public void closeCompletionsAsHandled(String intygId) { List<FragaSvar> completionFragaSvar = fragaSvarRepository.findByIntygsReferensIntygsId(intygId).stream() .filter(fs -> Amne.KOMPLETTERING_AV_LAKARINTYG == fs.getAmne()).collect(Collectors.toList()); for (FragaSvar completion : completionFragaSvar) { if (Status.CLOSED != completion.getStatus()) { closeQuestionAsHandled(completion); } } } }
FragaSvarServiceImpl implements FragaSvarService { @Override public void closeCompletionsAsHandled(String intygId) { List<FragaSvar> completionFragaSvar = fragaSvarRepository.findByIntygsReferensIntygsId(intygId).stream() .filter(fs -> Amne.KOMPLETTERING_AV_LAKARINTYG == fs.getAmne()).collect(Collectors.toList()); for (FragaSvar completion : completionFragaSvar) { if (Status.CLOSED != completion.getStatus()) { closeQuestionAsHandled(completion); } } }  }
FragaSvarServiceImpl implements FragaSvarService { @Override public void closeCompletionsAsHandled(String intygId) { List<FragaSvar> completionFragaSvar = fragaSvarRepository.findByIntygsReferensIntygsId(intygId).stream() .filter(fs -> Amne.KOMPLETTERING_AV_LAKARINTYG == fs.getAmne()).collect(Collectors.toList()); for (FragaSvar completion : completionFragaSvar) { if (Status.CLOSED != completion.getStatus()) { closeQuestionAsHandled(completion); } } }  @Override FragaSvar processIncomingQuestion(FragaSvar fragaSvar); @Override FragaSvar processIncomingAnswer(Long internId, String svarsText, LocalDateTime svarSigneringsDatum); @Override @Transactional(readOnly = true) List<FragaSvarView> getFragaSvar(String intygId); @Override FragaSvar saveSvar(Long fragaSvarsId, String svarsText); @Override List<FragaSvarView> answerKomplettering(final String intygsId, final String svarsText); @Override FragaSvar saveNewQuestion(String intygId, String typ, Amne amne, String frageText); @Override List<FragaSvar> setVidareBefordrad(final String intygsId); @Override FragaSvar closeQuestionAsHandled(Long frageSvarId); @Override void closeCompletionsAsHandled(String intygId); @Override void closeAllNonClosedQuestions(String intygsId); @Override FragaSvar openQuestionAsUnhandled(Long frageSvarId); @Override @Transactional(readOnly = true) QueryFragaSvarResponse filterFragaSvar(Filter filter); @Override @Transactional(readOnly = true) List<Lakare> getFragaSvarHsaIdByEnhet(String enhetsId); @Override Map<String, Long> getNbrOfUnhandledFragaSvarForCareUnits(List<String> vardenheterIds, Set<String> intygsTyper); }
FragaSvarServiceImpl implements FragaSvarService { @Override public void closeCompletionsAsHandled(String intygId) { List<FragaSvar> completionFragaSvar = fragaSvarRepository.findByIntygsReferensIntygsId(intygId).stream() .filter(fs -> Amne.KOMPLETTERING_AV_LAKARINTYG == fs.getAmne()).collect(Collectors.toList()); for (FragaSvar completion : completionFragaSvar) { if (Status.CLOSED != completion.getStatus()) { closeQuestionAsHandled(completion); } } }  @Override FragaSvar processIncomingQuestion(FragaSvar fragaSvar); @Override FragaSvar processIncomingAnswer(Long internId, String svarsText, LocalDateTime svarSigneringsDatum); @Override @Transactional(readOnly = true) List<FragaSvarView> getFragaSvar(String intygId); @Override FragaSvar saveSvar(Long fragaSvarsId, String svarsText); @Override List<FragaSvarView> answerKomplettering(final String intygsId, final String svarsText); @Override FragaSvar saveNewQuestion(String intygId, String typ, Amne amne, String frageText); @Override List<FragaSvar> setVidareBefordrad(final String intygsId); @Override FragaSvar closeQuestionAsHandled(Long frageSvarId); @Override void closeCompletionsAsHandled(String intygId); @Override void closeAllNonClosedQuestions(String intygsId); @Override FragaSvar openQuestionAsUnhandled(Long frageSvarId); @Override @Transactional(readOnly = true) QueryFragaSvarResponse filterFragaSvar(Filter filter); @Override @Transactional(readOnly = true) List<Lakare> getFragaSvarHsaIdByEnhet(String enhetsId); @Override Map<String, Long> getNbrOfUnhandledFragaSvarForCareUnits(List<String> vardenheterIds, Set<String> intygsTyper);  }