You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by yo...@apache.org on 2010/10/17 16:42:54 UTC

svn commit: r1023509 - /lucene/dev/trunk/solr/src/test/org/apache/solr/JSONTestUtil.java

Author: yonik
Date: Sun Oct 17 14:42:53 2010
New Revision: 1023509

URL: http://svn.apache.org/viewvc?rev=1023509&view=rev
Log:
tests: jsontest - allow asserting that a path does not exist

Modified:
    lucene/dev/trunk/solr/src/test/org/apache/solr/JSONTestUtil.java

Modified: lucene/dev/trunk/solr/src/test/org/apache/solr/JSONTestUtil.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/src/test/org/apache/solr/JSONTestUtil.java?rev=1023509&r1=1023508&r2=1023509&view=diff
==============================================================================
--- lucene/dev/trunk/solr/src/test/org/apache/solr/JSONTestUtil.java (original)
+++ lucene/dev/trunk/solr/src/test/org/apache/solr/JSONTestUtil.java Sun Oct 17 14:42:53 2010
@@ -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;