use of org.openmrs.Program in project openmrs-core by openmrs.
the class SerializedObjectDAOTest method saveObject_shouldSetAuditableFieldsBeforeSerializing.
@Test
public void saveObject_shouldSetAuditableFieldsBeforeSerializing() {
Program data = new Program();
data.setName("NewProgram");
data.setDescription("This is to test saving a Program");
data = dao.saveObject(data);
Assert.assertNotNull(data.getId());
Program newData = dao.getObject(Program.class, data.getId());
assertEquals("NewProgram", newData.getName());
assertNotNull(newData.getCreator());
assertNotNull(newData.getDateCreated());
}
use of org.openmrs.Program in project openmrs-core by openmrs.
the class SerializedObjectDAOTest method saveObject_shouldSaveThePassedObjectIfSupported.
@Test
public void saveObject_shouldSaveThePassedObjectIfSupported() {
Program data = new Program();
data.setName("NewProgram");
data.setDescription("This is to test saving a Program");
data.setCreator(new User(1));
data.setDateCreated(new Date());
data = dao.saveObject(data);
Assert.assertNotNull(data.getId());
Program newData = dao.getObject(Program.class, data.getId());
assertEquals("NewProgram", newData.getName());
}
use of org.openmrs.Program in project openmrs-core by openmrs.
the class SerializedObjectDAOTest method getObject_shouldReturnTheSavedObject.
@Test
public void getObject_shouldReturnTheSavedObject() {
Program data = dao.getObject(Program.class, 1);
assertEquals(data.getId().intValue(), 1);
assertEquals(data.getName(), "TestProgram");
}
use of org.openmrs.Program in project openmrs-core by openmrs.
the class ProgramWorkflowDAOTest method saveProgram_shouldSaveProgram.
@Test
public void saveProgram_shouldSaveProgram() {
Program program = createProgram();
dao.saveProgram(program);
}
use of org.openmrs.Program in project openmrs-core by openmrs.
the class ProgramWorkflowDAOTest method saveProgram_shouldAlsoSaveOutcomesConcept.
@Test
public void saveProgram_shouldAlsoSaveOutcomesConcept() {
Concept outcomesConcept = Context.getConceptService().getConcept(3);
Program program = createProgram();
program.setOutcomesConcept(outcomesConcept);
int id = dao.saveProgram(program).getId();
clearHibernateCache();
Program savedProgram = dao.getProgram(id);
Assert.assertEquals(3, savedProgram.getOutcomesConcept().getId().intValue());
}
Aggregations