From: Jim Procter Date: Mon, 3 Nov 2014 10:10:09 +0000 (+0000) Subject: JAL-1578 test property accessors/copy constructor X-Git-Tag: Jalview_2_9~155^2~15^2~2 X-Git-Url: http://source.jalview.org/gitweb/?p=jalview.git;a=commitdiff_plain;h=898ef7e2238d8eade34829e9fc86b422f14f29d8 JAL-1578 test property accessors/copy constructor --- diff --git a/test/jalview/datamodel/AlignmentAnnotationTests.java b/test/jalview/datamodel/AlignmentAnnotationTests.java index 7df6255..f23b3d2 100644 --- a/test/jalview/datamodel/AlignmentAnnotationTests.java +++ b/test/jalview/datamodel/AlignmentAnnotationTests.java @@ -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); }