コード例 #1
0
 /**
  * Test sourceIndex if index off range. Changed implementation to throw IndexOOB (off range access
  * is always a programming error)
  */
 @Test(expected = IndexOutOfBoundsException.class)
 public void testSourceIndexOffRange() {
   int[] indices = new int[] {3, 5, 1};
   indicesList.addIndices(indices);
   assertEquals(indices.length, indicesList.size());
   assertEquals(-1, indicesList.getSourceIndex(-1));
   assertEquals(-1, indicesList.getSourceIndex(indices.length));
 }
コード例 #2
0
 /** Source index is same as get, kind of. */
 @Test
 public void testSourceIndexInRange() {
   int[] indices = new int[] {3, 5, 1};
   indicesList.addIndices(indices);
   assertEquals(indices.length, indicesList.size());
   Arrays.sort(indices);
   for (int i = 0; i < indices.length; i++) {
     assertEquals("sourceIndex " + i, indices[i], indicesList.getSourceIndex(i));
   }
 }