@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());
  }
  @Test
  @Ignore
  public void drainToWithEmptyDeque() {
    BlockingDeque<String> deque = new TransactionalLinkedList<String>();

    Collection<String> c = new LinkedList<String>();
    long version = stm.getTime();
    int result = deque.drainTo(c);
    assertEquals(0, result);

    assertEquals(version, stm.getTime());
    assertTrue(c.isEmpty());
    assertEquals(0, deque.size());
    testIncomplete();
  }
  @Ignore
  @Test
  public void drainToWithNonEmptyDeque() {
    BlockingDeque<String> deque = new TransactionalLinkedList<String>();
    deque.add("1");
    deque.add("2");
    deque.add("3");

    Collection<String> c = new LinkedList<String>();
    long version = stm.getTime();
    int result = deque.drainTo(c);
    assertEquals(3, result);
    assertEquals(version + 1, stm.getTime());
    assertEquals("[1, 2, 3]", c.toString());
    assertEquals(0, deque.size());
    testIncomplete();
  }