@Test public void intDefModel_whenModelIsValid_shouldNotThrowException() throws RaveException { IntDefModel model = new IntDefModel(IntDefModel.NAVIGATION_MODE_LIST); Rave.getInstance().validate(model); }
private void validateAs(LongDefModel object) throws InvalidModelException { BaseValidator.ValidationContext context = getValidationContext(LongDefModel.class); List<RaveError> raveErrors = null; context.setValidatedItemName("getStandard()"); raveErrors = mergeErrors(raveErrors, checkLongDef(context, object.getStandard(), false, 0L, 1L, 2L)); if (raveErrors != null && !raveErrors.isEmpty()) { throw new InvalidModelException(raveErrors); } }
@Test(expected = InvalidModelException.class) public void intDefModel_whenModelIsInvalid_shouldThrowException() throws RaveException { IntDefModel model = new IntDefModel(1111111111); Rave.getInstance().validate(model); }
private void validateAs(IntDefModel object) throws InvalidModelException { BaseValidator.ValidationContext context = getValidationContext(IntDefModel.class); List<RaveError> raveErrors = null; context.setValidatedItemName("getStandard()"); raveErrors = mergeErrors(raveErrors, checkIntDef(context, object.getStandard(), false, 0, 1, 2)); if (raveErrors != null && !raveErrors.isEmpty()) { throw new InvalidModelException(raveErrors); } }
public void buildValidCases() { while (incrementer.hasValidPermutations()) { addValidType(new IntDefModel(matchIntDefCreator.getValidItem())); incrementer.incrementValidCreators(); } }
@Test public void allInvalidIntDefModel_shouldFail() throws RaveException { IntDefModel.Builder builder = new IntDefModel.Builder(); Collection<IntDefModel> validCases = builder.getInvalidCases(); assertFalse(validCases.isEmpty()); Rave rave = Rave.getInstance(); for (IntDefModel model : validCases) { try { rave.validate(model); } catch (InvalidModelException e) { continue; } assertTrue("Model should have failed with int: " + model.getStandard() + "\n", false); } }
public void buildInvalidCases() { while (incrementer.hasInvalidPermutations()) { addInvalidType(new IntDefModel(matchIntDefStringCreator.getInvalidItem())); incrementer.incrementInvalidCreators(); } } }
@Test public void allInvalidIntDefModel_shouldFail() throws RaveException { IntDefModel.Builder builder = new IntDefModel.Builder(); Collection<IntDefModel> validCases = builder.getInvalidCases(); assertThat(validCases).isNotEmpty(); Rave rave = Rave.getInstance(); for (IntDefModel model : validCases) { try { rave.validate(model); } catch (InvalidModelException e) { continue; } assertTrue("Model should have failed with int: " + model.getStandard() + "\n", false); } }
public void buildValidCases() { while (incrementer.hasValidPermutations()) { addValidType(new IntDefModel(matchIntDefStringCreator.getValidItem())); incrementer.incrementValidCreators(); } }
public void buildInvalidCases() { while (incrementer.hasInvalidPermutations()) { addInvalidType(new IntDefModel(matchIntDefCreator.getInvalidItem())); incrementer.incrementInvalidCreators(); } } }