Package java.util

Examples of java.util.ArrayList


  public void testListToListMapping_Explicit() {
    mapper = getMapper("topLevelMapping.xml");
    MyList source = new MyList();
    source.add("100");

    ArrayList result = mapper.map(source, ArrayList.class);

    assertEquals(1, result.size());
    assertEquals(100, result.get(0));
  }
View Full Code Here


  public void testListToListMapping_Implicit() {
    mapper = getMapper();
    MyList source = new MyList();
    source.add("100");

    ArrayList result = mapper.map(source, ArrayList.class);

    assertEquals(1, result.size());
    assertEquals("100", result.get(0));
  }
View Full Code Here

  }

  @Test
  public void testListToListMapping_ImplicitItems() {
    mapper = getMapper();
    ArrayList source = new ArrayList();
    ItemA itemA = new ItemA();
    itemA.setA("test");
    source.add(itemA);

    ArrayList result = mapper.map(source, ArrayList.class);

    assertEquals(1, result.size());
    assertEquals(itemA.getA(), ((ItemA) result.get(0)).getA());
  }
View Full Code Here

    MyList source = new MyList();
    ItemA itemA = new ItemA();
    itemA.setA("test");
    source.add(itemA);

    ArrayList result = mapper.map(source, ArrayList.class, "2");

    assertEquals(1, result.size());
    assertTrue(result.get(0) instanceof ItemB);
    assertEquals(itemA.getA(), ((ItemB) result.get(0)).getA());
  }
View Full Code Here

//        Set oldAvailLocs = FastSet.newInstance();
//        oldAvailLocs.addAll(availableLocations);
//        return new Object[]{new SimpleAssignmentMatrixImpl(origMatrix), oldAvailLocs};
//    }
    private Object createRollbackAssignData() {
        List locAssignment = new ArrayList(allAssignments.size());
        for (Assignment ass : allAssignments) {
            locAssignment.add(new MapEntry(ass, ass.getLocation()));
        }
        assert origMatrix.getColumns() == locAssignment.size() : origMatrix + " \n " + locAssignment;
        return new Object[]{new SimpleAssignmentMatrixImpl(origMatrix), locAssignment};
    }
View Full Code Here

  @Test
  public void testTargetBindInwards()
  {

    BindableBean form = new BindableBean();
    Collection collection = new ArrayList();
    collection.add(new DomainClass(1));
    collection.add(new DomainClass(3));
    collection.add(new DomainClass(4));
    Map map = handler.getPropertyAsMap(collection);
    form.setLookupMap(map);

    TargetBean targetBean = new TargetBean();
    form.setTargetBean(targetBean);
View Full Code Here

  @Test
  public void testNullTargetBindInwards()
  {

    BindableBean form = new BindableBean();
    Collection collection = new ArrayList();
    collection.add(new DomainClass(1));
    collection.add(new DomainClass(3));
    collection.add(new DomainClass(4));
    Map map = handler.getPropertyAsMap(collection);
    form.setLookupMap(map);

    TargetBean targetBean = new TargetBean();
    // form.setTargetBean(targetBean);
View Full Code Here

  @Test
  public void testInvalidIdBindInwards()
  {

    BindableBean form = new BindableBean();
    Collection collection = new ArrayList();
    collection.add(new DomainClass(1));
    collection.add(new DomainClass(3));
    collection.add(new DomainClass(4));
    Map map = handler.getPropertyAsMap(collection);
    form.setLookupMap(map);

    TargetBean targetBean = new TargetBean();
    form.setTargetBean(targetBean);
View Full Code Here

  {

    BindSelectHandler handler = new BindSelectHandler();
    handler.setBeanPropertyIdName("id");

    Collection collection = new ArrayList();
    collection.add(new DomainClass(1));
    collection.add(new DomainClass(3));
    collection.add(new DomainClass(4));

    Map map = handler.createMap(collection);
    assert map instanceof HashMap;

    Object firstKey = map.keySet().iterator().next();
View Full Code Here

    BindSelectHandler handler = new BindSelectHandler();
    handler.setBeanPropertyIdName("id");

    // create domain class instances with no id
    Collection collection = new ArrayList();
    collection.add(new DomainClass());
    collection.add(new DomainClass());
    collection.add(new DomainClass());

    Map map = handler.createMap(collection);
    assert map.size() == 1;
    assert map.keySet().iterator().next().equals(0);
  }
View Full Code Here

TOP

Related Classes of java.util.ArrayList

Copyright © 2018 www.massapicom. 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.