Modify the test framework to actually diff between expected and actual files.

git-svn-id: https://asterixdb.googlecode.com/svn/branches/asterix_stabilization_api_cleanup@1492 eaa15691-b419-025a-1212-ee371bd00084
diff --git a/asterix-app/src/test/java/edu/uci/ics/asterix/test/aql/TestsUtils.java b/asterix-app/src/test/java/edu/uci/ics/asterix/test/aql/TestsUtils.java
index b10b42a..1555549 100644
--- a/asterix-app/src/test/java/edu/uci/ics/asterix/test/aql/TestsUtils.java
+++ b/asterix-app/src/test/java/edu/uci/ics/asterix/test/aql/TestsUtils.java
@@ -54,10 +54,13 @@
 
         try {
             while ((lineExpected = readerExpected.readLine()) != null) {
-                // Skipe the blank line in the expected file.
+                // Skip the blank line in the expected file.
                 if (lineExpected.isEmpty()) {
                     continue;
                 }
+                if (jArray.length() <= chunkCounter) {
+                    throw new Exception("No more results available.");
+                }
                 JSONArray resultArray = jArray.getJSONArray(chunkCounter);
 
                 if ((lineActual = resultArray.getString(recordCounter)) == null) {
@@ -74,15 +77,8 @@
                 if (recordCounter >= resultArray.length()) {
                     chunkCounter++;
                     recordCounter = 0;
-                    if (chunkCounter >= jArray.length()) {
-                        break;
-                    }
                 }
             }
-
-            while ((lineExpected = readerExpected.readLine()) != null) {
-                // TODO(khurram): Print out the remaining expected file contents
-            }
         } finally {
             readerExpected.close();
         }