/** set throws an IndexOutOfBoundsException on a negative index */
 public void testSet1_IndexOutOfBoundsException() {
   try {
     List c = emptyArray();
     c.set(-1, "qwerty");
     shouldThrow();
   } catch (IndexOutOfBoundsException e) {
   }
 }
 /** set throws an IndexOutOfBoundsException on a too high index */
 public void testSet2() {
   try {
     List c = emptyArray();
     c.add("asdasd");
     c.add("asdad");
     c.set(100, "qwerty");
     shouldThrow();
   } catch (IndexOutOfBoundsException e) {
   }
 }
  /** sublists contains elements at indexes offset from their base */
  public void testSubList() {
    List a = populatedArray(10);
    assertTrue(a.subList(1, 1).isEmpty());
    for (int j = 0; j < 9; ++j) {
      for (int i = j; i < 10; ++i) {
        List b = a.subList(j, i);
        for (int k = j; k < i; ++k) {
          assertEquals(new Integer(k), b.get(k - j));
        }
      }
    }

    List s = a.subList(2, 5);
    assertEquals(3, s.size());
    s.set(2, m1);
    assertEquals(a.get(4), m1);
    s.clear();
    assertEquals(7, a.size());
  }
 /** set changes the element at the given index */
 public void testSet() {
   List full = populatedArray(3);
   assertEquals(two, full.set(2, four));
   assertEquals(4, ((Integer) full.get(2)).intValue());
 }