@Test
  public void whenItemReplaced() {
    TransactionalArrayList<String> list = new TransactionalArrayList<String>();
    list.add("a");
    list.add("b");
    list.add("c");

    long version = stm.getVersion();
    String returned = list.set(1, "newb");

    assertEquals(returned, "b");
    assertEquals("newb", list.get(1));
    assertEquals(version + 1, stm.getVersion());
  }
  @Test
  public void whenIndexTooSmall_thenIndexOutOfBoundsException() {
    TransactionalArrayList<String> list = new TransactionalArrayList<String>();

    long version = stm.getVersion();
    try {
      list.set(-1, "foo");
      fail();
    } catch (IndexOutOfBoundsException expected) {

    }

    assertEquals(version, stm.getVersion());
  }