@Test
public void testValidate02() {

    CustomerPassEqualsValidator validator = new CustomerPassEqualsValidator();
    CustomerForm customer = new CustomerForm();
    customer.setCustomerPass("12345");
    customer.setCustomerPassConfirm("1234");
    BindingResult result = new DirectFieldBindingResult(customer, "CustomerForm");
    // run
    validator.validate(customer, result);
    // assert
    assertThat(result.hasErrors(), is(true));
    FieldError error = result.getFieldError("customerPass");
    if (error != null) {
        assertThat(error.getCode(), is("NotEquals.customerPass"));
        assertThat(error.getDefaultMessage(), is(
                "Password and password confirm is not same."));
    } else {
        fail("error");
    }
}