@Test
  public void whenListenVersionAlreadyIsThere_thenLatchIsOpenedAndNothingIsRegistered() {
    ManualRef ref = new ManualRef(stm);

    AlphaTransaction tx = createSutTransaction();
    tx.openForRead(ref);

    // do the desired update
    ref.inc(stm);

    Latch latch = new CheapLatch();
    tx.registerRetryLatch(latch);

    assertIsActive(tx);
    assertTrue(latch.isOpen());
    assertHasNoListeners(ref);
  }
  @Test
  public void whenOnlyFresh_thenNoRetryPossibleException() {
    ManualRef ref = ManualRef.createUncommitted();

    AlphaTransaction tx = createSutTransaction();
    tx.openForConstruction(ref);

    Latch latch = new CheapLatch();
    try {
      tx.registerRetryLatch(latch);
      fail();
    } catch (NoRetryPossibleException expected) {
    }

    assertHasNoListeners(ref);
    assertFalse(latch.isOpen());
    assertIsActive(tx);
  }