5a2674a37ccf4779703b545910995455e38f79c8
[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     // null value: should be no exception
15     ArrayUtils.reverseIntArray((int[]) null);
16
17     // empty array: should be no exception
18     int[] arr = new int[] {};
19     ArrayUtils.reverseIntArray(arr);
20
21     // even length array
22     arr = new int[] { 1, 2, 3, 4 };
23     ArrayUtils.reverseIntArray(arr);
24     assertEquals("[4, 3, 2, 1]", Arrays.toString(arr));
25
26     // odd length array
27     arr = new int[] { 1, 2, 3, 4, 5 };
28     ArrayUtils.reverseIntArray(arr);
29     assertEquals("[5, 4, 3, 2, 1]", Arrays.toString(arr));
30   }
31 }