### Question:
TransactionalDatabaseTemplate implements DatabaseTemplate, TransactionalResource { @Override public void delete(final Item item, final PersistenceExceptionHandler<?>... persistenceExceptionHandlers) { final DatabaseTransaction transaction = getCurrentTransaction(); final List<PersistenceExceptionHandler<?>> persistenceExceptionHandlerList = new ArrayList<PersistenceExceptionHandler<?>>(); Collections.addAll(persistenceExceptionHandlerList, persistenceExceptionHandlers); transaction.addDeleteAction(item, persistenceExceptionHandlerList); } TransactionalDatabaseTemplate(final DatabaseTemplate databaseTemplate); @Override void begin(); @Override void commit(); @Override T create(final T item, final PersistenceExceptionHandler<?>... persistenceExceptionHandlers); @Override T update(final T item, final PersistenceExceptionHandler<?>... persistenceExceptionHandlers); @Override void delete(final Item item, final PersistenceExceptionHandler<?>... persistenceExceptionHandlers); @Override T read(final ItemId itemId, final Class<T> itemClass); @Override Collection<T> fetch(final Query query, final Class<T> itemClass); @Override T fetchUnique(final Query query, final Class<T> itemClass); @Override GeneratedKeyHolder generateKeys(final SequenceKeyGenerator sequenceKeyGenerator); @Override void abort();  }### Answer:
@Test public void shouldNotDelete_withNonExistingTransaction() throws Exception { final TransactionalDatabaseTemplate transactionalDatabaseTemplate = new TransactionalDatabaseTemplate( mockDatabaseTemplate); final StubItem item = randomStubItem(); NonExistentTransactionException actualException = null; try { transactionalDatabaseTemplate.delete(item); } catch (final NonExistentTransactionException e) { actualException = e; } assertNotNull(actualException); }