commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brit...@apache.org
Subject [5/7] [lang] testSwapIntExchangedOffsets
Date Tue, 28 Apr 2015 19:15:30 GMT
testSwapIntExchangedOffsets

Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/af8d0ab9
Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/af8d0ab9
Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/af8d0ab9

Branch: refs/heads/master
Commit: af8d0ab9bcd092b3681376b30b56f8e8faacf3c2
Parents: c1501a2
Author: beradrian <beradrian@yahoo.com>
Authored: Tue Mar 24 12:49:19 2015 +0200
Committer: beradrian <beradrian@yahoo.com>
Committed: Tue Apr 28 12:58:13 2015 +0300

----------------------------------------------------------------------
 .../org/apache/commons/lang3/ArrayUtilsTest.java  | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-lang/blob/af8d0ab9/src/test/java/org/apache/commons/lang3/ArrayUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/ArrayUtilsTest.java b/src/test/java/org/apache/commons/lang3/ArrayUtilsTest.java
index 5633c9d..be3e119 100644
--- a/src/test/java/org/apache/commons/lang3/ArrayUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/ArrayUtilsTest.java
@@ -2134,12 +2134,6 @@ public class ArrayUtilsTest  {
         assertArrayEquals(new char[] {2, 1, 3}, array);
     }
     
-    @Test(expected = ArrayIndexOutOfBoundsException.class)
-    public void testSwapCharOutOfBounds() {
-        char[] array = new char[] {1, 2, 3};
-        ArrayUtils.swap(array, 0, 5);
-    }
-
     @Test
     public void testSwapCharRange() {
         char[] array = new char[] {1, 2, 3, 4};
@@ -2242,6 +2236,18 @@ public class ArrayUtilsTest  {
         assertEquals(1, array[2]);
         assertEquals(2, array[3]);
     }
+    
+    @Test
+    public void testSwapIntExchangedOffsets() {
+        int[] array;
+        array = new int[] {1, 2, 3};
+        ArrayUtils.swap(array, 0, 1, 2);
+        assertArrayEquals(new int[] {2, 3, 1}, array);
+        
+        array = new int[] {1, 2, 3};
+        ArrayUtils.swap(array, 1, 0, 2);
+        assertArrayEquals(new int[] {2, 3, 1}, array);
+    }
 
     @Test(expected = ArrayIndexOutOfBoundsException.class)
     public void testSwapIntOutOfRange() {


Mime
View raw message