From: Mateusz Warowny Date: Wed, 26 Jul 2023 14:18:09 +0000 (+0200) Subject: JAL-4245 Test getRootDataset method X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=167b079862998eb6857942b4d235d4c3dae8a5e5;p=jalview.git JAL-4245 Test getRootDataset method --- diff --git a/test/jalview/datamodel/SequenceTest.java b/test/jalview/datamodel/SequenceTest.java index 7133455..529c80b 100644 --- a/test/jalview/datamodel/SequenceTest.java +++ b/test/jalview/datamodel/SequenceTest.java @@ -1600,6 +1600,43 @@ public class SequenceTest assertTrue(found.contains(sfI)); } + @Test(groups = { "Functional"} ) + public void testGetRootDatasetSequence_datasetIsNull_returnNull() + { + Sequence dseq = new Sequence("test", "ABCDEF"); + assertNull(dseq.getRootDatasetSequence()); + } + + @Test(groups = { "Functional" }) + public void testGetRootDatasetSequence_datasetImplicit_returnDataset() + { + Sequence seq = new Sequence("test", "--AB-CDEF"); + SequenceI dseq = seq.createDatasetSequence(); + assertEquals(seq.getRootDatasetSequence(), dseq); + } + + @Test(groups = { "Functional" }) + public void testGetRootDatasetSequence_datasetExplicit_returnDataset() + { + Sequence seq = new Sequence("test", "--AB-CDEF"); + Sequence dseq = new Sequence("test", "ABCDEF"); + seq.setDatasetSequence(dseq); + assertEquals(seq.getRootDatasetSequence(), dseq); + } + + @Test(groups = { "Functional" }) + public void testGetRootDatasetSequence_nestedDatasets_returnLastDataset() + { + Sequence seq = new Sequence("test", "--AB-CDEFE"); + Sequence dseq = new Sequence("test", "ABCDEF"); + seq.setDatasetSequence(dseq); + Sequence ddseq = new Sequence("test", "ABCDEF"); + dseq.setDatasetSequence(ddseq); + assertEquals(seq.getDatasetSequence(), dseq); + assertEquals(seq.getRootDatasetSequence(), ddseq); + } + + @Test(groups = { "Functional" }) public void testFindIndex_withCursor() {