use of org.openmrs.ConceptAttributeType in project openmrs-core by openmrs.
the class ConceptAttributeTypeValidatorTest method setUp.
/**
* Run this before each unit test in this class. This adds a bit more data to the base data that
* is done in the "@Before" method in {@link BaseContextSensitiveTest} (which is run right
* before this method).
*
* @throws Exception
*/
@Before
public void setUp() {
executeDataSet(CONCEPT_ATTRIBUTE_TYPE_XML);
validator = new ConceptAttributeTypeValidator();
type = new ConceptAttributeType();
errors = new BindException(type, "type");
}
use of org.openmrs.ConceptAttributeType in project openmrs-core by openmrs.
the class ConceptServiceTest method hasAnyConceptAttribute_shouldReturnTrueIfAnyConceptAttributeIsPresentForGivenConceptAttributeType.
/**
* @see ConceptService#hasAnyConceptAttribute(ConceptAttributeType)
*/
@Test
public void hasAnyConceptAttribute_shouldReturnTrueIfAnyConceptAttributeIsPresentForGivenConceptAttributeType() {
executeDataSet(CONCEPT_ATTRIBUTE_TYPE_XML);
ConceptService conceptService = Context.getConceptService();
ConceptAttributeType conceptAttributeType = conceptService.getConceptAttributeType(1);
Assert.assertTrue(conceptService.hasAnyConceptAttribute(conceptAttributeType));
}
use of org.openmrs.ConceptAttributeType in project openmrs-core by openmrs.
the class ConceptServiceTest method retireConceptAttributeType_shouldRetireAConceptAttributeType.
/**
* @see ConceptService#retireConceptAttributeType(ConceptAttributeType, String)
*/
@Test
public void retireConceptAttributeType_shouldRetireAConceptAttributeType() {
executeDataSet(CONCEPT_ATTRIBUTE_TYPE_XML);
ConceptAttributeType vat = Context.getConceptService().getConceptAttributeType(1);
Assert.assertFalse(vat.getRetired());
Assert.assertNull(vat.getRetiredBy());
Assert.assertNull(vat.getDateRetired());
Assert.assertNull(vat.getRetireReason());
Context.getConceptService().retireConceptAttributeType(vat, "for testing");
vat = Context.getConceptService().getConceptAttributeType(1);
Assert.assertTrue(vat.getRetired());
Assert.assertNotNull(vat.getRetiredBy());
Assert.assertNotNull(vat.getDateRetired());
Assert.assertEquals("for testing", vat.getRetireReason());
}
use of org.openmrs.ConceptAttributeType in project openmrs-core by openmrs.
the class HibernateConceptDAOTest method shouldGetConceptAttributeCountForAttributeType.
/**
* @see HibernateConceptDAO#getConceptAttributeCount(ConceptAttributeType)
*/
@Test
public void shouldGetConceptAttributeCountForAttributeType() {
executeDataSet(CONCEPT_ATTRIBUTE_TYPE_XML);
ConceptAttributeType conceptAttributeType = Context.getConceptService().getConceptAttributeType(1);
Assert.assertEquals(1, dao.getConceptAttributeCount(conceptAttributeType));
Assert.assertEquals(0, dao.getConceptAttributeCount(null));
}
use of org.openmrs.ConceptAttributeType in project openmrs-core by openmrs.
the class ConceptServiceTest method saveConceptAttributeType_shouldCreateANewConceptAttributeType.
/**
* @see ConceptService#saveConceptAttributeType(org.openmrs.ConceptAttributeType)
*/
@Test
public void saveConceptAttributeType_shouldCreateANewConceptAttributeType() {
executeDataSet(CONCEPT_ATTRIBUTE_TYPE_XML);
ConceptService conceptService = Context.getConceptService();
Assert.assertEquals(2, conceptService.getAllConceptAttributeTypes().size());
ConceptAttributeType conceptAttributeType = new ConceptAttributeType();
conceptAttributeType.setName("Another one");
conceptAttributeType.setDatatypeClassname(FreeTextDatatype.class.getName());
conceptService.saveConceptAttributeType(conceptAttributeType);
Assert.assertNotNull(conceptAttributeType.getId());
Assert.assertEquals(3, conceptService.getAllConceptAttributeTypes().size());
}
Aggregations