use of org.openmrs.Voidable in project openmrs-core by openmrs.
the class BaseUnvoidHandlerTest method handle_shouldUnsetTheVoidedBit.
/**
* @see BaseUnvoidHandler#handle(Voidable,User,Date,String)
*/
@Test
public void handle_shouldUnsetTheVoidedBit() {
UnvoidHandler<Voidable> handler = new BaseUnvoidHandler();
Voidable voidable = new Person();
voidable.setVoided(true);
handler.handle(voidable, null, null, null);
Assert.assertFalse(voidable.getVoided());
}
use of org.openmrs.Voidable in project openmrs-core by openmrs.
the class BaseUnvoidHandlerTest method handle_shouldUnsetTheVoider.
/**
* @see BaseUnvoidHandler#handle(Voidable,User,Date,String)
*/
@Test
public void handle_shouldUnsetTheVoider() {
UnvoidHandler<Voidable> handler = new BaseUnvoidHandler();
Voidable voidable = new Person();
voidable.setVoided(true);
voidable.setVoidedBy(new User(1));
handler.handle(voidable, null, null, null);
Assert.assertNull(voidable.getVoidedBy());
}
use of org.openmrs.Voidable in project openmrs-core by openmrs.
the class BaseUnvoidHandlerTest method handle_shouldUnsetTheDateVoided.
/**
* @see BaseUnvoidHandler#handle(Voidable,User,Date,String)
*/
@Test
public void handle_shouldUnsetTheDateVoided() {
UnvoidHandler<Voidable> handler = new BaseUnvoidHandler();
Voidable voidable = new Person();
voidable.setVoided(true);
voidable.setDateVoided(new Date());
handler.handle(voidable, null, null, null);
Assert.assertNull(voidable.getDateVoided());
}
use of org.openmrs.Voidable in project openmrs-core by openmrs.
the class BaseUnvoidHandlerTest method handle_shouldOnlyActOnAlreadyVoidedObjects.
/**
* @see BaseUnvoidHandler#handle(Voidable,User,Date,String)
*/
@Test
public void handle_shouldOnlyActOnAlreadyVoidedObjects() {
UnvoidHandler<Voidable> handler = new BaseUnvoidHandler();
Voidable voidable = new Person();
voidable.setVoided(false);
handler.handle(voidable, null, null, "SOME REASON");
Assert.assertNull(voidable.getVoidReason());
}
use of org.openmrs.Voidable in project openmrs-core by openmrs.
the class BaseUnvoidHandlerTest method handle_shouldUnsetTheVoidReason.
/**
* @see BaseUnvoidHandler#handle(Voidable,User,Date,String)
*/
@Test
public void handle_shouldUnsetTheVoidReason() {
UnvoidHandler<Voidable> handler = new BaseUnvoidHandler();
Voidable voidable = new Person();
voidable.setVoided(true);
voidable.setVoidReason("SOME REASON");
handler.handle(voidable, null, null, null);
Assert.assertNull(voidable.getVoidReason());
}
Aggregations