Package org.springframework.core.convert.support

Examples of org.springframework.core.convert.support.DefaultConversionService.convert()


  @Test
  public void testWithConversionService() {
    ConversionService conversionService = new DefaultConversionService();
    assertTrue(conversionService.canConvert(String.class, MediaType.class));
    MediaType mediaType = MediaType.parseMediaType("application/xml");
    assertEquals(mediaType, conversionService.convert("application/xml", MediaType.class));
  }

  @Test
  public void isConcrete() {
    assertTrue("text/plain not concrete", MediaType.TEXT_PLAIN.isConcrete());
View Full Code Here


  @Test
  public void testWithConversionService() {
    ConversionService conversionService = new DefaultConversionService();
    assertTrue(conversionService.canConvert(String.class, MimeType.class));
    MimeType mimeType = MimeType.valueOf("application/xml");
    assertEquals(mimeType, conversionService.convert("application/xml", MimeType.class));
  }

  @Test
  public void includes() throws Exception {
    MimeType textPlain = MimeTypeUtils.TEXT_PLAIN;
View Full Code Here

    CustomConversions conversions = new CustomConversions(Arrays.asList(CustomDateTimeConverter.INSTANCE));
    GenericConversionService conversionService = new DefaultConversionService();
    conversions.registerConvertersIn(conversionService);

    assertThat(conversionService.convert(new DateTime(), Date.class), is(new Date(0)));
  }

  /**
   * @see DATAMONGO-1001
   */
 
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.