Package org.springframework.format.support

Examples of org.springframework.format.support.FormattingConversionService.convert()


  public void shouldLoadConverter() throws Exception {
    FormattingConversionServiceFactoryBean bean = this.applicationContext
        .getBean(FormattingConversionServiceFactoryBean.class);
    FormattingConversionService conversionService = bean.getObject();
    TypeDescriptor targetType = TypeDescriptor.valueOf(ClassWithConverter.class);
    assertThat(conversionService.convert(this.source, this.sourceType, targetType), is(equalTo(this.converted)));
  }
}
View Full Code Here


    this.context.refresh();
    FormattingConversionService cs = this.context
        .getBean(FormattingConversionService.class);
    Date date = new DateTime(1988, 6, 25, 20, 30).toDate();
    // formatting cs should use simple toString()
    assertThat(cs.convert(date, String.class), equalTo(date.toString()));
  }

  @Test
  public void overrideDateFormat() throws Exception {
    this.context = new AnnotationConfigEmbeddedWebApplicationContext();
View Full Code Here

        PropertyPlaceholderAutoConfiguration.class);
    this.context.refresh();
    FormattingConversionService cs = this.context
        .getBean(FormattingConversionService.class);
    Date date = new DateTime(1988, 6, 25, 20, 30).toDate();
    assertThat(cs.convert(date, String.class), equalTo("25*06*1988"));
  }

  @Test
  public void noMessageCodesResolver() throws Exception {
    this.context = new AnnotationConfigEmbeddedWebApplicationContext();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.