Package org.springframework.binding.convert

Examples of org.springframework.binding.convert.ConversionExecutor.execute()


    final Principal princy1 = new Principal() {
      public String getName() {
        return "princy1";
      }
    };
    String[] p = (String[]) executor.execute(princy1);
    assertEquals("princy1", p[0]);
  }

  public void testRegisterCustomConverterObjectToArrayBogus() {
    DefaultConversionService service = new DefaultConversionService();
View Full Code Here


  @SuppressWarnings("unchecked")
  public void testRegisterCustomConverterObjectToList() {
    DefaultConversionService service = new DefaultConversionService();
    service.addConverter("princy", new CustomTwoWayConverter());
    ConversionExecutor executor = service.getConversionExecutor("princy", String.class, List.class);
    List<Principal> list = (List<Principal>) executor.execute("princy1");
    assertEquals("princy1", list.get(0).getName());
  }

  @SuppressWarnings("unchecked")
  public void testRegisterCustomConverterCsvStringToList() {
View Full Code Here

  @SuppressWarnings("unchecked")
  public void testRegisterCustomConverterCsvStringToList() {
    DefaultConversionService service = new DefaultConversionService();
    service.addConverter("princy", new PrincipalCsvStringToListConverter());
    ConversionExecutor executor = service.getConversionExecutor("princy", String.class, List.class);
    List<Principal> list = (List<Principal>) executor.execute("princy1,princy2");
    assertEquals("princy1", list.get(0).getName());
    assertEquals("princy2", list.get(1).getName());
  }

  public void testRegisterCustomConverterObjectToListBogus() {
View Full Code Here

  public void testRegisterCustomConverterObjectToListBogus() {
    DefaultConversionService service = new DefaultConversionService();
    service.addConverter("princy", new CustomTwoWayConverter());
    ConversionExecutor executor = service.getConversionExecutor("princy", Integer.class, List.class);
    try {
      executor.execute(1);
      fail("Should have failed");
    } catch (ConversionExecutionException e) {

    }
  }
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.