Search in sources :

Example 36 with ConceptSource

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

the class ConceptServiceTest method getConceptSourceByUuid_shouldFindObjectGivenValidUuid.

/**
 * @see ConceptService#getConceptSourceByUuid(String)
 */
@Test
public void getConceptSourceByUuid_shouldFindObjectGivenValidUuid() {
    String uuid = "75f5b378-5065-11de-80cb-001e378eb67e";
    ConceptSource conceptSource = Context.getConceptService().getConceptSourceByUuid(uuid);
    Assert.assertEquals(3, (int) conceptSource.getConceptSourceId());
}
Also used : ConceptSource(org.openmrs.ConceptSource) BaseContextSensitiveTest(org.openmrs.test.BaseContextSensitiveTest) Test(org.junit.Test)

Example 37 with ConceptSource

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

the class ConceptServiceTest method getConceptSourceByName_shouldReturnNullIfNoConceptSourceWithThatNameIsFound.

@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);
}
Also used : ConceptSource(org.openmrs.ConceptSource) BaseContextSensitiveTest(org.openmrs.test.BaseContextSensitiveTest) Test(org.junit.Test)

Example 38 with ConceptSource

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

the class ConceptServiceTest method getConceptReferenceTermByCode_shouldReturnAConceptReferenceTermThatMatchesTheGivenCodeFromTheGivenSource.

/**
 * @see ConceptService#getConceptReferenceTermByCode(String,ConceptSource)
 */
@Test
public void getConceptReferenceTermByCode_shouldReturnAConceptReferenceTermThatMatchesTheGivenCodeFromTheGivenSource() {
    ConceptReferenceTerm term = Context.getConceptService().getConceptReferenceTermByCode("2332523", new ConceptSource(2));
    Assert.assertNotNull(term);
    Assert.assertEquals("2332523", term.getCode());
}
Also used : ConceptSource(org.openmrs.ConceptSource) ConceptReferenceTerm(org.openmrs.ConceptReferenceTerm) BaseContextSensitiveTest(org.openmrs.test.BaseContextSensitiveTest) Test(org.junit.Test)

Example 39 with ConceptSource

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

the class ConceptServiceTest method saveConceptSource_shouldNotSetDateCreatedIfOneIsSuppliedAlready.

/**
 * @see ConceptService#saveConceptSource(ConceptSource)
 */
@Test
public void saveConceptSource_shouldNotSetDateCreatedIfOneIsSuppliedAlready() {
    Date expectedDate = new Date(new Date().getTime() - 10000);
    ConceptSource newConceptSource = new ConceptSource();
    newConceptSource.setName("name");
    newConceptSource.setDescription("desc");
    newConceptSource.setHl7Code("hl7Code");
    newConceptSource.setDateCreated(expectedDate);
    Context.getConceptService().saveConceptSource(newConceptSource);
    Assert.assertEquals(DateUtil.truncateToSeconds(expectedDate), newConceptSource.getDateCreated());
}
Also used : ConceptSource(org.openmrs.ConceptSource) Date(java.util.Date) BaseContextSensitiveTest(org.openmrs.test.BaseContextSensitiveTest) Test(org.junit.Test)

Aggregations

ConceptSource (org.openmrs.ConceptSource)39 Test (org.junit.Test)29 BaseContextSensitiveTest (org.openmrs.test.BaseContextSensitiveTest)28 ConceptMapType (org.openmrs.ConceptMapType)6 ConceptReferenceTerm (org.openmrs.ConceptReferenceTerm)6 BindException (org.springframework.validation.BindException)6 Errors (org.springframework.validation.Errors)6 Drug (org.openmrs.Drug)5 ArrayList (java.util.ArrayList)4 Concept (org.openmrs.Concept)4 Locale (java.util.Locale)3 Criteria (org.hibernate.Criteria)3 ConceptClass (org.openmrs.ConceptClass)2 ConceptDatatype (org.openmrs.ConceptDatatype)2 ConceptSearchResult (org.openmrs.ConceptSearchResult)2 GlobalProperty (org.openmrs.GlobalProperty)2 User (org.openmrs.User)2 ConceptBuilder (org.openmrs.module.metadatadeploy.builder.ConceptBuilder)2 ConceptMapBuilder (org.openmrs.module.metadatadeploy.builder.ConceptMapBuilder)2 SimpleObject (org.openmrs.ui.framework.SimpleObject)2