### Question:
ForumStructureTreeModel extends ZkTreeModel<ForumStructureItem> { public void onDropNode(TreeNode<ForumStructureItem> draggedNode, TreeNode<ForumStructureItem> targetNode) { ForumStructureItem draggedItem = draggedNode.getData(); if (draggedItem.isBranch()) { ForumStructureItem targetItem = targetNode.getData(); if (targetItem.isBranch()) { dropNodeBefore(draggedNode, targetNode); } else { dropNodeIn(draggedNode, targetNode); } setSelectedNode(draggedNode); } else if (draggedItem.isSection()) { dropNodeBefore(draggedNode, targetNode); setSelectedNode(draggedNode); } } ForumStructureTreeModel(@Nonnull ZkTreeNode<ForumStructureItem> root); ForumStructureTreeModel putBranch(ForumStructureItem branchToPut, ForumStructureItem destinationSection); ForumStructureTreeModel moveBranchIfSectionChanged(PoulpeBranch branch); void addIfAbsent(PoulpeSection section); PoulpeSection getSelectedSection(); ZkTreeNode<ForumStructureItem> removeBranch(@Nullable PoulpeBranch branch); ZkTreeNode<ForumStructureItem> removeSection(@Nullable PoulpeSection section); List<PoulpeSection> getSections(); void onDropNode(TreeNode<ForumStructureItem> draggedNode,
                             TreeNode<ForumStructureItem> targetNode); boolean noEffectAfterDropNode(TreeNode<ForumStructureItem> draggedNode, 
            TreeNode<ForumStructureItem> targetNode); void expandTree(); void collapseTree();  }### Answer:
@Test public void onDropBranchToBranch() { TreeNode<ForumStructureItem> dragged = sut.getChild(1, 2); TreeNode<ForumStructureItem> target = sut.getChild(1, 0); sut.onDropNode(dragged, target); assertEquals(sut.getChild(1, 0), dragged); assertEquals(sut.getChild(1, 1), target); ForumStructureItem selected = sut.getSelectedData(1); assertEquals(selected, dragged.getData()); }
@Test public void onDropBranchToSection() { TreeNode<ForumStructureItem> dragged = sut.getChild(1, 0); TreeNode<ForumStructureItem> target = sut.getChild(2); sut.onDropNode(dragged, target); assertEquals(sut.getChild(2, 3), dragged); ForumStructureItem selected = sut.getSelectedData(1); assertEquals(selected, dragged.getData()); }
@Test public void onDropSectionToSection() { TreeNode<ForumStructureItem> dragged = sut.getChild(0); TreeNode<ForumStructureItem> target = sut.getChild(2); sut.onDropNode(dragged, target); assertEquals(sut.getChild(1), dragged); assertEquals(sut.getChild(2), target); ForumStructureItem selected = sut.getSelectedData(0); assertEquals(selected, dragged.getData()); }
@Test public void onDropEntity() { TreeNode<ForumStructureItem> entityItem = new ZkTreeNode<ForumStructureItem>( new ForumStructureItem(new Entity() { })); TreeNode<ForumStructureItem> beforeTarget = sut.getChild(1, 0); TreeNode<ForumStructureItem> target = sut.getChild(1, 1); TreeNode<ForumStructureItem> afterTarget = sut.getChild(1, 2); sut.onDropNode(entityItem, target); assertEquals(sut.getChild(1, 0), beforeTarget); assertEquals(sut.getChild(1, 1), target); assertEquals(sut.getChild(1, 2), afterTarget); }