Skip to content

Commit

Permalink
create dedup testl
Browse files Browse the repository at this point in the history
  • Loading branch information
otaviojava committed Jul 19, 2019
1 parent b002a98 commit d4b98a5
Showing 1 changed file with 25 additions and 0 deletions.
Expand Up @@ -21,6 +21,7 @@
import org.jnosql.artemis.graph.model.Book;
import org.jnosql.artemis.graph.model.Person;
import jakarta.nosql.NonUniqueResultException;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;

Expand Down Expand Up @@ -468,4 +469,28 @@ public void shouldPredicate() {
.filter(Person::isAdult).count();
assertEquals(3L, count);
}

@Test
public void shouldDedup() {

graphTemplate.edge(otavio, "knows", paulo);
graphTemplate.edge(paulo, "knows", otavio);
graphTemplate.edge(otavio, "knows", poliana);
graphTemplate.edge(poliana, "knows", otavio);
graphTemplate.edge(poliana, "knows", paulo);
graphTemplate.edge(paulo, "knows", poliana);

List<Person> people = graphTemplate.getTraversalVertex()
.hasLabel(Person.class)
.in("knows").getResultList();

assertEquals(6, people.size());

people = graphTemplate.getTraversalVertex()
.hasLabel(Person.class)
.in("knows").dedup()
.getResultList();

assertEquals(3, people.size());
}
}

0 comments on commit d4b98a5

Please sign in to comment.