@Test public void getChildCount() { int count = 3; List<BaseObject> objects = new ArrayList<>(); for (int i = 0; i < count; i++) { BaseObject object = mock(BaseObject.class, String.valueOf(i)); BaseObjectReference reference = mock(BaseObjectReference.class, String.valueOf(i)); when(object.getReference()).thenReturn(reference); objects.add(object); } objects.add(2, null); when(this.document.getXObjects(CLASS_REFERENCE)).thenReturn(objects); assertEquals(count, this.objectsOfTypeTreeNode.getChildCount(NODE_ID)); }
@Override public int getChildCount(String nodeId) { DocumentReference[] parts = resolve(nodeId); if (parts != null) { try { return getXObjectReferences(parts[0], parts[1]).size(); } catch (Exception e) { this.logger.warn("Failed to count the children of [{}]. Root cause is [{}].", nodeId, ExceptionUtils.getRootCauseMessage(e)); } } return 0; }
ObjectsOfTypeTreeNode extends AbstractTreeNode { @Override public int getChildCount(String nodeId) { DocumentReference[] parts = resolve(nodeId); if (parts != null) { try { return getXObjectReferences(parts[0], parts[1]).size(); } catch (Exception e) { this.logger.warn("Failed to count the children of [{}]. Root cause is [{}].", nodeId, ExceptionUtils.getRootCauseMessage(e)); } } return 0; } }
ObjectsOfTypeTreeNode extends AbstractTreeNode { @Override public int getChildCount(String nodeId) { DocumentReference[] parts = resolve(nodeId); if (parts != null) { try { return getXObjectReferences(parts[0], parts[1]).size(); } catch (Exception e) { this.logger.warn("Failed to count the children of [{}]. Root cause is [{}].", nodeId, ExceptionUtils.getRootCauseMessage(e)); } } return 0; }  }
ObjectsOfTypeTreeNode extends AbstractTreeNode { @Override public int getChildCount(String nodeId) { DocumentReference[] parts = resolve(nodeId); if (parts != null) { try { return getXObjectReferences(parts[0], parts[1]).size(); } catch (Exception e) { this.logger.warn("Failed to count the children of [{}]. Root cause is [{}].", nodeId, ExceptionUtils.getRootCauseMessage(e)); } } return 0; }  @Override List<String> getChildren(String nodeId, int offset, int limit); @Override int getChildCount(String nodeId); @Override String getParent(String nodeId); }
ObjectsOfTypeTreeNode extends AbstractTreeNode { @Override public int getChildCount(String nodeId) { DocumentReference[] parts = resolve(nodeId); if (parts != null) { try { return getXObjectReferences(parts[0], parts[1]).size(); } catch (Exception e) { this.logger.warn("Failed to count the children of [{}]. Root cause is [{}].", nodeId, ExceptionUtils.getRootCauseMessage(e)); } } return 0; }  @Override List<String> getChildren(String nodeId, int offset, int limit); @Override int getChildCount(String nodeId); @Override String getParent(String nodeId);  }