Package org.dozer.vo.inheritance

Examples of org.dozer.vo.inheritance.Main


  public Main getMain() {
    Sub sub = newInstance(Sub.class);
    sub.setName("sName");
    sub.setDetail("sDetail");
    sub.setMarker("sMarker");
    Main result = newInstance(Main.class);
    result.setName("topLevelName");
    result.setSub(sub);
    return result;
  }
View Full Code Here


  }
 
  @Test
  public void testSubMarker() {
    mapper = super.getMapper("inheritanceMapping.xml");
    Main src = testDataFactory.getMain();

    // Map to Dto
    MainDto dest = mapper.map(src, MainDto.class);
    assertNotNull(dest);
    assertEquals(src.getName(), dest.getName());
   
    SubMarker subMarker = src.getSub();
    SubMarkerDto subMarkerDto = dest.getSub();
    assertNotNull(subMarkerDto);
    assertNull(subMarkerDto.getSub());
    assertEquals(subMarker.getMarker(), subMarkerDto.getMarker());
    assertEquals(subMarker.getName(), subMarkerDto.getName());

    Sub sub = (Sub) subMarker;
    SubDto subDto = (SubDto) subMarkerDto;
    assertEquals(sub.getDetail(), subDto.getDetail());
   
   
    // Map back
    src = mapper.map(dest, Main.class);
    assertNotNull(dest);
    assertEquals(dest.getName(), src.getName());

    subMarker = src.getSub();
    assertNotNull(subMarker);
    assertNull(subMarker.getSub());
    assertNull(subMarker.getMarker());//One way mapping
    assertEquals(subMarkerDto.getName(), subMarker.getName());
   
View Full Code Here

  }
 
  @Test
  public void testSubMarker() {
    mapper = super.getMapper("inheritanceMapping.xml");
    Main src = testDataFactory.getMain();

    // Map to Dto
    MainDto dest = mapper.map(src, MainDto.class);
    assertNotNull(dest);
    assertEquals(src.getName(), dest.getName());
   
    SubMarker subMarker = src.getSub();
    SubMarkerDto subMarkerDto = dest.getSub();
    assertNotNull(subMarkerDto);
    assertNull(subMarkerDto.getSub());
    assertEquals(subMarker.getMarker(), subMarkerDto.getMarker());
    assertEquals(subMarker.getName(), subMarkerDto.getName());

    Sub sub = (Sub) subMarker;
    SubDto subDto = (SubDto) subMarkerDto;
    assertEquals(sub.getDetail(), subDto.getDetail());
   
   
    // Map back
    src = mapper.map(dest, Main.class);
    assertNotNull(dest);
    assertEquals(dest.getName(), src.getName());

    subMarker = src.getSub();
    assertNotNull(subMarker);
    assertNull(subMarker.getSub());
    assertNull(subMarker.getMarker());//One way mapping
    assertEquals(subMarkerDto.getName(), subMarker.getName());
   
View Full Code Here

  public Main getMain() {
    Sub sub = newInstance(Sub.class);
    sub.setName("sName");
    sub.setDetail("sDetail");
    sub.setMarker("sMarker");
    Main result = newInstance(Main.class);
    result.setName("topLevelName");
    result.setSub(sub);
    return result;
  }
View Full Code Here

TOP

Related Classes of org.dozer.vo.inheritance.Main

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.