@Test public final void shouldConvertToString() throws Exception { Entity entity1 = mock(Entity.class); Entity entity2 = mock(Entity.class); Entity entity3 = mock(Entity.class); when(entity1.getId()).thenReturn(1L); when(entity2.getId()).thenReturn(2L); when(entity3.getId()).thenReturn(3L); when(entity1.getField("parent")).thenReturn(null); when(entity2.getField("parent")).thenReturn(1L); when(entity3.getField("parent")).thenReturn(2L); when(entity1.getBelongsToField("parent")).thenReturn(null); when(entity2.getBelongsToField("parent")).thenReturn(entity1); when(entity3.getBelongsToField("parent")).thenReturn(entity2); EntityTree tree = new DetachedEntityTreeImpl(Lists.newArrayList(entity1, entity2, entity3)); String stringTree = tree.toString(); Assert.assertEquals("EntityTree[DETACHED!][size=3]", stringTree); }
@Override public String toString() { return "EntityTree[DETACHED!][size=" + size() + "]"; }
DetachedEntityTreeImpl extends AbstractList<Entity> implements EntityTree { @Override public String toString() { return "EntityTree[DETACHED!][size=" + size() + "]"; } }
DetachedEntityTreeImpl extends AbstractList<Entity> implements EntityTree { @Override public String toString() { return "EntityTree[DETACHED!][size=" + size() + "]"; } DetachedEntityTreeImpl(final List<Entity> entities); }
DetachedEntityTreeImpl extends AbstractList<Entity> implements EntityTree { @Override public String toString() { return "EntityTree[DETACHED!][size=" + size() + "]"; } DetachedEntityTreeImpl(final List<Entity> entities); @Override SearchCriteriaBuilder find(); @Override Entity get(final int index); @Override int size(); @Override EntityTreeNodeImpl getRoot(); boolean checkIfTreeContainsEntity(final Long entityId); @Override String toString(); }
DetachedEntityTreeImpl extends AbstractList<Entity> implements EntityTree { @Override public String toString() { return "EntityTree[DETACHED!][size=" + size() + "]"; } DetachedEntityTreeImpl(final List<Entity> entities); @Override SearchCriteriaBuilder find(); @Override Entity get(final int index); @Override int size(); @Override EntityTreeNodeImpl getRoot(); boolean checkIfTreeContainsEntity(final Long entityId); @Override String toString();  }