### Question:
TreeNodeFactory { @SuppressWarnings({ "rawtypes", "unchecked" }) public static <T extends Entity> ZkTreeNode getTreeNode(T entity) { if (entity instanceof PoulpeSection) { List<T> branches = (List<T>) ((PoulpeSection) entity).getBranches(); return new ZkTreeNode(new ForumStructureItem(entity), wrapInTreeNodes(branches)); } else { return new ZkTreeNode(new ForumStructureItem(entity)); } }  @SuppressWarnings({ "unchecked", "rawtypes" }) static ZkTreeNode<ForumStructureItem> buildForumStructure(@Nonnull Jcommune jcommune); @SuppressWarnings({ "rawtypes", "unchecked" }) static ZkTreeNode getTreeNode(T entity);  }### Answer:
@Test(enabled = false) public void getTreeNodeEmptySection() { DefaultTreeNode<PoulpeSection> testNode = TreeNodeFactory.getTreeNode(emptySection); assertEquals(testNode.getData(), emptySection); assertTrue(testNode.getChildren().isEmpty()); }
@Test(enabled = false) public void getTreeNodeBranch() { DefaultTreeNode<PoulpeBranch> testNode = TreeNodeFactory.getTreeNode(branch); assertEquals(testNode.getData(), branch); assertNull(testNode.getChildren()); assertTrue(testNode.isLeaf()); }
@Test(enabled = false) public void getTreeNodeNull() { DefaultTreeNode<?> testNode = TreeNodeFactory.getTreeNode((Entity) null); assertNull(testNode); }
@Test(enabled = false) public void getTreeNodeNotSuitableEntity() { DefaultTreeNode<?> testNode = TreeNodeFactory.getTreeNode(new TopicType()); assertNull(testNode); }
@Test(enabled = false) public void getTreeNodeWithRelationsTest() { DefaultTreeNode<?> testNode = TreeNodeFactory.getTreeNode(section); assertEquals(testNode.getData(), section); assertEquals(testNode.getChildren().size(), section.getPoulpeBranches().size()); assertEquals(testNode.getChildAt(0).getData(), section.getPoulpeBranches().get(0)); }