TransactionManagerImpl implements TransactionManager, TransactionCompletionListener { public Transaction beginTransaction() { return beginTransaction(true); } @Inject  TransactionManagerImpl(TransactionFactory factory, TransactionInMemoryCache memCache); Transaction beginTransaction(); Transaction beginTransaction(boolean isolatedTransaction); Transaction getCurrentTransaction(); void transactionComplete(TransactionCompletionEvent event);  }
@Test public void testBeginTransaction() { Injector injector = initializeInjector(); final TransactionManager manager = injector.getInstance(TransactionManager.class); mockery.checking(new Expectations() { { exactly(1).of(factory).createTransaction(true); final Transaction txMock = mockery.mock(Transaction.class); will(returnValue(txMock)); exactly(1).of(txMock).addTransactionCompletionListener((TransactionCompletionListener) manager); } }); manager.beginTransaction(); mockery.assertIsSatisfied(); }