### Question:
TransactionalFileStore implements FileStore, TransactionalResource { @Override public void begin() throws TransactionException { if (currentTransaction.get() != null) { throw new NestedTransactionException(currentTransaction.get()); } currentTransaction.set(new FileStoreTransaction()); logger.trace("Beginning transaction: " + currentTransaction.get().transactionId()); } TransactionalFileStore(final FileStore fileStore); @Override void begin(); @Override void commit(); @Override FileItem read(final FilePath filePath); @Override void write(final FilePath filePath, final FileItem fileItem); @Override void delete(final FilePath filePath); @Override void abort(); @Override List<FilePath> list(final String directory, final String prefix);  }### Answer:
@Test public void shouldBeginTransaction_withNoExistingTransaction() throws Exception { final TransactionalFileStore transactionalFileStore = new TransactionalFileStore(mockFileStore); Exception actualException = null; try { transactionalFileStore.begin(); } catch (final Exception e) { actualException = e; } assertNull(actualException); }
@Test public void shouldNotBeginTransaction_withExistingTransaction() throws Exception { final TransactionalFileStore transactionalFileStore = new TransactionalFileStore(mockFileStore); transactionalFileStore.begin(); NestedTransactionException actualException = null; try { transactionalFileStore.begin(); } catch (final NestedTransactionException e) { actualException = e; } assertNotNull(actualException); }