package jalview.analysis; import static org.testng.AssertJUnit.assertEquals; import static org.testng.AssertJUnit.fail; import jalview.analysis.SecStrConsensus.SimpleBP; import java.util.Vector; import org.testng.annotations.Test; public class RnaTest { @Test(groups ={ "Functional" }) public void testGetSimpleBPs() throws WUSSParseException { String rna = "([{})]"; // JAL-1081 example Vector bps = Rna.GetSimpleBPs(rna); assertEquals(3, bps.size()); /* * the base pairs are added in the order in which the matching base is found */ assertEquals(2, bps.get(0).bp5); // { assertEquals(3, bps.get(0).bp3); // } assertEquals(0, bps.get(1).bp5); // ( assertEquals(4, bps.get(1).bp3); // ) assertEquals(1, bps.get(2).bp5); // [ assertEquals(5, bps.get(2).bp3); // ] } @Test(groups ={ "Functional" }) public void testGetSimpleBPs_unmatchedOpener() { String rna = "(([{})]"; try { Rna.GetSimpleBPs(rna); fail("expected exception"); } catch (WUSSParseException e) { // expected } } @Test(groups ={ "Functional" }) public void testGetSimpleBPs_unmatchedCloser() { String rna = "([{})]]"; try { Rna.GetSimpleBPs(rna); fail("expected exception"); } catch (WUSSParseException e) { // expected } } }