GenericTreeStructure implements TreeStructure { public FolderNode newFolderNode(@NotNull TreeNode parent, @NotNull ItemReference data) { if (!"folder".equals(data.getType()) && !"project".equals(data.getType())) { throw new IllegalArgumentException("The associated ItemReference type must be - folder or project."); } return getNodeFactory().newFolderNode(parent, data, this); } protected  GenericTreeStructure(NodeFactory nodeFactory, EventBus eventBus, AppContext appContext,
                                   ProjectServiceClient projectServiceClient, DtoUnmarshallerFactory dtoUnmarshallerFactory); @Override void getRootNodes(@NotNull AsyncCallback<List<TreeNode<?>>> callback); @NotNull @Override TreeSettings getSettings(); NodeFactory getNodeFactory(); @Override void getNodeByPath(@NotNull final String path, @NotNull final AsyncCallback<TreeNode<?>> callback); ProjectNode newProjectNode(@NotNull ProjectDescriptor data); FileNode newFileNode(@NotNull TreeNode parent, @NotNull ItemReference data); FolderNode newFolderNode(@NotNull TreeNode parent, @NotNull ItemReference data);  }
@Test public void testNewFolderNode() throws Exception { TreeNode parent = mock(TreeNode.class); ItemReference data = mock(ItemReference.class); when(data.getType()).thenReturn("folder"); treeStructure.newFolderNode(parent, data); verify(nodeFactory).newFolderNode(eq(parent), eq(data), eq(treeStructure)); }