diff options
author | 2023-03-01 21:20:10 +0100 | |
---|---|---|
committer | 2023-03-01 21:20:10 +0100 | |
commit | 2bf484cd882949c53a82c40e28319f74ef8ae477 (patch) | |
tree | 083eb6793b0fc6fd77f402c51cd5579cfa4c56a2 /subprojects/store-query-viatra/src/test | |
parent | refactor: more direct access to VIATRA result set (diff) | |
download | refinery-2bf484cd882949c53a82c40e28319f74ef8ae477.tar.gz refinery-2bf484cd882949c53a82c40e28319f74ef8ae477.tar.zst refinery-2bf484cd882949c53a82c40e28319f74ef8ae477.zip |
refactor: use Cursor in query result sets
Diffstat (limited to 'subprojects/store-query-viatra/src/test')
-rw-r--r-- | subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/QueryTest.java | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/QueryTest.java b/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/QueryTest.java index 3dd517c4..8b25419d 100644 --- a/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/QueryTest.java +++ b/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/QueryTest.java | |||
@@ -1,6 +1,7 @@ | |||
1 | package tools.refinery.store.query.viatra; | 1 | package tools.refinery.store.query.viatra; |
2 | 2 | ||
3 | import org.junit.jupiter.api.Test; | 3 | import org.junit.jupiter.api.Test; |
4 | import tools.refinery.store.map.Cursor; | ||
4 | import tools.refinery.store.model.ModelStore; | 5 | import tools.refinery.store.model.ModelStore; |
5 | import tools.refinery.store.query.Dnf; | 6 | import tools.refinery.store.query.Dnf; |
6 | import tools.refinery.store.query.ModelQuery; | 7 | import tools.refinery.store.query.ModelQuery; |
@@ -14,7 +15,6 @@ import tools.refinery.store.tuple.TupleLike; | |||
14 | 15 | ||
15 | import java.util.HashSet; | 16 | import java.util.HashSet; |
16 | import java.util.Set; | 17 | import java.util.Set; |
17 | import java.util.stream.Stream; | ||
18 | 18 | ||
19 | import static org.junit.jupiter.api.Assertions.*; | 19 | import static org.junit.jupiter.api.Assertions.*; |
20 | import static tools.refinery.store.query.literal.Literals.not; | 20 | import static tools.refinery.store.query.literal.Literals.not; |
@@ -712,11 +712,10 @@ class QueryTest { | |||
712 | assertThrows(IllegalArgumentException.class, () -> queryBuilder.queries(predicate)); | 712 | assertThrows(IllegalArgumentException.class, () -> queryBuilder.queries(predicate)); |
713 | } | 713 | } |
714 | 714 | ||
715 | static void compareMatchSets(Stream<TupleLike> matchSet, Set<Tuple> expected) { | 715 | private static void compareMatchSets(Cursor<TupleLike, Boolean> cursor, Set<Tuple> expected) { |
716 | Set<Tuple> translatedMatchSet = new HashSet<>(); | 716 | Set<Tuple> translatedMatchSet = new HashSet<>(); |
717 | var iterator = matchSet.iterator(); | 717 | while (cursor.move()) { |
718 | while (iterator.hasNext()) { | 718 | var element = cursor.getKey(); |
719 | var element = iterator.next(); | ||
720 | translatedMatchSet.add(element.toTuple()); | 719 | translatedMatchSet.add(element.toTuple()); |
721 | } | 720 | } |
722 | assertEquals(expected, translatedMatchSet); | 721 | assertEquals(expected, translatedMatchSet); |