use of org.openmrs.ConceptMapType in project openmrs-core by openmrs.
the class ConceptMapTypeValidatorTest method validate_shouldFailIfTheConceptMapTypeObjectIsNull.
/**
* @see ConceptMapTypeValidator#validate(Object,Errors)
*/
@Test(expected = IllegalArgumentException.class)
public void validate_shouldFailIfTheConceptMapTypeObjectIsNull() {
Errors errors = new BindException(new ConceptMapType(), "mapType");
new ConceptMapTypeValidator().validate(null, errors);
}
use of org.openmrs.ConceptMapType in project openmrs-core by openmrs.
the class ConceptServiceImplTest method purgeConceptMapType_shouldDeleteTheSpecifiedConceptMapTypeFromTheDatabase.
/**
* @see ConceptServiceImpl#purgeConceptMapType(ConceptMapType)
*/
@Test
public void purgeConceptMapType_shouldDeleteTheSpecifiedConceptMapTypeFromTheDatabase() {
Integer conceptMapTypeId = 8;
ConceptMapType mapType = conceptService.getConceptMapType(conceptMapTypeId);
assertNotNull(mapType);
conceptService.purgeConceptMapType(mapType);
assertNull(conceptService.getConceptMapType(conceptMapTypeId));
}
use of org.openmrs.ConceptMapType in project openmrs-core by openmrs.
the class ConceptServiceTest method getDefaultConceptMapType_shouldReturnTypeAsSetInGp.
/**
* @see ConceptService#getDefaultConceptMapType()
*/
@Test
public void getDefaultConceptMapType_shouldReturnTypeAsSetInGp() {
final String testName = "is a";
Context.getAdministrationService().saveGlobalProperty(new GlobalProperty("concept.defaultConceptMapType", testName));
ConceptMapType conceptMapType = conceptService.getDefaultConceptMapType();
Assert.assertNotNull(conceptMapType);
Assert.assertEquals(testName, conceptMapType.getName());
}
use of org.openmrs.ConceptMapType in project openmrs-core by openmrs.
the class ConceptServiceTest method retireConceptMapType_shouldRetireTheSpecifiedConceptMapTypeWithTheGivenRetireReason.
/**
* @see ConceptService#retireConceptMapType(ConceptMapType,String)
*/
@Test
public void retireConceptMapType_shouldRetireTheSpecifiedConceptMapTypeWithTheGivenRetireReason() {
ConceptMapType mapType = Context.getConceptService().getConceptMapType(1);
Assert.assertFalse(mapType.getRetired());
Assert.assertNull(mapType.getRetiredBy());
Assert.assertNull(mapType.getDateRetired());
Assert.assertNull(mapType.getRetireReason());
ConceptMapType retiredMapType = Context.getConceptService().retireConceptMapType(mapType, "test retire reason");
Assert.assertTrue(retiredMapType.getRetired());
Assert.assertEquals(retiredMapType.getRetireReason(), "test retire reason");
Assert.assertNotNull(retiredMapType.getRetiredBy());
Assert.assertNotNull(retiredMapType.getDateRetired());
}
use of org.openmrs.ConceptMapType in project openmrs-core by openmrs.
the class ConceptServiceTest method saveConceptMapType_shouldAddTheSpecifiedConceptMapTypeToTheDatabaseAndAssignToItAnId.
/**
* @see ConceptService#saveConceptMapType(ConceptMapType)
*/
@Test
public void saveConceptMapType_shouldAddTheSpecifiedConceptMapTypeToTheDatabaseAndAssignToItAnId() {
ConceptMapType mapType = new ConceptMapType();
mapType.setName("test type");
mapType = Context.getConceptService().saveConceptMapType(mapType);
Assert.assertNotNull(mapType.getId());
Assert.assertNotNull(Context.getConceptService().getConceptMapTypeByName("test type"));
}
Aggregations