use of com.github.javaparser.ast.visitor.ObjectIdentityEqualsVisitor in project javaparser by javaparser.
the class VisitorListTest method visitorListContains.
@Test
public void visitorListContains() {
CompilationUnit x1 = JavaParser.parse("class X{}");
VisitorList<CompilationUnit> list = new VisitorList<>(new ObjectIdentityHashCodeVisitor(), new ObjectIdentityEqualsVisitor());
list.add(x1);
assertTrue(list.contains(x1));
}
use of com.github.javaparser.ast.visitor.ObjectIdentityEqualsVisitor in project javaparser by javaparser.
the class VisitorListTest method visitorListRetainAll.
@Test
public void visitorListRetainAll() {
List<CompilationUnit> list = new ArrayList<>();
list.add(JavaParser.parse("class X{}"));
list.add(JavaParser.parse("class X{}"));
VisitorList<CompilationUnit> vList = new VisitorList<>(new ObjectIdentityHashCodeVisitor(), new ObjectIdentityEqualsVisitor());
vList.addAll(list);
vList.add(JavaParser.parse("class X{}"));
vList.retainAll(list);
assertTrue(vList.size() == 2);
}
use of com.github.javaparser.ast.visitor.ObjectIdentityEqualsVisitor in project javaparser by javaparser.
the class VisitorSetTest method visitorSetRemove.
@Test
public void visitorSetRemove() {
CompilationUnit x1 = JavaParser.parse("class X{}");
Set<CompilationUnit> set = new VisitorSet<>(new ObjectIdentityHashCodeVisitor(), new ObjectIdentityEqualsVisitor());
set.add(x1);
assertTrue(set.remove(x1));
}
use of com.github.javaparser.ast.visitor.ObjectIdentityEqualsVisitor in project javaparser by javaparser.
the class VisitorSetTest method visitorSetContains.
@Test
public void visitorSetContains() {
CompilationUnit x1 = JavaParser.parse("class X{}");
Set<CompilationUnit> set = new VisitorSet<>(new ObjectIdentityHashCodeVisitor(), new ObjectIdentityEqualsVisitor());
set.add(x1);
assertTrue(set.contains(x1));
}
use of com.github.javaparser.ast.visitor.ObjectIdentityEqualsVisitor in project javaparser by javaparser.
the class VisitorListTest method visitorListContainsAll.
@Test
public void visitorListContainsAll() {
List<CompilationUnit> list = new ArrayList<>();
list.add(JavaParser.parse("class X{}"));
list.add(JavaParser.parse("class X{}"));
VisitorList<CompilationUnit> vList = new VisitorList<>(new ObjectIdentityHashCodeVisitor(), new ObjectIdentityEqualsVisitor());
vList.addAll(list);
assertTrue(vList.size() == 2 && vList.containsAll(list));
}
Aggregations