Updated BioJsHTMLOutputTest asserts to include error messages for failed Assertions
authortcofoegbu <tcnofoegbu@dundee.ac.uk>
Thu, 26 Mar 2015 12:49:15 +0000 (12:49 +0000)
committertcofoegbu <tcnofoegbu@dundee.ac.uk>
Thu, 26 Mar 2015 12:49:15 +0000 (12:49 +0000)
test/jalview/io/BioJsHTMLOutputTest.java

index 694419f..514cce0 100644 (file)
@@ -43,7 +43,7 @@ public class BioJsHTMLOutputTest
 
       JSONObject actualJsonObj = (JSONObject) jsonParser.parse(actualJsonString);
 
-      System.out.println("Output : " + actualJsonString);
+      // System.out.println("Output : " + actualJsonString);
       Assert.assertTrue(actualJsonObj.get("globalColorScheme") != null); 
       Assert.assertTrue((actualJsonObj.get("globalColorScheme").toString()).equals("zappo")); 
       
@@ -60,26 +60,34 @@ public class BioJsHTMLOutputTest
       JSONObject jsonSeq = jsonIter.next();
       Assert.assertTrue(jsonSeq != null);
 
-      Assert.assertTrue(jsonSeq.get("name") != null);
-      Assert.assertTrue((jsonSeq.get("name").toString())
+      Assert.assertTrue("'name' cannot be null!",
+              jsonSeq.get("name") != null);
+      Assert.assertTrue("Expected name mismatched!",
+              (jsonSeq.get("name").toString())
               .equals("name/1-26"));
 
-      Assert.assertTrue(jsonSeq.get("seq") != null);
-      Assert.assertTrue((jsonSeq.get("seq").toString())
+      Assert.assertTrue("'seq' cannot be null!", jsonSeq.get("seq") != null);
+      Assert.assertTrue("Expected sequence mismatched!", (jsonSeq
+              .get("seq").toString())
               .equals("ABCDEFGHIJKLMNOPQRSTUVWXYZ"));
 
-      Assert.assertTrue(jsonSeq.get("id") != null);
-      Assert.assertTrue((jsonSeq.get("id").toString()).equals("1"));
+      Assert.assertTrue("'id' cannot be null!", jsonSeq.get("id") != null);
+      Assert.assertTrue("Expected id mismatched!",
+              (jsonSeq.get("id").toString()).equals("1"));
 
-      Assert.assertTrue(jsonSeq.get("start") != null);
-      Assert.assertTrue((jsonSeq.get("start").toString()).equals("1"));
+      Assert.assertTrue("'start' cannot be null!",
+              jsonSeq.get("start") != null);
+      Assert.assertTrue("Expected start mismatched!",
+              (jsonSeq.get("start").toString()).equals("1"));
 
-      Assert.assertTrue(jsonSeq.get("end") != null);
-      Assert.assertTrue((jsonSeq.get("end").toString()).equals("26"));
-
-      Assert.assertTrue(jsonSeq.get("features") != null);
-      Assert.assertTrue(jsonSeq.get("features").toString().equals("[]"));
+      Assert.assertTrue("'end' cannot be null!", jsonSeq.get("end") != null);
+      Assert.assertTrue("Expected end mismatched!",
+              (jsonSeq.get("end").toString()).equals("26"));
 
+      Assert.assertTrue("'features' cannot be null!",
+              jsonSeq.get("features") != null);
+      Assert.assertTrue("Expected features mismatched!",
+              jsonSeq.get("features").toString().equals("[]"));
 
     } catch (IOException e)
     {