aboutsummaryrefslogtreecommitdiffstats
path: root/subprojects/store-query/src/testFixtures/java/tools/refinery/store/query/tests/QueryMatchers.java
diff options
context:
space:
mode:
Diffstat (limited to 'subprojects/store-query/src/testFixtures/java/tools/refinery/store/query/tests/QueryMatchers.java')
-rw-r--r--subprojects/store-query/src/testFixtures/java/tools/refinery/store/query/tests/QueryMatchers.java27
1 files changed, 27 insertions, 0 deletions
diff --git a/subprojects/store-query/src/testFixtures/java/tools/refinery/store/query/tests/QueryMatchers.java b/subprojects/store-query/src/testFixtures/java/tools/refinery/store/query/tests/QueryMatchers.java
index 8706ef70..cd449a6a 100644
--- a/subprojects/store-query/src/testFixtures/java/tools/refinery/store/query/tests/QueryMatchers.java
+++ b/subprojects/store-query/src/testFixtures/java/tools/refinery/store/query/tests/QueryMatchers.java
@@ -7,13 +7,40 @@ package tools.refinery.store.query.tests;
7 7
8import org.hamcrest.Matcher; 8import org.hamcrest.Matcher;
9import tools.refinery.store.query.dnf.Dnf; 9import tools.refinery.store.query.dnf.Dnf;
10import tools.refinery.store.query.dnf.SymbolicParameter;
11import tools.refinery.store.query.literal.Literal;
12
13import java.util.List;
10 14
11public final class QueryMatchers { 15public final class QueryMatchers {
12 private QueryMatchers() { 16 private QueryMatchers() {
13 throw new IllegalStateException("This is a static utility class and should not be instantiated directly"); 17 throw new IllegalStateException("This is a static utility class and should not be instantiated directly");
14 } 18 }
15 19
20 /**
21 * Compare two {@link Dnf} instances up to renaming of variables.
22 *
23 * @param expected The expected {@link Dnf} instance.
24 * @return A Hamcrest matcher for equality up to renaming of variables.
25 */
16 public static Matcher<Dnf> structurallyEqualTo(Dnf expected) { 26 public static Matcher<Dnf> structurallyEqualTo(Dnf expected) {
17 return new StructurallyEqualTo(expected); 27 return new StructurallyEqualTo(expected);
18 } 28 }
29
30 /**
31 * Compare a {@link Dnf} instance to another predicate in DNF form without constructing it.
32 * <p>
33 * This matcher should be used instead of {@link #structurallyEqualTo(Dnf)} when the validation and
34 * pre-processing associated with the {@link Dnf} constructor, i.e., validation of parameter directions,
35 * topological sorting of literals, and the reduction of trivial predicates is not desired. In particular, this
36 * matcher can be used to test for exact order of literal after pre-processing.
37 *
38 * @param expectedSymbolicParameters The expected list of symbolic parameters.
39 * @param expectedLiterals The expected clauses. Each clause is represented by a list of literals.
40 * @return A Hamcrest matcher for equality up to renaming of variables.
41 */
42 public static Matcher<Dnf> structurallyEqualTo(List<SymbolicParameter> expectedSymbolicParameters,
43 List<? extends List<? extends Literal>> expectedLiterals) {
44 return new StructurallyEqualToRaw(expectedSymbolicParameters, expectedLiterals);
45 }
19} 46}