Index: C:/harmony/trunk_0427/modules/luni/src/test/java/tests/api/java/util/ArraysTest.java =================================================================== --- C:/harmony/trunk_0427/modules/luni/src/test/java/tests/api/java/util/ArraysTest.java (revision 417921) +++ C:/harmony/trunk_0427/modules/luni/src/test/java/tests/api/java/util/ArraysTest.java (working copy) @@ -771,6 +771,36 @@ for (int counter = endIndex; counter < arraySize; counter++) assertTrue("Array modified outside of bounds", reversedArray[counter] == originalReversedArray[counter]); + + //exception testing + boolean exception = false; + try { + Arrays.sort(reversedArray, startIndex + 1, startIndex); + } catch (IllegalArgumentException iae) { + exception = true; + } + assertTrue("IllegalArgumentException expected", exception); + exception = false; + try { + Arrays.sort(reversedArray, -1, startIndex); + } catch (ArrayIndexOutOfBoundsException iae) { + exception = true; + } + assertTrue("ArrayIndexOutOfBoundsException expected (1)", exception); + exception = false; + try { + Arrays.sort(reversedArray, startIndex, reversedArray.length + 1); + } catch (ArrayIndexOutOfBoundsException iae) { + exception = true; + } + assertTrue("ArrayIndexOutOfBoundsException expected (2)", exception); + + //exception order testing + try { + Arrays.sort(new byte[1], startIndex + 1, startIndex); + } catch (IllegalArgumentException iae) { + //expected + } } /** @@ -812,6 +842,35 @@ assertTrue("Array modified outside of bounds", reversedArray[counter] == originalReversedArray[counter]); + //exception testing + boolean exception = false; + try { + Arrays.sort(reversedArray, startIndex + 1, startIndex); + } catch (IllegalArgumentException iae) { + exception = true; + } + assertTrue("IllegalArgumentException expected", exception); + exception = false; + try { + Arrays.sort(reversedArray, -1, startIndex); + } catch (ArrayIndexOutOfBoundsException iae) { + exception = true; + } + assertTrue("ArrayIndexOutOfBoundsException expected (1)", exception); + exception = false; + try { + Arrays.sort(reversedArray, startIndex, reversedArray.length + 1); + } catch (ArrayIndexOutOfBoundsException iae) { + exception = true; + } + assertTrue("ArrayIndexOutOfBoundsException expected (2)", exception); + + //exception order testing + try { + Arrays.sort(new char[1], startIndex + 1, startIndex); + } catch (IllegalArgumentException iae) { + //expected + } } /** @@ -876,6 +935,35 @@ assertTrue("Array modified outside of bounds", reversedArray[counter] == originalReversedArray[counter]); + //exception testing + boolean exception = false; + try { + Arrays.sort(reversedArray, startIndex + 1, startIndex); + } catch (IllegalArgumentException iae) { + exception = true; + } + assertTrue("IllegalArgumentException expected", exception); + exception = false; + try { + Arrays.sort(reversedArray, -1, startIndex); + } catch (ArrayIndexOutOfBoundsException iae) { + exception = true; + } + assertTrue("ArrayIndexOutOfBoundsException expected (1)", exception); + exception = false; + try { + Arrays.sort(reversedArray, startIndex, reversedArray.length + 1); + } catch (ArrayIndexOutOfBoundsException iae) { + exception = true; + } + assertTrue("ArrayIndexOutOfBoundsException expected (2)", exception); + + //exception order testing + try { + Arrays.sort(new double[1], startIndex + 1, startIndex); + } catch (IllegalArgumentException iae) { + //expected + } } /** @@ -939,6 +1027,36 @@ for (int counter = endIndex; counter < arraySize; counter++) assertTrue("Array modified outside of bounds", reversedArray[counter] == originalReversedArray[counter]); + + //exception testing + boolean exception = false; + try { + Arrays.sort(reversedArray, startIndex + 1, startIndex); + } catch (IllegalArgumentException iae) { + exception = true; + } + assertTrue("IllegalArgumentException expected", exception); + exception = false; + try { + Arrays.sort(reversedArray, -1, startIndex); + } catch (ArrayIndexOutOfBoundsException iae) { + exception = true; + } + assertTrue("ArrayIndexOutOfBoundsException expected (1)", exception); + exception = false; + try { + Arrays.sort(reversedArray, startIndex, reversedArray.length + 1); + } catch (ArrayIndexOutOfBoundsException iae) { + exception = true; + } + assertTrue("ArrayIndexOutOfBoundsException expected (2)", exception); + + //exception order testing + try { + Arrays.sort(new float[1], startIndex + 1, startIndex); + } catch (IllegalArgumentException iae) { + //expected + } } /** @@ -979,6 +1097,35 @@ assertTrue("Array modified outside of bounds", reversedArray[counter] == originalReversedArray[counter]); + //exception testing + boolean exception = false; + try { + Arrays.sort(reversedArray, startIndex + 1, startIndex); + } catch (IllegalArgumentException iae) { + exception = true; + } + assertTrue("IllegalArgumentException expected", exception); + exception = false; + try { + Arrays.sort(reversedArray, -1, startIndex); + } catch (ArrayIndexOutOfBoundsException iae) { + exception = true; + } + assertTrue("ArrayIndexOutOfBoundsException expected (1)", exception); + exception = false; + try { + Arrays.sort(reversedArray, startIndex, reversedArray.length + 1); + } catch (ArrayIndexOutOfBoundsException iae) { + exception = true; + } + assertTrue("ArrayIndexOutOfBoundsException expected (2)", exception); + + //exception order testing + try { + Arrays.sort(new int[1], startIndex + 1, startIndex); + } catch (IllegalArgumentException iae) { + //expected + } } /** @@ -1020,6 +1167,35 @@ assertTrue("Array modified outside of bounds", reversedArray[counter] == originalReversedArray[counter]); + //exception testing + boolean exception = false; + try { + Arrays.sort(reversedArray, startIndex + 1, startIndex); + } catch (IllegalArgumentException iae) { + exception = true; + } + assertTrue("IllegalArgumentException expected", exception); + exception = false; + try { + Arrays.sort(reversedArray, -1, startIndex); + } catch (ArrayIndexOutOfBoundsException iae) { + exception = true; + } + assertTrue("ArrayIndexOutOfBoundsException expected (1)", exception); + exception = false; + try { + Arrays.sort(reversedArray, startIndex, reversedArray.length + 1); + } catch (ArrayIndexOutOfBoundsException iae) { + exception = true; + } + assertTrue("ArrayIndexOutOfBoundsException expected (2)", exception); + + //exception order testing + try { + Arrays.sort(new long[1], startIndex + 1, startIndex); + } catch (IllegalArgumentException iae) { + //expected + } } /** @@ -1061,6 +1237,36 @@ for (int counter = endIndex; counter < arraySize; counter++) assertTrue("Array modified outside of bounds", reversedArray[counter] == originalReversedArray[counter]); + + //exception testing + boolean exception = false; + try { + Arrays.sort(reversedArray, startIndex + 1, startIndex); + } catch (IllegalArgumentException iae) { + exception = true; + } + assertTrue("IllegalArgumentException expected", exception); + exception = false; + try { + Arrays.sort(reversedArray, -1, startIndex); + } catch (ArrayIndexOutOfBoundsException iae) { + exception = true; + } + assertTrue("ArrayIndexOutOfBoundsException expected (1)", exception); + exception = false; + try { + Arrays.sort(reversedArray, startIndex, reversedArray.length + 1); + } catch (ArrayIndexOutOfBoundsException iae) { + exception = true; + } + assertTrue("ArrayIndexOutOfBoundsException expected (2)", exception); + + //exception order testing + try { + Arrays.sort(new Object[1], startIndex + 1, startIndex); + } catch (IllegalArgumentException iae) { + //expected + } } /** @@ -1140,6 +1346,36 @@ for (int counter = endIndex; counter < arraySize; counter++) assertTrue("Array modified outside of bounds", reversedArray[counter] == originalReversedArray[counter]); + + //exception testing + boolean exception = false; + try { + Arrays.sort(reversedArray, startIndex + 1, startIndex); + } catch (IllegalArgumentException iae) { + exception = true; + } + assertTrue("IllegalArgumentException expected", exception); + exception = false; + try { + Arrays.sort(reversedArray, -1, startIndex); + } catch (ArrayIndexOutOfBoundsException iae) { + exception = true; + } + assertTrue("ArrayIndexOutOfBoundsException expected (1)", exception); + exception = false; + try { + Arrays.sort(reversedArray, startIndex, reversedArray.length + 1); + } catch (ArrayIndexOutOfBoundsException iae) { + exception = true; + } + assertTrue("ArrayIndexOutOfBoundsException expected (2)", exception); + + //exception order testing + try { + Arrays.sort(new short[1], startIndex + 1, startIndex); + } catch (IllegalArgumentException iae) { + //expected + } } /**