### Question:
TransactionalDatabaseTemplate implements DatabaseTemplate, TransactionalResource { @Override public <T extends Item> Collection<T> fetch(final Query query, final Class<T> itemClass) { return databaseTemplate.fetch(query, itemClass); } 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 shouldFetch_withQueryAndItemClass() throws Exception { final Query query = mock(Query.class); final Set<StubItem> items = Sets.newSet(randomStubItem(), randomStubItem(), randomStubItem()); when(mockDatabaseTemplate.fetch(any(Query.class), any(Class.class))).thenReturn(items); final TransactionalDatabaseTemplate transactionalDatabaseTemplate = new TransactionalDatabaseTemplate( mockDatabaseTemplate); final Collection<StubItem> returnedItems = transactionalDatabaseTemplate.fetch(query, StubItem.class); verify(mockDatabaseTemplate).fetch(query, StubItem.class); assertEquals(items, returnedItems); }