Search in sources :

Example 6 with ConceptStopWord

use of org.openmrs.ConceptStopWord in project openmrs-core by openmrs.

the class ConceptServiceTest method saveConceptStopWord_shouldFailIfADuplicateConceptStopWordInALocaleIsAdded.

/**
 * @see ConceptService#saveConceptStopWord(ConceptStopWord)
 */
@Test(expected = ConceptStopWordException.class)
public void saveConceptStopWord_shouldFailIfADuplicateConceptStopWordInALocaleIsAdded() {
    ConceptStopWord conceptStopWord = new ConceptStopWord("A");
    try {
        conceptService.saveConceptStopWord(conceptStopWord);
        conceptService.saveConceptStopWord(conceptStopWord);
    } catch (ConceptStopWordException e) {
        assertEquals("ConceptStopWord.duplicated", e.getMessage());
        throw e;
    }
}
Also used : ConceptStopWord(org.openmrs.ConceptStopWord) BaseContextSensitiveTest(org.openmrs.test.BaseContextSensitiveTest) Test(org.junit.Test)

Example 7 with ConceptStopWord

use of org.openmrs.ConceptStopWord in project openmrs-core by openmrs.

the class ConceptServiceTest method getConcepts_shouldReturnASearchResultForPhraseWithStopWords.

/**
 * @see ConceptService#getConcepts(String, List, boolean, List, List, List, List, Concept, Integer, Integer)
 */
@Test
public void getConcepts_shouldReturnASearchResultForPhraseWithStopWords() {
    executeDataSet("org/openmrs/api/include/ConceptServiceTest-names.xml");
    conceptService.saveConceptStopWord(new ConceptStopWord("OF", Locale.US));
    List<ConceptSearchResult> searchResults = conceptService.getConcepts("tuberculosis of knee", Collections.singletonList(new Locale("en", "US")), false, null, null, null, null, null, null, null);
    Assert.assertEquals(1, searchResults.size());
    Assert.assertEquals("Tuberculosis of Knee", searchResults.get(0).getConceptName().getName());
}
Also used : Locale(java.util.Locale) ConceptStopWord(org.openmrs.ConceptStopWord) ConceptSearchResult(org.openmrs.ConceptSearchResult) BaseContextSensitiveTest(org.openmrs.test.BaseContextSensitiveTest) Test(org.junit.Test)

Aggregations

ConceptStopWord (org.openmrs.ConceptStopWord)7 Test (org.junit.Test)6 BaseContextSensitiveTest (org.openmrs.test.BaseContextSensitiveTest)6 Locale (java.util.Locale)1 Criteria (org.hibernate.Criteria)1 ConceptSearchResult (org.openmrs.ConceptSearchResult)1 DAOException (org.openmrs.api.db.DAOException)1