JAL-2029 many-to-many EnsemblCDS-to-Uniprot mappings
[jalview.git] / test / jalview / util / ArrayUtilsTest.java
diff --git a/test/jalview/util/ArrayUtilsTest.java b/test/jalview/util/ArrayUtilsTest.java
new file mode 100644 (file)
index 0000000..5a2674a
--- /dev/null
@@ -0,0 +1,31 @@
+package jalview.util;
+
+import static org.testng.AssertJUnit.assertEquals;
+
+import java.util.Arrays;
+
+import org.testng.annotations.Test;
+
+public class ArrayUtilsTest
+{
+  @Test(groups="Functional")
+  public void testReverseIntArray() {
+
+    // null value: should be no exception
+    ArrayUtils.reverseIntArray((int[]) null);
+
+    // empty array: should be no exception
+    int[] arr = new int[] {};
+    ArrayUtils.reverseIntArray(arr);
+
+    // even length array
+    arr = new int[] { 1, 2, 3, 4 };
+    ArrayUtils.reverseIntArray(arr);
+    assertEquals("[4, 3, 2, 1]", Arrays.toString(arr));
+
+    // odd length array
+    arr = new int[] { 1, 2, 3, 4, 5 };
+    ArrayUtils.reverseIntArray(arr);
+    assertEquals("[5, 4, 3, 2, 1]", Arrays.toString(arr));
+  }
+}