@Test public void getConceptSourceByName_shouldReturnNullIfNoConceptSourceWithThatNameIsFound() { ConceptSource conceptSource = conceptService.getConceptSourceByName("Some invalid name"); assertNull("Method did not return null when no ConceptSource with that name is found", conceptSource); }
@Test public void getConceptsByConceptSource_shouldReturnAListOfConceptMapsIfConceptMappingsFound() { List<ConceptMap> list = conceptService .getConceptMappingsToSource(conceptService.getConceptSourceByName("SNOMED CT")); assertEquals(2, list.size()); }
@Test public void getConceptSourceByName_shouldGetConceptSourceWithTheGivenName() { ConceptSource conceptSource = conceptService.getConceptSourceByName("SNOMED CT"); assertEquals("Method did not retrieve ConceptSource by name", Integer.valueOf(2), conceptSource.getConceptSourceId()); }
@Test public void getConceptsByConceptSource_shouldReturnEmptyListOfConceptMapsIfNoneFound() { List<ConceptMap> list = conceptService.getConceptMappingsToSource(conceptService .getConceptSourceByName("Some invalid name")); assertEquals(0, list.size()); }
@Test public void saveConceptSource_shouldSaveAConceptSourceWithANullHl7Code() { ConceptSource source = new ConceptSource(); String aNullString = null; String sourceName = "A concept source with null HL7 code"; source.setName(sourceName); source.setDescription("A concept source description"); source.setHl7Code(aNullString); conceptService.saveConceptSource(source); assertEquals("Did not save a ConceptSource with a null hl7Code", source, conceptService .getConceptSourceByName(sourceName)); }
/** * Fetches a conceptSource by uuid, if no match is found, it tries to look up one with a * matching name with the assumption that the passed parameter is a conceptSource name * * @see DelegatingCrudResource#getByUniqueId(java.lang.String) */ @Override public ConceptSource getByUniqueId(String uuid) { ConceptSource conceptSource = Context.getConceptService().getConceptSourceByUuid(uuid); //We assume the caller was fetching by name if (conceptSource == null) conceptSource = Context.getConceptService().getConceptSourceByName(uuid); return conceptSource; }
@Test public void shouldGetAConceptSourceByName() throws Exception { final String name = "SNOMED CT"; MockHttpServletRequest req = request(RequestMethod.GET, getURI() + "/" + name); SimpleObject result = deserialize(handle(req)); ConceptSource conceptSource = service.getConceptSourceByName(name); Assert.assertEquals(conceptSource.getUuid(), PropertyUtils.getProperty(result, "uuid")); Assert.assertEquals(conceptSource.getName(), PropertyUtils.getProperty(result, "name")); }
conceptSource = conceptService.getConceptSourceByName(source);
@Test public void shouldGetAConceptSourceByName() throws Exception { final String name = "ICD-10"; MockHttpServletRequest req = request(RequestMethod.GET, getURI() + "/" + name); SimpleObject result = deserialize(handle(req)); ConceptSource conceptSource = service.getConceptSourceByName(name); Assert.assertEquals(conceptSource.getUuid(), PropertyUtils.getProperty(result, "uuid")); Assert.assertEquals(conceptSource.getName(), PropertyUtils.getProperty(result, "name")); }
conceptSource = conceptService.getConceptSourceByUuid(source); if (conceptSource == null) { conceptSource = conceptService.getConceptSourceByName(source);