JAL-2189 format tests
[jalview.git] / test / jalview / util / ArrayUtilsTest.java
1 package jalview.util;
2
3 import static org.testng.AssertJUnit.assertEquals;
4
5 import java.util.Arrays;
6
7 import org.testng.annotations.Test;
8
9 public class ArrayUtilsTest
10 {
11   @Test(groups = "Functional")
12   public void testReverseIntArray()
13   {
14
15     // null value: should be no exception
16     ArrayUtils.reverseIntArray((int[]) null);
17
18     // empty array: should be no exception
19     int[] arr = new int[] {};
20     ArrayUtils.reverseIntArray(arr);
21
22     // even length array
23     arr = new int[] { 1, 2, 3, 4 };
24     ArrayUtils.reverseIntArray(arr);
25     assertEquals("[4, 3, 2, 1]", Arrays.toString(arr));
26
27     // odd length array
28     arr = new int[] { 1, 2, 3, 4, 5 };
29     ArrayUtils.reverseIntArray(arr);
30     assertEquals("[5, 4, 3, 2, 1]", Arrays.toString(arr));
31   }
32 }