@Test public void testOneMatchingCode() { final String noMatch1 = "no-match-code1"; final String noMatch2 = "no-match-code2"; final String match1 = "a-match-code"; final String icd10Kod = "icd10"; doReturn(Optional.empty()) .when(repository) .findFirstByIcd10KodList_kod(eq(noMatch1)); doReturn(Optional.empty()) .when(repository) .findFirstByIcd10KodList_kod(eq(noMatch2)); doReturn(Optional.of(buildDiagnosInformationSingleMatch(icd10Kod, match1))) .when(repository) .findFirstByIcd10KodList_kod(eq(match1)); final IcfResponse icfInformationByIcd10Koder = icfService.findIcfInformationByIcd10Koder( Icd10KoderRequest.of(noMatch1, noMatch2, match1)); assertThat(icfInformationByIcd10Koder).isNotNull(); assertThat(icfInformationByIcd10Koder.getUnika()).isNotNull(); assertThat(icfInformationByIcd10Koder.getUnika()).hasSize(1); assertThat(icfInformationByIcd10Koder.getUnika().get(0).getIcd10Kod()).isEqualTo(match1); assertThat(icfInformationByIcd10Koder.getUnika().get(0).getFunktionsNedsattningsKoder().getIcfKoder().get(0).getKod()) .isEqualTo(match1); assertThat(icfInformationByIcd10Koder.getUnika().get(0).getFunktionsNedsattningsKoder().getIcfKoder().get(0).getKod()) .isEqualTo(match1); assertThat(icfInformationByIcd10Koder.getGemensamma()).isNotNull(); assertThat(icfInformationByIcd10Koder.getGemensamma().getIcd10Kod()).isNull(); assertThat(icfInformationByIcd10Koder.getGemensamma().getFunktionsNedsattningsKoder()).isNull(); assertThat(icfInformationByIcd10Koder.getGemensamma().getAktivitetsBegransningsKoder()).isNull(); }
@Override @Transactional(readOnly = true) public IcfResponse findIcfInformationByIcd10Koder(final Icd10KoderRequest icd10KoderRequest) { Preconditions.checkArgument(Objects.nonNull(icd10KoderRequest), "Icd10KoderRequest can not be null"); Preconditions.checkArgument(Objects.nonNull(icd10KoderRequest.getIcd10Kod1()), "Icd10KoderRequest must have an icfCode1"); final List<Tuple2<String, Optional<DiagnosInformation>>> collect = List.ofAll(icd10KoderRequest.getIcd10Codes()) .map(this::searchDiagnosInformationByIcd10Kod) .distinctBy(response -> response._1); return convertToResponse(collect); }
IcfServiceImpl extends FmbBaseService implements IcfService { @Override @Transactional(readOnly = true) public IcfResponse findIcfInformationByIcd10Koder(final Icd10KoderRequest icd10KoderRequest) { Preconditions.checkArgument(Objects.nonNull(icd10KoderRequest), "Icd10KoderRequest can not be null"); Preconditions.checkArgument(Objects.nonNull(icd10KoderRequest.getIcd10Kod1()), "Icd10KoderRequest must have an icfCode1"); final List<Tuple2<String, Optional<DiagnosInformation>>> collect = List.ofAll(icd10KoderRequest.getIcd10Codes()) .map(this::searchDiagnosInformationByIcd10Kod) .distinctBy(response -> response._1); return convertToResponse(collect); } }
IcfServiceImpl extends FmbBaseService implements IcfService { @Override @Transactional(readOnly = true) public IcfResponse findIcfInformationByIcd10Koder(final Icd10KoderRequest icd10KoderRequest) { Preconditions.checkArgument(Objects.nonNull(icd10KoderRequest), "Icd10KoderRequest can not be null"); Preconditions.checkArgument(Objects.nonNull(icd10KoderRequest.getIcd10Kod1()), "Icd10KoderRequest must have an icfCode1"); final List<Tuple2<String, Optional<DiagnosInformation>>> collect = List.ofAll(icd10KoderRequest.getIcd10Codes()) .map(this::searchDiagnosInformationByIcd10Kod) .distinctBy(response -> response._1); return convertToResponse(collect); } IcfServiceImpl(
        final IcfTextResource textResource,
        final DiagnosInformationRepository repository); }
IcfServiceImpl extends FmbBaseService implements IcfService { @Override @Transactional(readOnly = true) public IcfResponse findIcfInformationByIcd10Koder(final Icd10KoderRequest icd10KoderRequest) { Preconditions.checkArgument(Objects.nonNull(icd10KoderRequest), "Icd10KoderRequest can not be null"); Preconditions.checkArgument(Objects.nonNull(icd10KoderRequest.getIcd10Kod1()), "Icd10KoderRequest must have an icfCode1"); final List<Tuple2<String, Optional<DiagnosInformation>>> collect = List.ofAll(icd10KoderRequest.getIcd10Codes()) .map(this::searchDiagnosInformationByIcd10Kod) .distinctBy(response -> response._1); return convertToResponse(collect); } IcfServiceImpl(
        final IcfTextResource textResource,
        final DiagnosInformationRepository repository); @Override @Transactional(readOnly = true) IcfResponse findIcfInformationByIcd10Koder(final Icd10KoderRequest icd10KoderRequest); }
IcfServiceImpl extends FmbBaseService implements IcfService { @Override @Transactional(readOnly = true) public IcfResponse findIcfInformationByIcd10Koder(final Icd10KoderRequest icd10KoderRequest) { Preconditions.checkArgument(Objects.nonNull(icd10KoderRequest), "Icd10KoderRequest can not be null"); Preconditions.checkArgument(Objects.nonNull(icd10KoderRequest.getIcd10Kod1()), "Icd10KoderRequest must have an icfCode1"); final List<Tuple2<String, Optional<DiagnosInformation>>> collect = List.ofAll(icd10KoderRequest.getIcd10Codes()) .map(this::searchDiagnosInformationByIcd10Kod) .distinctBy(response -> response._1); return convertToResponse(collect); } IcfServiceImpl(
        final IcfTextResource textResource,
        final DiagnosInformationRepository repository); @Override @Transactional(readOnly = true) IcfResponse findIcfInformationByIcd10Koder(final Icd10KoderRequest icd10KoderRequest);  }