Revision: 16692
          http://sourceforge.net/p/gate/code/16692
Author:   valyt
Date:     2013-05-23 16:06:58 +0000 (Thu, 23 May 2013)
Log Message:
-----------
Log result set differences to aid in identifying assertion failures during 
tests.

Modified Paths:
--------------
    mimir/trunk/mimir-test/src/gate/mimir/test/QueryTests.java

Modified: mimir/trunk/mimir-test/src/gate/mimir/test/QueryTests.java
===================================================================
--- mimir/trunk/mimir-test/src/gate/mimir/test/QueryTests.java  2013-05-23 
01:18:57 UTC (rev 16691)
+++ mimir/trunk/mimir-test/src/gate/mimir/test/QueryTests.java  2013-05-23 
16:06:58 UTC (rev 16692)
@@ -52,6 +52,7 @@
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.logging.Logger;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipFile;
 
@@ -67,6 +68,9 @@
   private static final String resultsPath = "reports/query-results";
   private static final String NEW_LINE = System.getProperty("line.separator");
 
+  private static Logger logger = Logger.getLogger(QueryTests.class.getName());
+  
+  
   public static final String[] helperTypes = System.getProperty(
     "helpers.to.test", "gate.mimir.db.DBSemanticAnnotationHelper").split(
       "\\s*,\\s*");
@@ -513,7 +517,7 @@
 
   /**
    * Compares the files resulting from the execution of two or more queries. 
-   * The queris must have been performed previously, by calling 
+   * The queries must have been performed previously, by calling 
    * {@link #performQuery(String, QueryNode, QueryEngine)}.
    * @param queryNames the names of the queries to compare.
    * @return
@@ -531,9 +535,19 @@
       for(int  i = 1; i < readers.length; i++) {
         String anotherLine = readers[i].readLine();
         if(line != null) {
-          if(anotherLine == null || !line.equals(anotherLine)) return false;
+          if(anotherLine == null || !line.equals(anotherLine)){
+            logger.warning("Assersion error: result sets not identical. " +
+                       "First difference:\n Line (0):" + line + 
+                       "\nLine (" + i + "):" + (anotherLine == null ? "null" : 
anotherLine));
+            return false;
+          }
         } else {
-          if(anotherLine != null) return false;
+          if(anotherLine != null){
+            logger.warning("Assersion error: result sets not identical. " +
+                    "First difference:\n Line (0): null" + line + 
+                    "\nLine (" + i + "):" + anotherLine);               
+            return false;
+          }
         }
       }
     } while(line != null);

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service 
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs

Reply via email to