From 898ef7e2238d8eade34829e9fc86b422f14f29d8 Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Mon, 3 Nov 2014 10:10:09 +0000 Subject: [PATCH] JAL-1578 test property accessors/copy constructor --- .../datamodel/AlignmentAnnotationTests.java | 26 ++++++++++++-------- 1 file changed, 16 insertions(+), 10 deletions(-) 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); } -- 1.7.10.2