use of org.springframework.format.annotation.DateTimeFormat in project spring-boot by spring-projects.
the class BinderTests method bindWhenHasAnnotationsShouldChangeConvertedValue.
@Test
void bindWhenHasAnnotationsShouldChangeConvertedValue() {
this.sources.add(new MockConfigurationPropertySource("foo", "2014-04-01T01:30:00.000-05:00"));
DateTimeFormat annotation = AnnotationUtils.synthesizeAnnotation(Collections.singletonMap("iso", DateTimeFormat.ISO.DATE_TIME), DateTimeFormat.class, null);
LocalDate result = this.binder.bind("foo", Bindable.of(LocalDate.class).withAnnotations(annotation)).get();
assertThat(result.toString()).isEqualTo("2014-04-01");
}
Aggregations