Java Code Examples for com.baidu.hugegraph.testutil.Assert#assertTrue()

The following examples show how to use com.baidu.hugegraph.testutil.Assert#assertTrue() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: VertexLabelTest.java    From hugegraph-client with Apache License 2.0 6 votes vote down vote up
@Test
public void testAddVertexLabelWithUserData() {
    SchemaManager schema = schema();

    VertexLabel player = schema.vertexLabel("player")
                               .properties("name")
                               .userdata("super_vl", "person")
                               .create();
    Assert.assertEquals(2, player.userdata().size());
    Assert.assertEquals("person", player.userdata().get("super_vl"));
    String time = (String) player.userdata().get("~create_time");
    Date createTime = DateUtil.parse(time);
    Assert.assertTrue(createTime.before(DateUtil.now()));

    VertexLabel runner = schema.vertexLabel("runner")
                               .properties("name")
                               .userdata("super_vl", "person")
                               .userdata("super_vl", "player")
                               .create();
    // The same key user data will be overwritten
    Assert.assertEquals(2, runner.userdata().size());
    Assert.assertEquals("player", runner.userdata().get("super_vl"));
    time = (String) runner.userdata().get("~create_time");
    createTime = DateUtil.parse(time);
    Assert.assertTrue(createTime.before(DateUtil.now()));
}
 
Example 2
Source File: RolePermissionTest.java    From hugegraph with Apache License 2.0 6 votes vote down vote up
@Test
public void testHugeResourceFilter() {
    HugeResource all = HugeResource.ALL;

    // common
    ResourceObject<?> r1 = ResourceObject.of("g1", ResourceType.GREMLIN,
                                             NameObject.ANY);
    Assert.assertTrue(all.filter(r1));

    ResourceObject<?> r2 = ResourceObject.of("g1", ResourceType.META,
                                             NameObject.of("test"));
    Assert.assertTrue(all.filter(r2));

    HugeResource page = new HugeResource(ResourceType.META,
                                         "page", null);
    Assert.assertFalse(page.filter(r2));

    ResourceObject<?> r3 = ResourceObject.of("g1", ResourceType.META,
                                             NameObject.of("page"));
    Assert.assertTrue(page.filter(r3));
}
 
Example 3
Source File: CollectionUtilTest.java    From hugegraph-common with Apache License 2.0 6 votes vote down vote up
@Test
public void testHasIntersectionBetweenListAndSet() {
    List<Integer> first = new ArrayList<>();
    first.add(1);
    first.add(2);
    first.add(3);

    Set<Integer> second = new HashSet<>();
    Assert.assertFalse(CollectionUtil.hasIntersection(first, second));

    second.add(4);
    Assert.assertFalse(CollectionUtil.hasIntersection(first, second));

    second.add(1);
    Assert.assertTrue(CollectionUtil.hasIntersection(first, second));
}
 
Example 4
Source File: EventHubTest.java    From hugegraph-common with Apache License 2.0 6 votes vote down vote up
@Test
public void testEventRemoveListener() {
    final String event = "event-test";

    EventListener listener = new EventListener() {
        @Override
        public Object event(Event arg0) {
            return null;
        }
    };

    this.eventHub.listen(event, listener);

    Assert.assertTrue(this.eventHub.containsListener(event));
    Assert.assertEquals(1, this.eventHub.listeners(event).size());
    Assert.assertEquals(listener, this.eventHub.listeners(event).get(0));

    Assert.assertEquals(1, this.eventHub.unlisten(event, listener));

    Assert.assertFalse(this.eventHub.containsListener(event));
    Assert.assertEquals(0, this.eventHub.listeners(event).size());
}
 
Example 5
Source File: RingsRaysApiTest.java    From hugegraph-client with Apache License 2.0 6 votes vote down vote up
@Test
public void testRays() {
    Object markoId = getVertexId("person", "name", "marko");
    Object joshId = getVertexId("person", "name", "josh");
    Object vadasId = getVertexId("person", "name", "vadas");
    Object lopId = getVertexId("software", "name", "lop");
    Object rippleId = getVertexId("software", "name", "ripple");

    List<Path> paths = raysAPI.get(markoId, Direction.OUT, null,
                                   2, -1L, -1L, -1L);
    Assert.assertEquals(4, paths.size());
    List<Object> path1 = ImmutableList.of(markoId, lopId);
    List<Object> path2 = ImmutableList.of(markoId, vadasId);
    List<Object> path3 = ImmutableList.of(markoId, joshId, rippleId);
    List<Object> path4 = ImmutableList.of(markoId, joshId, lopId);
    List<List<Object>> expectedPaths = ImmutableList.of(path1, path2,
                                                        path3, path4);
    Assert.assertTrue(expectedPaths.contains(paths.get(0).objects()));
    Assert.assertTrue(expectedPaths.contains(paths.get(1).objects()));
    Assert.assertTrue(expectedPaths.contains(paths.get(2).objects()));
    Assert.assertTrue(expectedPaths.contains(paths.get(3).objects()));
}
 
Example 6
Source File: VariablesApiTest.java    From hugegraph-client with Apache License 2.0 6 votes vote down vote up
private static void assertContains(Map<String, Object> variables,
                                   String key, Object value) {
    Assert.assertTrue(variables.containsKey(key));

    if (variables.get(key) instanceof Collection) {
        Assert.assertTrue(value instanceof Collection);
        Collection<?> expect = (Collection<?>) value;
        Collection<?> actual = (Collection<?>) variables.get(key);
        Assert.assertTrue(expect.size()== actual.size());
        actual.forEach(elem -> {
            Assert.assertTrue((expect.contains(elem)));
        });
    } else {
        Assert.assertTrue(variables.get(key).equals(value));
    }
}
 
Example 7
Source File: FileLoadTest.java    From hugegraph-loader with Apache License 2.0 6 votes vote down vote up
@Test
public void testVertexPkContainsSpecicalSymbol() {
    ioUtil.write("vertex_person.csv",
                 "name,age,city",
                 "mar:ko!,29,Beijing");

    String[] args = new String[]{
            "-f", structPath("vertex_pk_contains_special_symbol/struct.json"),
            "-s", configPath("vertex_pk_contains_special_symbol/schema.groovy"),
            "-g", GRAPH,
            "-h", SERVER,
            "--batch-insert-threads", "2",
            "--test-mode", "true"
    };
    HugeGraphLoader.main(args);

    List<Vertex> vertices = CLIENT.graph().listVertices();
    Assert.assertEquals(1, vertices.size());
    Vertex vertex = vertices.get(0);
    Assert.assertEquals(String.class, vertex.id().getClass());
    Assert.assertTrue(((String) vertex.id()).contains(":mar`:ko`!"));
    Assert.assertEquals(29, vertex.property("age"));
    Assert.assertEquals("Beijing", vertex.property("city"));
}
 
Example 8
Source File: VertexLabelApiTest.java    From hugegraph-client with Apache License 2.0 6 votes vote down vote up
@Test
public void testAddVertexLabelWithUserData() {
    VertexLabel player = schema().vertexLabel("player")
                                 .properties("name")
                                 .userdata("super_vl", "person")
                                 .build();
    player = vertexLabelAPI.create(player);
    Assert.assertEquals(2, player.userdata().size());
    Assert.assertEquals("person", player.userdata().get("super_vl"));
    String time = (String) player.userdata().get("~create_time");
    Date createTime = DateUtil.parse(time);
    Assert.assertTrue(createTime.before(DateUtil.now()));

    VertexLabel runner = schema().vertexLabel("runner")
                                 .properties("name")
                                 .userdata("super_vl", "person")
                                 .userdata("super_vl", "player")
                                 .build();
    runner = vertexLabelAPI.create(runner);
    // The same key user data will be overwritten
    Assert.assertEquals(2, runner.userdata().size());
    Assert.assertEquals("player", runner.userdata().get("super_vl"));
    time = (String) runner.userdata().get("~create_time");
    createTime = DateUtil.parse(time);
    Assert.assertTrue(createTime.before(DateUtil.now()));
}
 
Example 9
Source File: PropertyKeyTest.java    From hugegraph-client with Apache License 2.0 6 votes vote down vote up
@Test
public void testEliminatePropertyKeyWithUserData() {
    SchemaManager schema = schema();
    PropertyKey age = schema.propertyKey("age")
                            .userdata("min", 0)
                            .userdata("max", 100)
                            .create();
    Assert.assertEquals(3, age.userdata().size());
    Assert.assertEquals(0, age.userdata().get("min"));
    Assert.assertEquals(100, age.userdata().get("max"));
    String time = (String) age.userdata().get("~create_time");
    Date createTime = DateUtil.parse(time);
    Assert.assertTrue(createTime.before(DateUtil.now()));

    age = schema.propertyKey("age")
                .userdata("max", "")
                .eliminate();
    Assert.assertEquals(2, age.userdata().size());
    Assert.assertEquals(0, age.userdata().get("min"));
    time = (String) age.userdata().get("~create_time");
    Assert.assertEquals(createTime, DateUtil.parse(time));
}
 
Example 10
Source File: PropertyKeyTest.java    From hugegraph-client with Apache License 2.0 6 votes vote down vote up
@Test
public void testAppendPropertyKeyWithUserData() {
    SchemaManager schema = schema();
    PropertyKey age = schema.propertyKey("age")
                            .userdata("min", 0)
                            .create();
    Assert.assertEquals(2, age.userdata().size());
    Assert.assertEquals(0, age.userdata().get("min"));
    String time = (String) age.userdata().get("~create_time");
    Date createTime = DateUtil.parse(time);
    Assert.assertTrue(createTime.before(DateUtil.now()));

    age = schema.propertyKey("age")
                .userdata("min", 1)
                .userdata("max", 100)
                .append();
    Assert.assertEquals(3, age.userdata().size());
    Assert.assertEquals(1, age.userdata().get("min"));
    Assert.assertEquals(100, age.userdata().get("max"));
    time = (String) age.userdata().get("~create_time");
    Assert.assertEquals(createTime, DateUtil.parse(time));
}
 
Example 11
Source File: FileLoadTest.java    From hugegraph-loader with Apache License 2.0 6 votes vote down vote up
@Test
public void testVertexJointPrimaryKeys() {
    ioUtil.write("vertex_person.csv",
                 "name,age,city",
                 "marko,29,Beijing");

    String[] args = new String[]{
            "-f", structPath("vertex_joint_pks/struct.json"),
            "-s", configPath("vertex_joint_pks/schema.groovy"),
            "-g", GRAPH,
            "-h", SERVER,
            "--test-mode", "true"
    };
    HugeGraphLoader.main(args);

    List<Vertex> vertices = CLIENT.graph().listVertices();

    Assert.assertEquals(1, vertices.size());
    Vertex vertex = vertices.get(0);

    Assert.assertTrue(vertex.id().toString().contains("marko!Beijing"));
    Assert.assertEquals("person", vertex.label());
    Assert.assertEquals("marko", vertex.property("name"));
    Assert.assertEquals(29, vertex.property("age"));
    Assert.assertEquals("Beijing", vertex.property("city"));
}
 
Example 12
Source File: FilterIteratorTest.java    From hugegraph-common with Apache License 2.0 5 votes vote down vote up
@Test
public void testClose() throws Exception {
    CloseableItor<Integer> vals = new CloseableItor<>(DATA.iterator());

    FilterIterator<Integer> results = new FilterIterator<>(vals,
                                                           val -> true);

    Assert.assertFalse(vals.closed());
    results.close();
    Assert.assertTrue(vals.closed());
}
 
Example 13
Source File: ConditionTest.java    From hugegraph with Apache License 2.0 5 votes vote down vote up
@Test
public void testConditionScan() {
    Condition c1 = Condition.scan("abc", "axy");
    Assert.assertTrue(c1.test("abc"));
    Assert.assertTrue(c1.test("abd"));
    Assert.assertTrue(c1.test("abz"));
    Assert.assertTrue(c1.test("axx"));
    // test of scan will return true for any case
    Assert.assertTrue(c1.test("abb"));
    Assert.assertTrue(c1.test("axy"));
    Assert.assertTrue(c1.test("axz"));
    Assert.assertTrue(c1.test((Object) null));
}
 
Example 14
Source File: ListIteratorTest.java    From hugegraph-common with Apache License 2.0 5 votes vote down vote up
@Test
public void testHasNextAndNext() {
    Iterator<Integer> results = new ListIterator<>(-1, DATA1.iterator());
    Assert.assertTrue(results.hasNext());
    Assert.assertTrue(results.hasNext());
    Assert.assertEquals(1, (int) results.next());
    Assert.assertFalse(results.hasNext());
    Assert.assertFalse(results.hasNext());
    Assert.assertThrows(NoSuchElementException.class, () -> {
        results.next();
    });
}
 
Example 15
Source File: RolePermissionTest.java    From hugegraph with Apache License 2.0 5 votes vote down vote up
@Test
public void testHugeResourceFilterUser() {
    HugeResource all = HugeResource.ALL;

    // user
    ResourceObject<?> r3 = ResourceObject.of("g1", ResourceType.USER_GROUP,
                                             NameObject.ANY);
    Assert.assertFalse(all.filter(r3));

    HugeResource user = new HugeResource(ResourceType.USER_GROUP,
                                         HugeResource.ANY, null);
    Assert.assertTrue(user.filter(r3));

    ResourceObject<?> r4 = ResourceObject.of("g1", new HugeUser("fake"));
    Assert.assertTrue(user.filter(r4));

    HugeResource user2 = new HugeResource(ResourceType.USER_GROUP,
                                          "bj-.*", null);
    Assert.assertTrue(user2.filter(r3));
    Assert.assertFalse(user2.filter(r4));

    HugeResource user3 = new HugeResource(ResourceType.USER_GROUP,
                                          "fa.*", null);
    Assert.assertTrue(user3.filter(r3));
    Assert.assertTrue(user3.filter(r4));

    ResourceObject<?> r5 = ResourceObject.of("g1", new HugeTarget("g", ""));
    Assert.assertFalse(user.filter(r5));

    HugeResource root = new HugeResource(ResourceType.ROOT,
                                         HugeResource.ANY, null);
    Assert.assertTrue(root.filter(r3));
    Assert.assertTrue(root.filter(r4));
    Assert.assertTrue(root.filter(r5));
}
 
Example 16
Source File: LoadTest.java    From hugegraph-loader with Apache License 2.0 5 votes vote down vote up
protected static void assertContains(List<Vertex> vertices, String label,
                                     Object... keyValues) {
    boolean matched = false;
    for (Vertex v : vertices) {
        if (v.label().equals(label) &&
            v.properties().equals(toMap(keyValues))) {
            matched = true;
            break;
        }
    }
    Assert.assertTrue(matched);
}
 
Example 17
Source File: ConditionTest.java    From hugegraph with Apache License 2.0 4 votes vote down vote up
@Test
public void testConditionEqWithUserprop() {
    Condition c1 = Condition.eq(IdGenerator.of("1"), "123");

    Assert.assertEquals("1 == 123", c1.toString());

    Assert.assertTrue(c1.isRelation());
    Assert.assertFalse(c1.isSysprop());
    Assert.assertTrue(c1.isFlattened());
    Assert.assertFalse(c1.isLogic());
    Assert.assertTrue(c1.test("123"));
    Assert.assertFalse(c1.test("1234"));
    Assert.assertFalse(c1.test(123));
    Assert.assertFalse(c1.test(new Date(123)));
    Assert.assertFalse(c1.test((Object) null));

    Relation r1 = (Relation) c1;
    Assert.assertEquals(IdGenerator.of("1"), r1.key());
    Assert.assertEquals("123", r1.value());
    Assert.assertEquals("123", r1.serialValue());
    Assert.assertEquals(RelationType.EQ, r1.relation());
    Assert.assertTrue(r1.test("123"));

    Relation r2 = (Relation) c1.copy();
    Assert.assertEquals(r1, r2);
    Assert.assertEquals(IdGenerator.of("1"), r2.key());
    Assert.assertEquals("123", r2.value());
    Assert.assertEquals("123", r2.serialValue());
    Assert.assertEquals(RelationType.EQ, r2.relation());
    Assert.assertTrue(r2.test("123"));

    r2.serialValue("1234");
    Assert.assertEquals("1234", r2.serialValue());
    Assert.assertEquals("123", r1.serialValue());
    Assert.assertTrue(r2.test("123"));

    Assert.assertThrows(IllegalArgumentException.class, () -> {
        Condition.eq(IdGenerator.of("1"), null).test("any");
    }, e -> {
        Assert.assertEquals("Can't test null value for `==`",
                            e.getMessage());
    });
}
 
Example 18
Source File: PropertyKeyApiTest.java    From hugegraph-client with Apache License 2.0 4 votes vote down vote up
@Test
public void testCreateWithAggregateType() {
    PropertyKey propertyKey = schema().propertyKey("name")
                                      .asText().valueSingle()
                                      .build();

    propertyKey = propertyKeyAPI.create(propertyKey);

    Assert.assertEquals("name", propertyKey.name());
    Assert.assertEquals(DataType.TEXT, propertyKey.dataType());
    Assert.assertEquals(Cardinality.SINGLE, propertyKey.cardinality());
    Assert.assertEquals(AggregateType.NONE, propertyKey.aggregateType());
    Assert.assertTrue(propertyKey.aggregateType().isNone());
    Assert.assertFalse(propertyKey.aggregateType().isNumber());
    Assert.assertTrue(propertyKey.aggregateType().isIndexable());

    propertyKey = schema().propertyKey("no")
                          .asText().valueSingle()
                          .calcOld()
                          .build();

    propertyKey = propertyKeyAPI.create(propertyKey);

    Assert.assertEquals("no", propertyKey.name());
    Assert.assertEquals(DataType.TEXT, propertyKey.dataType());
    Assert.assertEquals(Cardinality.SINGLE, propertyKey.cardinality());
    Assert.assertEquals(AggregateType.OLD, propertyKey.aggregateType());
    Assert.assertTrue(propertyKey.aggregateType().isOld());
    Assert.assertTrue(propertyKey.aggregateType().isIndexable());
    Assert.assertFalse(propertyKey.aggregateType().isNumber());

    propertyKey = schema().propertyKey("max")
                          .asInt().valueSingle()
                          .calcMax()
                          .build();

    propertyKey = propertyKeyAPI.create(propertyKey);

    Assert.assertEquals("max", propertyKey.name());
    Assert.assertEquals(DataType.INT, propertyKey.dataType());
    Assert.assertEquals(Cardinality.SINGLE, propertyKey.cardinality());
    Assert.assertEquals(AggregateType.MAX, propertyKey.aggregateType());
    Assert.assertTrue(propertyKey.aggregateType().isMax());
    Assert.assertTrue(propertyKey.aggregateType().isIndexable());
    Assert.assertTrue(propertyKey.aggregateType().isNumber());

    propertyKey = schema().propertyKey("min")
                          .asInt().valueSingle()
                          .calcMin()
                          .build();

    propertyKey = propertyKeyAPI.create(propertyKey);

    Assert.assertEquals("min", propertyKey.name());
    Assert.assertEquals(DataType.INT, propertyKey.dataType());
    Assert.assertEquals(Cardinality.SINGLE, propertyKey.cardinality());
    Assert.assertEquals(AggregateType.MIN, propertyKey.aggregateType());
    Assert.assertTrue(propertyKey.aggregateType().isMin());
    Assert.assertTrue(propertyKey.aggregateType().isIndexable());
    Assert.assertTrue(propertyKey.aggregateType().isNumber());

    propertyKey = schema().propertyKey("sum")
                          .asInt().valueSingle()
                          .calcSum()
                          .build();

    propertyKey = propertyKeyAPI.create(propertyKey);

    Assert.assertEquals("sum", propertyKey.name());
    Assert.assertEquals(DataType.INT, propertyKey.dataType());
    Assert.assertEquals(Cardinality.SINGLE, propertyKey.cardinality());
    Assert.assertEquals(AggregateType.SUM, propertyKey.aggregateType());
    Assert.assertTrue(propertyKey.aggregateType().isSum());
    Assert.assertFalse(propertyKey.aggregateType().isIndexable());
    Assert.assertTrue(propertyKey.aggregateType().isNumber());

    propertyKey = schema().propertyKey("total")
                          .asInt().valueSingle()
                          .aggregateType(AggregateType.SUM)
                          .build();

    propertyKey = propertyKeyAPI.create(propertyKey);

    Assert.assertEquals("total", propertyKey.name());
    Assert.assertEquals(DataType.INT, propertyKey.dataType());
    Assert.assertEquals(Cardinality.SINGLE, propertyKey.cardinality());
    Assert.assertEquals(AggregateType.SUM, propertyKey.aggregateType());
    Assert.assertTrue(propertyKey.aggregateType().isSum());
    Assert.assertFalse(propertyKey.aggregateType().isIndexable());
    Assert.assertTrue(propertyKey.aggregateType().isNumber());

    propertyKey = schema().propertyKey("nameV46")
                          .asText().valueSingle()
                          .build();
    PropertyKey.PropertyKeyV46 pk = propertyKey.switchV46();
    Assert.assertEquals("nameV46", pk.name());
    Assert.assertEquals(DataType.TEXT, pk.dataType());
    Assert.assertEquals(Cardinality.SINGLE, pk.cardinality());
}
 
Example 19
Source File: RingsRaysApiTest.java    From hugegraph-client with Apache License 2.0 4 votes vote down vote up
@Test
public void testRaysWithBoth() {
    Object markoId = getVertexId("person", "name", "marko");
    Object joshId = getVertexId("person", "name", "josh");
    Object vadasId = getVertexId("person", "name", "vadas");
    Object peterId = getVertexId("person", "name", "peter");
    Object lopId = getVertexId("software", "name", "lop");
    Object rippleId = getVertexId("software", "name", "ripple");

    List<Path> paths = raysAPI.get(markoId, Direction.BOTH, null,
                                   1, -1L, -1L, -1L);
    Assert.assertEquals(3, paths.size());
    List<Object> path1 = ImmutableList.of(markoId, lopId);
    List<Object> path2 = ImmutableList.of(markoId, vadasId);
    List<Object> path3 = ImmutableList.of(markoId, joshId);
    List<List<Object>> expectedPaths = ImmutableList.of(path1, path2,
                                                        path3);
    Assert.assertTrue(expectedPaths.contains(paths.get(0).objects()));
    Assert.assertTrue(expectedPaths.contains(paths.get(1).objects()));
    Assert.assertTrue(expectedPaths.contains(paths.get(2).objects()));

    paths = raysAPI.get(markoId, Direction.BOTH, null,
                        2, -1L, -1L, -1L);
    Assert.assertEquals(5, paths.size());
    List<Object> path4 = ImmutableList.of(markoId, vadasId);
    List<Object> path5 = ImmutableList.of(markoId, lopId, joshId);
    List<Object> path6 = ImmutableList.of(markoId, lopId, peterId);
    List<Object> path7 = ImmutableList.of(markoId, joshId, lopId);
    List<Object> path8 = ImmutableList.of(markoId, joshId, rippleId);
    expectedPaths = ImmutableList.of(path4, path5, path6, path7, path8);
    Assert.assertTrue(expectedPaths.contains(paths.get(0).objects()));
    Assert.assertTrue(expectedPaths.contains(paths.get(1).objects()));
    Assert.assertTrue(expectedPaths.contains(paths.get(2).objects()));
    Assert.assertTrue(expectedPaths.contains(paths.get(3).objects()));
    Assert.assertTrue(expectedPaths.contains(paths.get(4).objects()));

    paths = raysAPI.get(markoId, Direction.BOTH, null,
                        3, -1L, -1L, -1L);
    Assert.assertEquals(5, paths.size());
    List<Object> path9 = ImmutableList.of(markoId, vadasId);
    List<Object> path10 = ImmutableList.of(markoId, joshId, rippleId);
    List<Object> path11 = ImmutableList.of(markoId, lopId, peterId);
    List<Object> path12 = ImmutableList.of(markoId, joshId, lopId, peterId);
    List<Object> path13 = ImmutableList.of(markoId, lopId,
                                           joshId, rippleId);
    expectedPaths = ImmutableList.of(path9, path10, path11, path12, path13);
    Assert.assertTrue(expectedPaths.contains(paths.get(0).objects()));
    Assert.assertTrue(expectedPaths.contains(paths.get(1).objects()));
    Assert.assertTrue(expectedPaths.contains(paths.get(2).objects()));
    Assert.assertTrue(expectedPaths.contains(paths.get(3).objects()));
    Assert.assertTrue(expectedPaths.contains(paths.get(4).objects()));
}
 
Example 20
Source File: ListIteratorTest.java    From hugegraph-common with Apache License 2.0 3 votes vote down vote up
@Test
public void testClose() throws Exception {
    CloseableItor<Integer> c1 = new CloseableItor<>(DATA1.iterator());

    ListIterator<Integer> results = new ListIterator<>(-1, c1);

    Assert.assertFalse(c1.closed());

    results.close();

    Assert.assertTrue(c1.closed());
}