ValidatorMandatory extends AbstractValueValidator<Object> { public static ValidatorMandatory getInstance() { return INSTANCE; } ValidatorMandatory(); static ValidatorMandatory getInstance(); @SuppressWarnings("unchecked") @Override P getProperty(TypedProperty<P> property); @Override int hashCode(); @Override boolean equals(Object obj); static final String CODE; }
@Test public void testNull() { ValidationFailure failure = verifyNegativeValidation(ValidatorMandatory.getInstance(), null, FAILURE_MESSAGE); assertEquals("Wert muss gefüllt werden.", failure.getMessage(Locale.GERMANY)); }
@Test public void testEmptyString() { verifyNegativeValidation(ValidatorMandatory.getInstance(), "", FAILURE_MESSAGE); }
@Test public void testEmptyList() { verifyNegativeValidation(ValidatorMandatory.getInstance(), Collections.EMPTY_LIST, FAILURE_MESSAGE); }
@Test public void testFilledString() { verifyPositiveValidation(ValidatorMandatory.getInstance(), "some value"); }
@Test public void testFilledZero() { verifyPositiveValidation(ValidatorMandatory.getInstance(), BigDecimal.ZERO); }