From a62fe83201337a4f690f92e8ef1524a4e4bde6cb Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Sat, 6 Jun 2015 17:54:34 +0100 Subject: [PATCH] JAL-653 test for SequenceDummy methods --- test/jalview/datamodel/SequenceDummyTest.java | 39 +++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 test/jalview/datamodel/SequenceDummyTest.java diff --git a/test/jalview/datamodel/SequenceDummyTest.java b/test/jalview/datamodel/SequenceDummyTest.java new file mode 100644 index 0000000..2fc1934 --- /dev/null +++ b/test/jalview/datamodel/SequenceDummyTest.java @@ -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 + } +} -- 1.7.10.2