JAL-1645 source formatting and organise imports
[jalview.git] / test / jalview / analysis / RnaTest.java
1 package jalview.analysis;
2
3 import static org.testng.AssertJUnit.assertEquals;
4 import static org.testng.AssertJUnit.fail;
5
6 import jalview.analysis.SecStrConsensus.SimpleBP;
7
8 import java.util.Vector;
9
10 import org.testng.annotations.Test;
11
12 public class RnaTest
13 {
14   @Test(groups = { "Functional" })
15   public void testGetSimpleBPs() throws WUSSParseException
16   {
17     String rna = "([{})]"; // JAL-1081 example
18     Vector<SimpleBP> bps = Rna.GetSimpleBPs(rna);
19     assertEquals(3, bps.size());
20
21     /*
22      * the base pairs are added in the order in which the matching base is found
23      */
24     assertEquals(2, bps.get(0).bp5); // {
25     assertEquals(3, bps.get(0).bp3); // }
26     assertEquals(0, bps.get(1).bp5); // (
27     assertEquals(4, bps.get(1).bp3); // )
28     assertEquals(1, bps.get(2).bp5); // [
29     assertEquals(5, bps.get(2).bp3); // ]
30   }
31
32   @Test(groups = { "Functional" })
33   public void testGetSimpleBPs_unmatchedOpener()
34   {
35     String rna = "(([{})]";
36     try
37     {
38       Rna.GetSimpleBPs(rna);
39       fail("expected exception");
40     } catch (WUSSParseException e)
41     {
42       // expected
43     }
44   }
45
46   @Test(groups = { "Functional" })
47   public void testGetSimpleBPs_unmatchedCloser()
48   {
49     String rna = "([{})]]";
50     try
51     {
52       Rna.GetSimpleBPs(rna);
53       fail("expected exception");
54     } catch (WUSSParseException e)
55     {
56       // expected
57     }
58   }
59 }