JAL-4313 Clamp start and end ranges to array size
[jalview.git] / test / jalview / ext / android / SparseShortArrayTest.java
index df161b7..0b11eb5 100644 (file)
@@ -23,10 +23,21 @@ 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;
 
 public class SparseShortArrayTest
 {
+
+  @BeforeClass(alwaysRun = true)
+  public void setUpJvOptionPane()
+  {
+    JvOptionPane.setInteractiveMode(false);
+    JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION);
+  }
+
   @Test(groups = "Functional")
   public void testPut()
   {
@@ -83,7 +94,7 @@ public class SparseShortArrayTest
   public void testAdd()
   {
     SparseShortArray counter = new SparseShortArray();
-  
+
     assertEquals(counter.add('P', 2), 2);
     assertEquals(counter.add('P', 3), 5);
     counter.put('Q', 7);
@@ -99,7 +110,7 @@ public class SparseShortArrayTest
     {
       // expected;
     }
-  
+
     // decrement giving underflow
     counter.put('y', Short.MIN_VALUE);
     try