@Test
public void testValidate() throws Exception {

    NotNullValidator validator = new NotNullValidator(false, true);
    assertTrue(validator.validate("foo"));
    assertFalse(validator.validate(""));
    assertFalse(validator.validate("   "));
    assertFalse(validator.validate(null));
    validator = new NotNullValidator(true, true);
    assertTrue(validator.validate("foo"));
    assertTrue(validator.validate(""));
    assertTrue(validator.validate("   "));
    assertFalse(validator.validate(null));
    validator = new NotNullValidator(true, false);
    assertTrue(validator.validate("foo"));
    assertTrue(validator.validate(""));
    assertTrue(validator.validate("   "));
    assertFalse(validator.validate(null));
}