FindDuplicateSubtrees { public List<BinaryTreeNode> findDuplicateSubtrees(BinaryTreeNode root) { Set<BinaryTreeNode> duplicates = new HashSet<>(); HashMap<String, Integer> deserialSet = new HashMap<>(); postOrder(duplicates, deserialSet, root); return new ArrayList(duplicates); }  List<BinaryTreeNode> findDuplicateSubtrees(BinaryTreeNode root);  }
@Test(dataProvider = "treeProvider") public void test(BinaryTreeNode root, List<BinaryTreeNode> duplicates) { assertEquals(new FindDuplicateSubtrees().findDuplicateSubtrees(root).size(), duplicates.size()); }