JAL-653 test for SequenceDummy methods
authorJim Procter <jprocter@issues.jalview.org>
Sat, 6 Jun 2015 16:54:34 +0000 (17:54 +0100)
committerJim Procter <jprocter@issues.jalview.org>
Sat, 6 Jun 2015 16:54:34 +0000 (17:54 +0100)
test/jalview/datamodel/SequenceDummyTest.java [new file with mode: 0644]

diff --git a/test/jalview/datamodel/SequenceDummyTest.java b/test/jalview/datamodel/SequenceDummyTest.java
new file mode 100644 (file)
index 0000000..2fc1934
--- /dev/null
@@ -0,0 +1,39 @@
+package jalview.datamodel;
+
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class SequenceDummyTest
+{
+  /**
+   * test for become method
+   */
+  @Test
+  public void testBecome()
+  {
+    SequenceI seq = new Sequence("OrigSeq", "ASEQUENCE");
+    SequenceFeature ofeat = new SequenceFeature("NewFeat", "somedesc", 3,
+            12, 2.3f, "none");
+    
+    SequenceDummy dummySeq = new SequenceDummy("OrigSeq");
+    dummySeq.addSequenceFeature(ofeat);
+    dummySeq.become(seq);
+    Assert.assertFalse("Dummy sequence did not become a full sequence",
+            dummySeq.isDummy());
+    Assert.assertTrue("Sequence was not updated from template", seq
+            .getSequenceAsString().equals(dummySeq.getSequenceAsString()));
+    boolean found = false;
+    for (SequenceFeature sf : dummySeq.getSequenceFeatures())
+    {
+      if (sf == ofeat)
+      {
+        found = true;
+        break;
+      }
+    }
+    Assert.assertTrue("Didn't retain original sequence feature", found);
+
+    // todo - should test all aspect of copy constructor
+  }
+}