From: tcofoegbu Date: Tue, 12 May 2015 10:37:40 +0000 (+0100) Subject: JAL_1641 updated test -- added test for annotations X-Git-Tag: Release_2_10_0~682^2 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=f3b869801edcd73a57ddbb6adbfa02d40652625d;p=jalview.git JAL_1641 updated test -- added test for annotations --- diff --git a/test/jalview/io/JSONFileTest.java b/test/jalview/io/JSONFileTest.java index 0f957ea..d2960d9 100644 --- a/test/jalview/io/JSONFileTest.java +++ b/test/jalview/io/JSONFileTest.java @@ -24,6 +24,8 @@ public class JSONFileTest private int TEST_GRP_HEIGHT = 0; + private int TEST_ANOT_HEIGHT = 0; + @Before public void setUp() throws Exception { @@ -123,6 +125,7 @@ public class JSONFileTest // Alignment al = new Alignment(seqs); TEST_SEQ_HEIGHT = jsonFile.seqs.size(); TEST_GRP_HEIGHT = jsonFile.seqGroups.size(); + TEST_ANOT_HEIGHT = jsonFile.annotations.size(); } @After @@ -171,8 +174,36 @@ public class JSONFileTest ++matchedCounter; } } - Assert.assertTrue(matchedCounter == TEST_GRP_HEIGHT); } + Assert.assertTrue(matchedCounter == TEST_GRP_HEIGHT); + + matchedCounter = 0; + for (AlignmentAnnotation in : jsonFile.annotations) + { + for (AlignmentAnnotation out : output.annotations) + { + try + { + // System.out.println("label >>>>> " + in.label + " | " + out.label); + // System.out.println("label >>>>> " + in.description + " | " + // + out.description); + // System.out.println("label >>>>> " + in.annotations.length + " | " + // + out.annotations.length); + if (in.label.equals(out.label) + && in.description.equals(out.description) + && in.annotations.length == out.annotations.length) + { + ++matchedCounter; + } + } catch (Exception e) + { + e.printStackTrace(); + } + } + } + // System.out.println("matched >>>>> " + matchedCounter + " | " + // + TEST_ANOT_HEIGHT); + Assert.assertTrue(matchedCounter == TEST_ANOT_HEIGHT); }