|
|
@ -199,15 +199,15 @@ public class BinderTests {
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
public void bindWhenHasMalformedDateShouldThrowException() throws Exception {
|
|
|
|
public void bindWhenHasMalformedDateShouldThrowException() throws Exception {
|
|
|
|
this.thrown.expectCause(instanceOf(ConversionFailedException.class));
|
|
|
|
this.thrown.expectCause(instanceOf(ConversionFailedException.class));
|
|
|
|
this.sources.add(new MockConfigurationPropertySource("foo", "2014-04-01"));
|
|
|
|
this.sources.add(new MockConfigurationPropertySource("foo", "2014-04-01T01:30:00.000-05:00"));
|
|
|
|
this.binder.bind("foo", Bindable.of(LocalDate.class));
|
|
|
|
this.binder.bind("foo", Bindable.of(LocalDate.class));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
public void bindWhenHasAnnotationsShouldChangeConvertedValue() throws Exception {
|
|
|
|
public void bindWhenHasAnnotationsShouldChangeConvertedValue() throws Exception {
|
|
|
|
this.sources.add(new MockConfigurationPropertySource("foo", "2014-04-01"));
|
|
|
|
this.sources.add(new MockConfigurationPropertySource("foo", "2014-04-01T01:30:00.000-05:00"));
|
|
|
|
DateTimeFormat annotation = AnnotationUtils.synthesizeAnnotation(
|
|
|
|
DateTimeFormat annotation = AnnotationUtils.synthesizeAnnotation(
|
|
|
|
Collections.singletonMap("iso", DateTimeFormat.ISO.DATE),
|
|
|
|
Collections.singletonMap("iso", DateTimeFormat.ISO.DATE_TIME),
|
|
|
|
DateTimeFormat.class, null);
|
|
|
|
DateTimeFormat.class, null);
|
|
|
|
LocalDate result = this.binder
|
|
|
|
LocalDate result = this.binder
|
|
|
|
.bind("foo", Bindable.of(LocalDate.class).withAnnotations(annotation))
|
|
|
|
.bind("foo", Bindable.of(LocalDate.class).withAnnotations(annotation))
|
|
|
|