use of io.spine.test.entity.number.NaturalNumber in project core-java by SpineEventEngine.
the class AbstractEntityShould method throw_InvalidEntityStateException_if_state_is_invalid.
@Test
public void throw_InvalidEntityStateException_if_state_is_invalid() {
final NaturalNumberEntity entity = new NaturalNumberEntity(0L);
final NaturalNumber invalidNaturalNumber = newNaturalNumber(-1);
try {
// This should pass.
entity.updateState(newNaturalNumber(1));
// This should fail.
entity.updateState(invalidNaturalNumber);
fail("Exception expected.");
} catch (InvalidEntityStateException e) {
assertSize(1, e.getError().getValidationError().getConstraintViolationList());
}
}
Aggregations