### Question:
Loinc2Hpo { public HpoTerm4TestOutcome query(LoincId loincId, Code testResult) throws AnnotationNotFoundException, LoincCodeNotAnnotatedException { if (!this.annotationMap.containsKey(loincId)) { throw new LoincCodeNotAnnotatedException(); } if (!this.annotationMap.get(loincId).getCandidateHpoTerms().containsKey(testResult)){ throw new AnnotationNotFoundException(); } return this.annotationMap.get(loincId).getCandidateHpoTerms().get(testResult); } Loinc2Hpo(Map<LoincId, Loinc2HpoAnnotationModel> annotationMap,
                     CodeSystemConvertor converter);  Loinc2Hpo(String path, CodeSystemConvertor converter); Map<LoincId, Loinc2HpoAnnotationModel> getAnnotationMap(); CodeSystemConvertor getConverter(); Code convertToInternal(Code original); HpoTerm4TestOutcome query(LoincId loincId, Code testResult); HpoTerm4TestOutcome query(LoincId loincId, String system, String id);  }### Answer:
@Test public void queryWithInterpretationCode() throws Exception { LoincId loincId = new LoincId("2823-3"); Code low = new Code().setSystem("FHIR").setCode("L"); HpoTerm4TestOutcome hpo_coded_phenotype = loinc2Hpo.query(loincId, low); assertFalse(hpo_coded_phenotype.isNegated()); assertEquals(hpo_coded_phenotype.getId().getValue(), "HP:0002900"); Code normal = new Code().setSystem("FHIR").setCode("N"); hpo_coded_phenotype = loinc2Hpo.query(loincId, normal); assertTrue(hpo_coded_phenotype.isNegated()); assertEquals(hpo_coded_phenotype.getId().getValue(), "HP:0011042"); loincId = new LoincId("2349-9"); Code positive = new Code().setSystem("FHIR").setCode("POS"); hpo_coded_phenotype = loinc2Hpo.query(loincId, positive); assertFalse(hpo_coded_phenotype.isNegated()); assertEquals(hpo_coded_phenotype.getId().getValue(), "HP:0003076"); Code negative = new Code().setSystem("FHIR").setCode("NEG"); hpo_coded_phenotype = loinc2Hpo.query(loincId, negative); assertTrue(hpo_coded_phenotype.isNegated()); assertEquals(hpo_coded_phenotype.getId().getValue(), "HP:0003076"); loincId = new LoincId("5778-6"); Code snomed_code = new Code().setSystem("snomed-ct").setCode("449071000124107"); hpo_coded_phenotype = loinc2Hpo.query(loincId, snomed_code); assertFalse(hpo_coded_phenotype.isNegated()); assertEquals(hpo_coded_phenotype.getId().getValue(), "HP:0032001"); }
@Test public void queryWithStrings() throws Exception { LoincId loincId = new LoincId("2823-3"); String system = "FHIR"; String codeLow = "L"; assertEquals(loinc2Hpo.query(loincId, system, codeLow).getId().getValue(), "HP:0002900"); }