1 package jalview.ext.rbvi.chimera;
3 import static org.testng.Assert.assertEquals;
5 import org.testng.annotations.Test;
7 public class AtomSpecModelTest
9 @Test(groups = "Functional")
10 public void testGetAtomSpec()
12 AtomSpecModel model = new AtomSpecModel();
13 assertEquals(model.getAtomSpec(), "");
14 model.addRange(1, 2, 4, "A");
15 assertEquals(model.getAtomSpec(), "#1:2-4.A");
16 model.addRange(1, 8, 8, "A");
17 assertEquals(model.getAtomSpec(), "#1:2-4.A,8.A");
18 model.addRange(1, 5, 7, "B");
19 assertEquals(model.getAtomSpec(), "#1:2-4.A,8.A,5-7.B");
20 model.addRange(1, 3, 5, "A");
21 assertEquals(model.getAtomSpec(), "#1:2-5.A,8.A,5-7.B");
22 model.addRange(0, 1, 4, "B");
23 assertEquals(model.getAtomSpec(), "#0:1-4.B|#1:2-5.A,8.A,5-7.B");
24 model.addRange(0, 5, 9, "C");
25 assertEquals(model.getAtomSpec(), "#0:1-4.B,5-9.C|#1:2-5.A,8.A,5-7.B");
26 model.addRange(1, 8, 10, "B");
27 assertEquals(model.getAtomSpec(), "#0:1-4.B,5-9.C|#1:2-5.A,8.A,5-10.B");
28 model.addRange(1, 8, 9, "B");
29 assertEquals(model.getAtomSpec(), "#0:1-4.B,5-9.C|#1:2-5.A,8.A,5-10.B");
30 model.addRange(0, 3, 10, "C"); // subsumes 5-9
31 assertEquals(model.getAtomSpec(), "#0:1-4.B,3-10.C|#1:2-5.A,8.A,5-10.B");
32 model.addRange(5, 25, 35, " "); // empty chain code - e.g. from homology
34 assertEquals(model.getAtomSpec(),
35 "#0:1-4.B,3-10.C|#1:2-5.A,8.A,5-10.B|#5:25-35.");