Support for Bean Validation 2.0 container elements (with BV 2.0 test setup)
Includes latest dependency updates (Hibernate Validator 6.0.1, Caffeine 2.5.4, Netty 4.1.14, Tomcat 8.5.19, Johnzon 1.1.2, JsonPath 2.4, Jython 2.7.1) Issue: SPR-15839 Issue: SPR-15808
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2017 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.
|
||||
@@ -31,8 +31,6 @@ import org.springframework.tests.sample.beans.TestBean;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Tested against Hibernate Validator 5.x.
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
*/
|
||||
public class BeanValidationPostProcessorTests {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2017 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.
|
||||
@@ -35,8 +35,6 @@ import org.springframework.validation.annotation.Validated;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Tests against Hibernate Validator 5.x.
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
|
||||
@@ -48,7 +48,6 @@ import static org.junit.Assert.*;
|
||||
/**
|
||||
* @author Kazuki Shimizu
|
||||
* @author Juergen Hoeller
|
||||
* @since 4.3
|
||||
*/
|
||||
public class SpringValidatorAdapterTests {
|
||||
|
||||
@@ -84,6 +83,7 @@ public class SpringValidatorAdapterTests {
|
||||
validatorAdapter.validate(testBean, errors);
|
||||
|
||||
assertThat(errors.getFieldErrorCount("password"), is(1));
|
||||
assertThat(errors.getFieldValue("password"), is("pass"));
|
||||
assertThat(messageSource.getMessage(errors.getFieldError("password"), Locale.ENGLISH),
|
||||
is("Size of Password is must be between 8 and 128"));
|
||||
}
|
||||
@@ -98,6 +98,7 @@ public class SpringValidatorAdapterTests {
|
||||
validatorAdapter.validate(testBean, errors);
|
||||
|
||||
assertThat(errors.getFieldErrorCount("password"), is(1));
|
||||
assertThat(errors.getFieldValue("password"), is("password"));
|
||||
assertThat(messageSource.getMessage(errors.getFieldError("password"), Locale.ENGLISH),
|
||||
is("Password must be same value with Password(Confirm)"));
|
||||
}
|
||||
@@ -112,6 +113,7 @@ public class SpringValidatorAdapterTests {
|
||||
validatorAdapter.validate(testBean, errors);
|
||||
|
||||
assertThat(errors.getFieldErrorCount("email"), is(1));
|
||||
assertThat(errors.getFieldValue("email"), is("test@example.com"));
|
||||
assertThat(errors.getFieldErrorCount("confirmEmail"), is(1));
|
||||
assertThat(messageSource.getMessage(errors.getFieldError("email"), Locale.ENGLISH),
|
||||
is("email must be same value with confirmEmail"));
|
||||
@@ -131,6 +133,7 @@ public class SpringValidatorAdapterTests {
|
||||
validatorAdapter.validate(testBean, errors);
|
||||
|
||||
assertThat(errors.getFieldErrorCount("email"), is(1));
|
||||
assertThat(errors.getFieldValue("email"), is("test@example.com"));
|
||||
assertThat(errors.getFieldErrorCount("confirmEmail"), is(1));
|
||||
assertThat(messageSource.getMessage(errors.getFieldError("email"), Locale.ENGLISH),
|
||||
is("email must be same value with confirmEmail"));
|
||||
@@ -139,6 +142,7 @@ public class SpringValidatorAdapterTests {
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Same(field = "password", comparingField = "confirmPassword")
|
||||
@Same(field = "email", comparingField = "confirmEmail")
|
||||
static class TestBean {
|
||||
|
||||
@@ -55,8 +55,6 @@ import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Tests against Hibernate Validator 5.x.
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
*/
|
||||
public class ValidatorFactoryTests {
|
||||
|
||||
Reference in New Issue
Block a user