added tests with error in BindingResult (SPR-7809)
This commit is contained in:
parent
465e093bfb
commit
d3d7634574
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2010 the original author or authors.
|
* Copyright 2002-2011 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -108,6 +108,15 @@ public class JodaTimeFormattingTests {
|
||||||
assertEquals("Oct 31, 2009", binder.getBindingResult().getFieldValue("localDateAnnotated"));
|
assertEquals("Oct 31, 2009", binder.getBindingResult().getFieldValue("localDateAnnotated"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testBindLocalDateAnnotatedWithError() {
|
||||||
|
MutablePropertyValues propertyValues = new MutablePropertyValues();
|
||||||
|
propertyValues.add("localDateAnnotated", "Oct 031, 2009");
|
||||||
|
binder.bind(propertyValues);
|
||||||
|
assertEquals(1, binder.getBindingResult().getFieldErrorCount("localDateAnnotated"));
|
||||||
|
assertEquals("Oct 031, 2009", binder.getBindingResult().getFieldValue("localDateAnnotated"));
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBindNestedLocalDateAnnotated() {
|
public void testBindNestedLocalDateAnnotated() {
|
||||||
MutablePropertyValues propertyValues = new MutablePropertyValues();
|
MutablePropertyValues propertyValues = new MutablePropertyValues();
|
||||||
|
|
@ -127,6 +136,16 @@ public class JodaTimeFormattingTests {
|
||||||
assertEquals("Oct 31, 2009", binder.getBindingResult().getFieldValue("localDateAnnotated"));
|
assertEquals("Oct 31, 2009", binder.getBindingResult().getFieldValue("localDateAnnotated"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testBindLocalDateAnnotatedWithDirectFieldAccessAndError() {
|
||||||
|
binder.initDirectFieldAccess();
|
||||||
|
MutablePropertyValues propertyValues = new MutablePropertyValues();
|
||||||
|
propertyValues.add("localDateAnnotated", "Oct 031, 2009");
|
||||||
|
binder.bind(propertyValues);
|
||||||
|
assertEquals(1, binder.getBindingResult().getFieldErrorCount("localDateAnnotated"));
|
||||||
|
assertEquals("Oct 031, 2009", binder.getBindingResult().getFieldValue("localDateAnnotated"));
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBindLocalTime() {
|
public void testBindLocalTime() {
|
||||||
MutablePropertyValues propertyValues = new MutablePropertyValues();
|
MutablePropertyValues propertyValues = new MutablePropertyValues();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue