use of org.openmrs.Retireable in project openmrs-core by openmrs.
the class BaseRetireHandlerTest method handle_shouldNotSetTheRetireReasonIfAlreadyVoided.
/**
* @see BaseRetireHandler#handle(Retireable,User,Date,String)
*/
@Test
public void handle_shouldNotSetTheRetireReasonIfAlreadyVoided() {
RetireHandler<Retireable> handler = new BaseRetireHandler();
Retireable retireable = new Location();
retireable.setRetired(true);
retireable.setRetiredBy(new User());
handler.handle(retireable, null, null, "THE REASON");
Assert.assertNull(retireable.getRetireReason());
}
use of org.openmrs.Retireable in project openmrs-core by openmrs.
the class BaseUnretireHandlerTest method handle_shouldNotActOnRetiredObjectsWithADifferentDateRetired.
/**
* @see BaseUnretireHandler#handle(Retireable,User,Date,String)
*/
@Test
public void handle_shouldNotActOnRetiredObjectsWithADifferentDateRetired() {
// a time that isn't right now
Date d = new Date(new Date().getTime() - 1000);
UnretireHandler<Retireable> handler = new BaseUnretireHandler();
Retireable retireable = new Location();
retireable.setRetired(true);
retireable.setDateRetired(d);
handler.handle(retireable, null, new Date(), "SOME REASON");
Assert.assertTrue(retireable.getRetired());
}
use of org.openmrs.Retireable in project openmrs-core by openmrs.
the class BaseUnretireHandlerTest method handle_shouldUnsetTheRetirer.
/**
* @see BaseUnretireHandler#handle(Retireable,User,Date,String)
*/
@Test
public void handle_shouldUnsetTheRetirer() {
UnretireHandler<Retireable> handler = new BaseUnretireHandler();
Retireable retireable = new Location();
retireable.setRetired(true);
retireable.setRetiredBy(new User(1));
handler.handle(retireable, null, null, null);
Assert.assertNull(retireable.getRetiredBy());
}
use of org.openmrs.Retireable in project openmrs-core by openmrs.
the class BaseUnretireHandlerTest method handle_shouldUnsetTheRetireReason.
/**
* @see BaseUnretireHandler#handle(Retireable,User,Date,String)
*/
@Test
public void handle_shouldUnsetTheRetireReason() {
UnretireHandler<Retireable> handler = new BaseUnretireHandler();
Retireable retireable = new Location();
retireable.setRetired(true);
retireable.setRetireReason("SOME REASON");
handler.handle(retireable, null, null, null);
Assert.assertNull(retireable.getRetireReason());
}
use of org.openmrs.Retireable in project openmrs-core by openmrs.
the class BaseUnretireHandlerTest method handle_shouldNotActOnAlreadyUnretiredObjects.
/**
* @see BaseUnretireHandler#handle(Retireable,User,Date,String)
*/
@Test
public void handle_shouldNotActOnAlreadyUnretiredObjects() {
UnretireHandler<Retireable> handler = new BaseUnretireHandler();
Retireable retireable = new Location();
retireable.setRetired(false);
handler.handle(retireable, null, null, "SOME REASON");
Assert.assertNull(retireable.getRetireReason());
}
Aggregations