use of org.openmrs.api.ConceptService in project openmrs-core by openmrs.
the class ConceptDAOTest method getConcepts_shouldReturnCorrectResultsIfAConceptNameContainsSameWordMoreThanOnce.
/**
* @see {@link
* ConceptDAO#getConcepts(String,List<Locale>,null,List<ConceptClass>,List<ConceptClass>,
* List<ConceptDatatype>,List<ConceptDatatype>,Concept,Integer,Integer)}
*/
@SuppressWarnings("unchecked")
@Test
@Ignore
public void getConcepts_shouldReturnCorrectResultsIfAConceptNameContainsSameWordMoreThanOnce() {
ConceptService cs = Context.getConceptService();
ConceptClass cc = cs.getConceptClass(1);
Locale locale = Locale.ENGLISH;
ConceptDatatype dt = cs.getConceptDatatype(4);
Concept c1 = new Concept();
ConceptName cn1a = new ConceptName("ONE TERM", locale);
c1.addName(cn1a);
c1.setConceptClass(cc);
c1.setDatatype(dt);
cs.saveConcept(c1);
ConceptName cn1b = new ConceptName("ONE TO ONE", locale);
cn1b.setConceptNameType(ConceptNameType.FULLY_SPECIFIED);
cn1b.setLocalePreferred(true);
c1.addName(cn1b);
cs.saveConcept(c1);
Assert.assertTrue(cn1a.isSynonym());
Assert.assertTrue(cn1b.getConceptNameId() > cn1a.getConceptNameId());
Concept c2 = new Concept();
ConceptName cn2a = new ConceptName("ONE TO MANY", locale);
c2.addName(cn2a);
c2.setConceptClass(cc);
c2.setDatatype(dt);
cs.saveConcept(c2);
updateSearchIndex();
List<ConceptSearchResult> searchResults1 = dao.getConcepts("one", Collections.singletonList(locale), false, Collections.EMPTY_LIST, Collections.EMPTY_LIST, Collections.EMPTY_LIST, Collections.EMPTY_LIST, null, null, null);
Assert.assertEquals(2, searchResults1.size());
Assert.assertEquals(c1, searchResults1.get(0).getConcept());
Assert.assertEquals(cn1b, searchResults1.get(0).getConceptName());
}
Aggregations