@Test
  public void transactionRollback() throws Exception {
    try (final KeyValueStorage store = createStore()) {
      // Add some values
      KeyValueStorageTransaction tx = store.startTransaction();
      tx.put(bytesOf(1), bytesOf(1));
      tx.put(bytesOf(2), bytesOf(2));
      tx.put(bytesOf(3), bytesOf(3));
      tx.commit();

      // Start transaction that adds, modifies, and removes some values
      tx = store.startTransaction();
      tx.put(bytesOf(2), bytesOf(3));
      tx.put(bytesOf(2), bytesOf(4));
      tx.remove(bytesOf(3));
      tx.put(bytesOf(4), bytesOf(8));

      // Check values before committing have not changed
      assertThat(store.get(bytesOf(1))).contains(bytesOf(1));
      assertThat(store.get(bytesOf(2))).contains(bytesOf(2));
      assertThat(store.get(bytesOf(3))).contains(bytesOf(3));
      assertThat(store.get(bytesOf(4))).isEmpty();

      tx.rollback();

      // Check that values have not changed after rollback
      assertThat(store.get(bytesOf(1))).contains(bytesOf(1));
      assertThat(store.get(bytesOf(2))).contains(bytesOf(2));
      assertThat(store.get(bytesOf(3))).contains(bytesOf(3));
      assertThat(store.get(bytesOf(4))).isEmpty();
    }
  }
Transaction rollback.

@throws Exception the exception
testutil/src/main/java/org/hyperledger/besu/kvstore/AbstractKeyValueStorageTest.java