JAL-1578 test property accessors/copy constructor
authorJim Procter <jprocter@dundee.ac.uk>
Mon, 3 Nov 2014 10:10:09 +0000 (10:10 +0000)
committerJim Procter <jprocter@dundee.ac.uk>
Mon, 3 Nov 2014 10:10:09 +0000 (10:10 +0000)
test/jalview/datamodel/AlignmentAnnotationTests.java

index 7df6255..f23b3d2 100644 (file)
@@ -1,21 +1,26 @@
 package jalview.datamodel;
 
-import static org.junit.Assert.*;
-
-import java.awt.Frame;
-
-import javax.swing.JFrame;
-import javax.swing.SwingWorker;
-
+import static org.junit.Assert.assertEquals;
 import jalview.analysis.AlignSeq;
-import jalview.gui.AlignFrame;
 import jalview.io.AppletFormatAdapter;
-import jalview.io.FormatAdapter;
 
 import org.junit.Test;
 
 public class AlignmentAnnotationTests
 {
+  @Test
+  public void testCopyConstructor()
+  {
+    SequenceI sq = new Sequence("Foo", "ARAARARARAWEAWEAWRAWEAWE");
+    createAnnotation(sq);
+    AlignmentAnnotation alc, alo = sq.getAnnotation()[0];
+    alc = new AlignmentAnnotation(alo);
+    for (String key : alo.getProperties())
+    {
+      assertEquals("Property mismatch", alo.getProperty(key),
+              alc.getProperty(key));
+    }
+  }
   /**
    * create some dummy annotation derived from the sequence
    * 
@@ -27,12 +32,13 @@ public class AlignmentAnnotationTests
     for (int i = 0; i < al.length; i++)
     {
       al[i] = new Annotation(new Annotation("" + sq.getCharAt(i), "",
-              (char) 0, (float) sq.findPosition(i)));
+              (char) 0, sq.findPosition(i)));
     }
     AlignmentAnnotation alan = new AlignmentAnnotation("For "
             + sq.getName(), "Fake alignment annot", al);
     // create a sequence mapping for the annotation vector in its current state
     alan.createSequenceMapping(sq, sq.getStart(), false);
+    alan.setProperty("CreatedBy", "createAnnotation");
     sq.addAlignmentAnnotation(alan);
   }