CommonTxDao implements CommonDao<T, String> { public Set<T> getAll() { return this.readDao.getAll(); } @Inject  CommonTxDao(@Transactionable CommonReadDao<T, String> readDao,
                     @Transactionable CommonWriteDao<T> writeDao, TransactionService txService,
                     TransactionManager txManager, TransactionInMemoryCache memCache, Class<T> entityClass); Set<T> getByIds(List<String> ids); T getById(String id); T getSingle(QueryParameter... query); T getSingle(List<QueryParameter> query); Set<T> getAll(); List<T> getList(List<QueryParameter> query); OtherTemplate getOther(List<QueryParameter> query); List<OtherTemplate> getOtherList(List<QueryParameter> query); List<T> getList(QueryParameter... query); OtherTemplate getOther(QueryParameter... query); List<OtherTemplate> getOtherList(QueryParameter... query); void save(T... states); void update(T... states); void delete(T... states);  }
@Test public void testGetAllDelegation() { final Set<DemoDomain> all = new HashSet<DemoDomain>(); mockery.checking(new Expectations() { { exactly(1).of(readDao).getAll(); will(returnValue(all)); } }); Assert.assertSame(all, this.services.readDao.getAll()); mockery.assertIsSatisfied(); }