@@ -70,7 +70,7 @@ public class SpringValidatorAdapterTests {
|
||||
@Before
|
||||
public void setupSpringValidatorAdapter() {
|
||||
messageSource.addMessage("Size", Locale.ENGLISH, "Size of {0} is must be between {2} and {1}");
|
||||
messageSource.addMessage("Same", Locale.ENGLISH, "{2} must be same value with {1}");
|
||||
messageSource.addMessage("Same", Locale.ENGLISH, "{2} must be same value as {1}");
|
||||
messageSource.addMessage("password", Locale.ENGLISH, "Password");
|
||||
messageSource.addMessage("confirmPassword", Locale.ENGLISH, "Password(Confirm)");
|
||||
}
|
||||
@@ -107,7 +107,7 @@ public class SpringValidatorAdapterTests {
|
||||
|
||||
assertThat(errors.getFieldErrorCount("password"), is(1));
|
||||
assertThat(messageSource.getMessage(errors.getFieldError("password"), Locale.ENGLISH),
|
||||
is("Password must be same value with Password(Confirm)"));
|
||||
is("Password must be same value as Password(Confirm)"));
|
||||
}
|
||||
|
||||
@Test // SPR-13406
|
||||
@@ -122,7 +122,7 @@ public class SpringValidatorAdapterTests {
|
||||
assertThat(errors.getFieldErrorCount("email"), is(1));
|
||||
assertThat(errors.getFieldErrorCount("confirmEmail"), is(1));
|
||||
assertThat(messageSource.getMessage(errors.getFieldError("email"), Locale.ENGLISH),
|
||||
is("email must be same value with confirmEmail"));
|
||||
is("email must be same value as confirmEmail"));
|
||||
assertThat(messageSource.getMessage(errors.getFieldError("confirmEmail"), Locale.ENGLISH),
|
||||
is("Email required"));
|
||||
}
|
||||
@@ -141,7 +141,7 @@ public class SpringValidatorAdapterTests {
|
||||
assertThat(errors.getFieldErrorCount("email"), is(1));
|
||||
assertThat(errors.getFieldErrorCount("confirmEmail"), is(1));
|
||||
assertThat(messageSource.getMessage(errors.getFieldError("email"), Locale.ENGLISH),
|
||||
is("email must be same value with confirmEmail"));
|
||||
is("email must be same value as confirmEmail"));
|
||||
assertThat(messageSource.getMessage(errors.getFieldError("confirmEmail"), Locale.ENGLISH),
|
||||
is("Email required"));
|
||||
}
|
||||
@@ -354,13 +354,13 @@ public class SpringValidatorAdapterTests {
|
||||
|
||||
private Integer id;
|
||||
|
||||
@javax.validation.constraints.NotNull
|
||||
@NotNull
|
||||
private String name;
|
||||
|
||||
@javax.validation.constraints.NotNull
|
||||
@NotNull
|
||||
private Integer age;
|
||||
|
||||
@javax.validation.constraints.NotNull
|
||||
@NotNull
|
||||
private Parent parent;
|
||||
|
||||
public Integer getId() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -54,14 +54,12 @@ import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Tests against Hibernate Validator 5.x.
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
*/
|
||||
public class ValidatorFactoryTests {
|
||||
|
||||
@Test
|
||||
public void testSimpleValidation() throws Exception {
|
||||
public void testSimpleValidation() {
|
||||
LocalValidatorFactoryBean validator = new LocalValidatorFactoryBean();
|
||||
validator.afterPropertiesSet();
|
||||
|
||||
@@ -114,9 +112,10 @@ public class ValidatorFactoryTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSimpleValidationWithClassLevel() throws Exception {
|
||||
public void testSimpleValidationWithClassLevel() {
|
||||
LocalValidatorFactoryBean validator = new LocalValidatorFactoryBean();
|
||||
validator.afterPropertiesSet();
|
||||
|
||||
ValidPerson person = new ValidPerson();
|
||||
person.setName("Juergen");
|
||||
person.getAddress().setStreet("Juergen's Street");
|
||||
@@ -129,7 +128,7 @@ public class ValidatorFactoryTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSpringValidationFieldType() throws Exception {
|
||||
public void testSpringValidationFieldType() {
|
||||
LocalValidatorFactoryBean validator = new LocalValidatorFactoryBean();
|
||||
validator.afterPropertiesSet();
|
||||
|
||||
@@ -144,7 +143,7 @@ public class ValidatorFactoryTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSpringValidation() throws Exception {
|
||||
public void testSpringValidation() {
|
||||
LocalValidatorFactoryBean validator = new LocalValidatorFactoryBean();
|
||||
validator.afterPropertiesSet();
|
||||
|
||||
@@ -172,7 +171,7 @@ public class ValidatorFactoryTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSpringValidationWithClassLevel() throws Exception {
|
||||
public void testSpringValidationWithClassLevel() {
|
||||
LocalValidatorFactoryBean validator = new LocalValidatorFactoryBean();
|
||||
validator.afterPropertiesSet();
|
||||
|
||||
@@ -190,7 +189,7 @@ public class ValidatorFactoryTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSpringValidationWithAutowiredValidator() throws Exception {
|
||||
public void testSpringValidationWithAutowiredValidator() {
|
||||
ConfigurableApplicationContext ctx = new AnnotationConfigApplicationContext(
|
||||
LocalValidatorFactoryBean.class);
|
||||
LocalValidatorFactoryBean validator = ctx.getBean(LocalValidatorFactoryBean.class);
|
||||
@@ -211,7 +210,7 @@ public class ValidatorFactoryTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSpringValidationWithErrorInListElement() throws Exception {
|
||||
public void testSpringValidationWithErrorInListElement() {
|
||||
LocalValidatorFactoryBean validator = new LocalValidatorFactoryBean();
|
||||
validator.afterPropertiesSet();
|
||||
|
||||
@@ -229,7 +228,7 @@ public class ValidatorFactoryTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSpringValidationWithErrorInSetElement() throws Exception {
|
||||
public void testSpringValidationWithErrorInSetElement() {
|
||||
LocalValidatorFactoryBean validator = new LocalValidatorFactoryBean();
|
||||
validator.afterPropertiesSet();
|
||||
|
||||
@@ -247,7 +246,7 @@ public class ValidatorFactoryTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInnerBeanValidation() throws Exception {
|
||||
public void testInnerBeanValidation() {
|
||||
LocalValidatorFactoryBean validator = new LocalValidatorFactoryBean();
|
||||
validator.afterPropertiesSet();
|
||||
|
||||
@@ -259,7 +258,7 @@ public class ValidatorFactoryTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testValidationWithOptionalField() throws Exception {
|
||||
public void testValidationWithOptionalField() {
|
||||
LocalValidatorFactoryBean validator = new LocalValidatorFactoryBean();
|
||||
validator.afterPropertiesSet();
|
||||
|
||||
@@ -412,7 +411,7 @@ public class ValidatorFactoryTests {
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.FIELD)
|
||||
@Constraint(validatedBy=InnerValidator.class)
|
||||
public static @interface InnerValid {
|
||||
public @interface InnerValid {
|
||||
|
||||
String message() default "NOT VALID";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user