JAL-1355 user error message text externalised
[jalview.git] / test / jalview / util / MapListTest.java
index f69fe40..6e7e19e 100644 (file)
@@ -1,21 +1,20 @@
 package jalview.util;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertFalse;
+import static org.testng.AssertJUnit.assertNull;
+import static org.testng.AssertJUnit.assertTrue;
 
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 
-import org.junit.Assert;
-import org.junit.Test;
+import org.testng.annotations.Test;
 
 public class MapListTest
 {
 
-  @Test
+  @Test(groups ={ "Functional" })
   public void testSomething()
   {
     MapList ml = new MapList(new int[]
@@ -48,7 +47,7 @@ public class MapListTest
   private static void testLocateFrom(MapList mldna, int i, int j, int[] ks)
   {
     int[] frm = mldna.locateInFrom(i, j);
-    Assert.assertEquals("Failed test locate from " + i + " to " + j,
+    assertEquals("Failed test locate from " + i + " to " + j,
             Arrays.toString(frm), Arrays.toString(ks));
   }
 
@@ -220,7 +219,7 @@ public class MapListTest
    * Tests for method that locates ranges in the 'from' map for given range in
    * the 'to' map.
    */
-  @Test
+  @Test(groups ={ "Functional" })
   public void testLocateInFrom_noIntrons()
   {
     /*
@@ -252,7 +251,7 @@ public class MapListTest
    * Tests for method that locates ranges in the 'from' map for given range in
    * the 'to' map.
    */
-  @Test
+  @Test(groups ={ "Functional" })
   public void testLocateInFrom_withIntrons()
   {
     /*
@@ -275,7 +274,7 @@ public class MapListTest
    * Tests for method that locates ranges in the 'to' map for given range in the
    * 'from' map.
    */
-  @Test
+  @Test(groups ={ "Functional" })
   public void testLocateInTo_noIntrons()
   {
     /*
@@ -315,7 +314,7 @@ public class MapListTest
    * Tests for method that locates ranges in the 'to' map for given range in the
    * 'from' map.
    */
-  @Test
+  @Test(groups ={ "Functional" })
   public void testLocateInTo_withIntrons()
   {
     /*
@@ -358,7 +357,7 @@ public class MapListTest
   /**
    * Test equals method.
    */
-  @Test
+  @Test(groups ={ "Functional" })
   public void testEquals()
   {
     int[] codons = new int[]
@@ -407,7 +406,7 @@ public class MapListTest
   /**
    * Test for the method that flattens a list of ranges into a single array.
    */
-  @Test
+  @Test(groups ={ "Functional" })
   public void testGetRanges()
   {
     List<int[]> ranges = new ArrayList<int[]>();
@@ -421,7 +420,7 @@ public class MapListTest
   /**
    * Check state after construction
    */
-  @Test
+  @Test(groups ={ "Functional" })
   public void testConstructor()
   {
     int[] codons =
@@ -479,7 +478,7 @@ public class MapListTest
   /**
    * Test the method that creates an inverse mapping
    */
-  @Test
+  @Test(groups ={ "Functional" })
   public void testGetInverse()
   {
     int[] codons =
@@ -498,4 +497,15 @@ public class MapListTest
     assertEquals(prettyPrint(ml.getToRanges()),
             prettyPrint(ml2.getFromRanges()));
   }
+
+  @Test(groups ={ "Functional" })
+  public void testToString()
+  {
+    MapList ml = new MapList(new int[]
+    { 1, 5, 10, 15, 25, 20 }, new int[]
+    { 51, 1 }, 1, 3);
+    String s = ml.toString();
+    assertEquals("From (1:3) [ [1, 5] [10, 15] [25, 20] ] To [ [51, 1] ]",
+            s);
+  }
 }