@Test public void testEquivalence() throws Exception { final List<Incident> incidents = Arrays.asList(mkIncident(1), mkIncident(2)); final List<IncidentTree> subTrees = Collections.singletonList(new IncidentTreeImpl( Arrays.asList(mkIncident(3), mkIncident(4)), Collections.emptyList())); final JaxbIncidentTree dto = new JaxbIncidentTree(new IncidentTreeImpl(incidents, subTrees)); final IncidentTree tree = dto.toIncidentTree(); run(IncidentTree.class, new IncidentTree() { @Override public List<Incident> getIncidents() { assertEquals("incidents transferred", incidents, tree.getIncidents()); return null; } @Override public List<IncidentTree> getDescendants() { assertEquals("childIncidents transferred", subTrees, tree.getDescendants()); return null; } }); }
public IncidentTree toIncidentTree() { return new IncidentTreeImpl( mlist(nullToNil(incidents)).map(JaxbIncident.toIncidentFn).value(), mlist(nullToNil(descendants)).map(toIncidentTreeFn).value()); }
JaxbIncidentTree { public IncidentTree toIncidentTree() { return new IncidentTreeImpl( mlist(nullToNil(incidents)).map(JaxbIncident.toIncidentFn).value(), mlist(nullToNil(descendants)).map(toIncidentTreeFn).value()); } }
JaxbIncidentTree { public IncidentTree toIncidentTree() { return new IncidentTreeImpl( mlist(nullToNil(incidents)).map(JaxbIncident.toIncidentFn).value(), mlist(nullToNil(descendants)).map(toIncidentTreeFn).value()); } JaxbIncidentTree();  JaxbIncidentTree(IncidentTree tree); }
JaxbIncidentTree { public IncidentTree toIncidentTree() { return new IncidentTreeImpl( mlist(nullToNil(incidents)).map(JaxbIncident.toIncidentFn).value(), mlist(nullToNil(descendants)).map(toIncidentTreeFn).value()); } JaxbIncidentTree();  JaxbIncidentTree(IncidentTree tree); IncidentTree toIncidentTree(); }
JaxbIncidentTree { public IncidentTree toIncidentTree() { return new IncidentTreeImpl( mlist(nullToNil(incidents)).map(JaxbIncident.toIncidentFn).value(), mlist(nullToNil(descendants)).map(toIncidentTreeFn).value()); } JaxbIncidentTree();  JaxbIncidentTree(IncidentTree tree); IncidentTree toIncidentTree(); static final Function<IncidentTree, JaxbIncidentTree> mkFn; static final Function<JaxbIncidentTree, IncidentTree> toIncidentTreeFn; }