Package org.dozer.vo.abstractinheritance

Examples of org.dozer.vo.abstractinheritance.AbstractACollectionContainer


  }
 
  @Test
  public void testCustomMappingForAsbstractDestClassCollection() throws Exception {
    mapper = getMapper("abstractMapping.xml");
    AbstractACollectionContainer src = getAsContainer();
    AbstractBCollectionContainer dest = mapper.map(src, AbstractBCollectionContainer.class);
    assertTrue(dest.getBs().get(0) instanceof B);

    assertNull("abstractField1 should have been excluded", dest.getBs().get(0).getAbstractField1());
    assertEquals("abstractBField not mapped correctly", src.getAs().get(0).getAbstractAField(), dest.getBs().get(0).getAbstractBField());
    assertEquals("field1 not mapped correctly", ((A)src.getAs().get(0)).getField1(), ((B)dest.getBs().get(0)).getField1());
    assertEquals("fieldB not mapped correctly", ((A)src.getAs().get(0)).getFieldA(), ((B)dest.getBs().get(0)).getFieldB());
   
    // Remap to each other to test bi-directional mapping
    AbstractACollectionContainer mappedSrc = mapper.map(dest, AbstractACollectionContainer.class);
    AbstractBCollectionContainer mappedDest = mapper.map(mappedSrc, AbstractBCollectionContainer.class);
   
    assertEquals("objects not mapped correctly bi-directional", dest, mappedDest);
}
View Full Code Here


    result.setA(getA());
    return result;
  }
 
  private AbstractACollectionContainer getAsContainer() {
    AbstractACollectionContainer result = newInstance(AbstractACollectionContainer.class);
    List<AbstractA> list = new ArrayList<AbstractA>();
    list.add(getA());
    result.setAs(list);
    return result;
  }
View Full Code Here

  }
 
  @Test
  public void testCustomMappingForAsbstractDestClassCollection() throws Exception {
    mapper = getMapper("abstractMapping.xml");
    AbstractACollectionContainer src = getAsContainer();
    AbstractBCollectionContainer dest = mapper.map(src, AbstractBCollectionContainer.class);
    assertTrue(dest.getBs().get(0) instanceof B);

    assertNull("abstractField1 should have been excluded", dest.getBs().get(0).getAbstractField1());
    assertEquals("abstractBField not mapped correctly", src.getAs().get(0).getAbstractAField(), dest.getBs().get(0).getAbstractBField());
    assertEquals("field1 not mapped correctly", ((A)src.getAs().get(0)).getField1(), ((B)dest.getBs().get(0)).getField1());
    assertEquals("fieldB not mapped correctly", ((A)src.getAs().get(0)).getFieldA(), ((B)dest.getBs().get(0)).getFieldB());
   
    // Remap to each other to test bi-directional mapping
    AbstractACollectionContainer mappedSrc = mapper.map(dest, AbstractACollectionContainer.class);
    AbstractBCollectionContainer mappedDest = mapper.map(mappedSrc, AbstractBCollectionContainer.class);
   
    assertEquals("objects not mapped correctly bi-directional", dest, mappedDest);
}
View Full Code Here

    result.setA(getA());
    return result;
  }
 
  private AbstractACollectionContainer getAsContainer() {
    AbstractACollectionContainer result = newInstance(AbstractACollectionContainer.class);
    List<AbstractA> list = new ArrayList<AbstractA>();
    list.add(getA());
    result.setAs(list);
    return result;
  }
View Full Code Here

TOP

Related Classes of org.dozer.vo.abstractinheritance.AbstractACollectionContainer

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.