Apache Lucene open-source search software
tests: jsontest - allow asserting that a path does not exist
Yonik Seeley613f758c922f
diff --git a/solr/src/test/org/apache/solr/JSONTestUtil.java b/solr/src/test/org/apache/solr/JSONTestUtil.javaindex 5879b81af30..2eef7d6380a 100644--- a/solr/src/test/org/apache/solr/JSONTestUtil.java+++ b/solr/src/test/org/apache/solr/JSONTestUtil.java@@ -53,10 +53,12 @@ public class JSONTestUtil {public static String matchObj(String path, Object input, Object expected) throws Exception {CollectionTester tester = new CollectionTester(input);- if (!tester.seek(path)) {+ boolean reversed = path.startsWith("!");+ String positivePath = reversed ? path.substring(1) : path;+ if (!tester.seek(positivePath) ^ reversed) {return "Path not found: " + path;}- if (expected != null && !tester.match(expected)) {+ if (expected != null && (!tester.match(expected) ^ reversed)) {return tester.err + " @ " + tester.getPath();}return null;