private void testRemoveAndFetch(final boolean inTransaction) throws Exception {
   final Exchange ex = _persistit.getExchange("persistit", "gogo", true);
   final Transaction txn = ex.getTransaction();
   ex.getValue().put(RED_FOX);
   for (int i = 1; i < 10000; i++) {
     if (inTransaction) {
       txn.begin();
     }
     ex.to(i).store();
     if (inTransaction) {
       txn.commit();
       txn.end();
     }
   }
   for (int i = 1; i < 10000; i++) {
     if (inTransaction) {
       txn.begin();
     }
     ex.getValue().clear();
     ex.to(i).fetchAndRemove();
     assertTrue("A value was fetched", ex.getValue().isDefined());
     if (inTransaction) {
       txn.commit();
       txn.end();
     }
   }
 }
  /**
   * Test for https://bugs.launchpad.net/akiban-persistit/+bug/1023549:
   *
   * <p>traverse(EQ, false, 0) returns incorrect result
   *
   * <p>This method returns true even when the tree is empty. traverse(EQ, true, 0) returns the
   * correct value.
   *
   * @throws Exception
   */
  @Test
  public void traverse_EQ_false_0__IsCorrect_Txn() throws Exception {
    final Transaction txn = _persistit.getTransaction();
    txn.begin();
    traverseCases(false);
    txn.commit();
    txn.end();

    txn.begin();
    traverseCases(true);
    txn.commit();
    txn.end();
  }