From 167b079862998eb6857942b4d235d4c3dae8a5e5 Mon Sep 17 00:00:00 2001 From: Mateusz Warowny Date: Wed, 26 Jul 2023 16:18:09 +0200 Subject: [PATCH] JAL-4245 Test getRootDataset method --- test/jalview/datamodel/SequenceTest.java | 37 ++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) 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() { -- 1.7.10.2