JAL-4313 Clamp start and end ranges to array size
[jalview.git] / test / jalview / ext / android / SparseIntArrayTest.java
index be95d6e..9dc7dfb 100644 (file)
@@ -23,6 +23,9 @@ package jalview.ext.android;
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.fail;
 
+import jalview.gui.JvOptionPane;
+
+import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
 
 /*
@@ -31,6 +34,14 @@ import org.testng.annotations.Test;
  */
 public class SparseIntArrayTest
 {
+
+  @BeforeClass(alwaysRun = true)
+  public void setUpJvOptionPane()
+  {
+    JvOptionPane.setInteractiveMode(false);
+    JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION);
+  }
+
   @Test(groups = "Functional")
   public void testPut()
   {
@@ -49,7 +60,7 @@ public class SparseIntArrayTest
   public void testAdd()
   {
     SparseIntArray counter = new SparseIntArray();
-  
+
     assertEquals(counter.add('P', 2), 2);
     assertEquals(counter.add('P', 3), 5);
     counter.put('Q', 7);
@@ -64,7 +75,7 @@ public class SparseIntArrayTest
     {
       // expected
     }
-  
+
     counter.put('y', Integer.MIN_VALUE);
     try
     {