SyntacticEquivalence { public static boolean areEquivalent(List<? extends Tree> leftList, List<? extends Tree> rightList) { return areEquivalent(leftList, rightList, (t1, t2) -> false); } private  SyntacticEquivalence(); static boolean areEquivalent(List<? extends Tree> leftList, List<? extends Tree> rightList); static boolean areEquivalent(List<? extends Tree> leftList, List<? extends Tree> rightList, BiPredicate<JavaTree, JavaTree> permissiveEquivalence); static boolean areEquivalent(@Nullable Tree leftNode, @Nullable Tree rightNode);  }
@Test void null_equivalence() throws Exception { assertThat(SyntacticEquivalence.areEquivalent((Tree) null, null)).isTrue(); assertThat(SyntacticEquivalence.areEquivalent(null, compilationUnitTree("class A{}"))).isFalse(); assertThat(SyntacticEquivalence.areEquivalent(compilationUnitTree("class A{}"), null)).isFalse(); }
@Test void not_implemented_tree() { JavaTree.NotImplementedTreeImpl notImplementedTree = new JavaTree.NotImplementedTreeImpl(); assertThat(SyntacticEquivalence.areEquivalent(notImplementedTree, notImplementedTree)).isTrue(); assertThat(SyntacticEquivalence.areEquivalent(notImplementedTree, new JavaTree.NotImplementedTreeImpl())).isFalse(); }
@Test void extra_permissive_equivalence() { assertThat(SyntacticEquivalence.areEquivalent(compilationUnitTree("class A{}"), compilationUnitTree("class B{}"))).isFalse(); assertThat(SyntacticEquivalence.areEquivalent(compilationUnitTree("class A{}"), compilationUnitTree("class B{}"), (l,r) -> false)).isFalse(); assertThat(SyntacticEquivalence.areEquivalent(compilationUnitTree("class A{}"), compilationUnitTree("class B{}"), (l,r) -> true)).isTrue(); }