|
|
|
|
@ -1,5 +1,5 @@
@@ -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. |
|
|
|
|
@ -61,7 +61,7 @@ import static org.junit.Assert.*;
@@ -61,7 +61,7 @@ import static org.junit.Assert.*;
|
|
|
|
|
public class ValidatorFactoryTests { |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
public void testSimpleValidation() throws Exception { |
|
|
|
|
public void testSimpleValidation() { |
|
|
|
|
LocalValidatorFactoryBean validator = new LocalValidatorFactoryBean(); |
|
|
|
|
validator.afterPropertiesSet(); |
|
|
|
|
|
|
|
|
|
@ -87,7 +87,7 @@ public class ValidatorFactoryTests {
@@ -87,7 +87,7 @@ public class ValidatorFactoryTests {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
public void testSimpleValidationWithCustomProvider() throws Exception { |
|
|
|
|
public void testSimpleValidationWithCustomProvider() { |
|
|
|
|
LocalValidatorFactoryBean validator = new LocalValidatorFactoryBean(); |
|
|
|
|
validator.setProviderClass(HibernateValidator.class); |
|
|
|
|
validator.afterPropertiesSet(); |
|
|
|
|
@ -114,9 +114,10 @@ public class ValidatorFactoryTests {
@@ -114,9 +114,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 +130,7 @@ public class ValidatorFactoryTests {
@@ -129,7 +130,7 @@ public class ValidatorFactoryTests {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
public void testSpringValidationFieldType() throws Exception { |
|
|
|
|
public void testSpringValidationFieldType() { |
|
|
|
|
LocalValidatorFactoryBean validator = new LocalValidatorFactoryBean(); |
|
|
|
|
validator.afterPropertiesSet(); |
|
|
|
|
|
|
|
|
|
@ -144,7 +145,7 @@ public class ValidatorFactoryTests {
@@ -144,7 +145,7 @@ public class ValidatorFactoryTests {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
public void testSpringValidation() throws Exception { |
|
|
|
|
public void testSpringValidation() { |
|
|
|
|
LocalValidatorFactoryBean validator = new LocalValidatorFactoryBean(); |
|
|
|
|
validator.afterPropertiesSet(); |
|
|
|
|
|
|
|
|
|
@ -172,7 +173,7 @@ public class ValidatorFactoryTests {
@@ -172,7 +173,7 @@ public class ValidatorFactoryTests {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
public void testSpringValidationWithClassLevel() throws Exception { |
|
|
|
|
public void testSpringValidationWithClassLevel() { |
|
|
|
|
LocalValidatorFactoryBean validator = new LocalValidatorFactoryBean(); |
|
|
|
|
validator.afterPropertiesSet(); |
|
|
|
|
|
|
|
|
|
@ -190,7 +191,7 @@ public class ValidatorFactoryTests {
@@ -190,7 +191,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 +212,7 @@ public class ValidatorFactoryTests {
@@ -211,7 +212,7 @@ public class ValidatorFactoryTests {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
public void testSpringValidationWithErrorInListElement() throws Exception { |
|
|
|
|
public void testSpringValidationWithErrorInListElement() { |
|
|
|
|
LocalValidatorFactoryBean validator = new LocalValidatorFactoryBean(); |
|
|
|
|
validator.afterPropertiesSet(); |
|
|
|
|
|
|
|
|
|
@ -229,7 +230,7 @@ public class ValidatorFactoryTests {
@@ -229,7 +230,7 @@ public class ValidatorFactoryTests {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
public void testSpringValidationWithErrorInSetElement() throws Exception { |
|
|
|
|
public void testSpringValidationWithErrorInSetElement() { |
|
|
|
|
LocalValidatorFactoryBean validator = new LocalValidatorFactoryBean(); |
|
|
|
|
validator.afterPropertiesSet(); |
|
|
|
|
|
|
|
|
|
@ -247,7 +248,7 @@ public class ValidatorFactoryTests {
@@ -247,7 +248,7 @@ public class ValidatorFactoryTests {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
public void testInnerBeanValidation() throws Exception { |
|
|
|
|
public void testInnerBeanValidation() { |
|
|
|
|
LocalValidatorFactoryBean validator = new LocalValidatorFactoryBean(); |
|
|
|
|
validator.afterPropertiesSet(); |
|
|
|
|
|
|
|
|
|
@ -259,7 +260,7 @@ public class ValidatorFactoryTests {
@@ -259,7 +260,7 @@ public class ValidatorFactoryTests {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
public void testValidationWithOptionalField() throws Exception { |
|
|
|
|
public void testValidationWithOptionalField() { |
|
|
|
|
LocalValidatorFactoryBean validator = new LocalValidatorFactoryBean(); |
|
|
|
|
validator.afterPropertiesSet(); |
|
|
|
|
|
|
|
|
|
@ -271,7 +272,7 @@ public class ValidatorFactoryTests {
@@ -271,7 +272,7 @@ public class ValidatorFactoryTests {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
public void testListValidation() throws Exception { |
|
|
|
|
public void testListValidation() { |
|
|
|
|
LocalValidatorFactoryBean validator = new LocalValidatorFactoryBean(); |
|
|
|
|
validator.afterPropertiesSet(); |
|
|
|
|
|
|
|
|
|
|