use of org.openmrs.Retireable in project openmrs-core by openmrs.
the class BaseUnretireHandlerTest method handle_shouldUnsetTheRetiredBit.
/**
* @see BaseUnretireHandler#handle(Retireable,User,Date,String)
*/
@Test
public void handle_shouldUnsetTheRetiredBit() {
UnretireHandler<Retireable> handler = new BaseUnretireHandler();
Retireable retireable = new Location();
// make sure isRetired is set
retireable.setRetired(true);
handler.handle(retireable, null, null, null);
Assert.assertFalse(retireable.getRetired());
}
use of org.openmrs.Retireable in project openmrs-core by openmrs.
the class BaseRetireHandlerTest method handle_shouldSetRetiredBy.
/**
* @see BaseRetireHandler#handle(Retireable,User,Date,String)
*/
@Test
public void handle_shouldSetRetiredBy() {
RetireHandler<Retireable> handler = new BaseRetireHandler();
Retireable retireable = new Location();
handler.handle(retireable, new User(2), null, " ");
Assert.assertEquals(2, retireable.getRetiredBy().getId().intValue());
}
use of org.openmrs.Retireable in project openmrs-core by openmrs.
the class BaseRetireHandlerTest method handle_shouldNotSetDateRetiredIfNonNull.
/**
* @see BaseRetireHandler#handle(Retireable,User,Date,String)
*/
@Test
public void handle_shouldNotSetDateRetiredIfNonNull() {
// a time that is not "now"
Date d = new Date(new Date().getTime() - 1000);
RetireHandler<Retireable> handler = new BaseRetireHandler();
Retireable retireable = new Location();
// make dateRetired non null
retireable.setDateRetired(d);
handler.handle(retireable, null, new Date(), " ");
Assert.assertEquals(d, retireable.getDateRetired());
}
use of org.openmrs.Retireable in project openmrs-core by openmrs.
the class BaseRetireHandlerTest method handle_shouldSetDateRetired.
/**
* @see BaseRetireHandler#handle(Retireable,User,Date,String)
*/
@Test
public void handle_shouldSetDateRetired() {
Date d = new Date();
RetireHandler<Retireable> handler = new BaseRetireHandler();
Retireable retireable = new Location();
handler.handle(retireable, null, d, " ");
Assert.assertEquals(d, retireable.getDateRetired());
}
use of org.openmrs.Retireable in project openmrs-core by openmrs.
the class BaseRetireHandlerTest method handle_shouldSetTheRetiredBit.
/**
* @see BaseRetireHandler#handle(Retireable,User,Date,String)
*/
@Test
public void handle_shouldSetTheRetiredBit() {
RetireHandler<Retireable> handler = new BaseRetireHandler();
Retireable retireable = new Location();
// make sure isRetired is false
retireable.setRetired(false);
handler.handle(retireable, null, null, " ");
Assert.assertTrue(retireable.getRetired());
}
Aggregations