CheckedDatastore extends CheckedDatastoreReaderWriter { CheckedDatastoreTransaction newTransaction() throws DatastoreIOException { try { return new CheckedDatastoreTransaction(this, datastore.newTransaction()); } catch (DatastoreException e) { throw new DatastoreIOException(e); } } CheckedDatastore(Datastore datastore);   }
@Test public void newTransaction() throws DatastoreIOException { when(datastore.newTransaction()).thenReturn(transaction); assertThat(sut.newTransaction().tx, is(transaction)); verify(datastore).newTransaction(); }
@Test public void newTransactionShouldThrowCheckedException() throws DatastoreIOException { when(datastore.newTransaction()).thenThrow(CAUSE); exception.expect(DatastoreIOException.class); exception.expectCause(is(CAUSE)); sut.newTransaction(); }