@Test
  public void testDescendingIterator() {
    ThriftyList<Integer> list = new ThriftyList<Integer>();
    Iterator<Integer> ri = list.descendingIterator();
    Assert.assertFalse(ri.hasNext());
    try {
      ri.next();
      Assert.fail();
    } catch (NoSuchElementException e) {

    }
    try {
      ri.remove();
      Assert.fail();
    } catch (IllegalStateException e) {

    }

    int testCount = 100;
    for (int j = 0; j < testCount; j++) {
      list.add(j);
    }

    ri = list.descendingIterator();
    for (int j = testCount - 1; j >= 0; j--) {
      Assert.assertTrue(ri.hasNext());
      Assert.assertEquals(Integer.valueOf(j), ri.next());
    }

    ri = list.descendingIterator();
    try {
      ri.remove();
      Assert.fail();
    } catch (IllegalStateException e) {

    }
    for (int j = testCount - 1; j >= 0; j--) {
      Assert.assertTrue(ri.hasNext());
      Assert.assertEquals(Integer.valueOf(j), ri.next());
      ri.remove();
    }
    Assert.assertFalse(ri.hasNext());
    Assert.assertEquals(0, list.size());
    try {
      ri.next();
      Assert.fail();
    } catch (NoSuchElementException e) {

    }
  }