TXEvent implements TransactionEvent, Releasable { @Override public Cache getCache() { return this.cache; } TXEvent(TXStateInterface localTxState, Cache cache); @Override TransactionId getTransactionId(); @Override synchronized List getEvents(); boolean hasOnlyInternalEvents(); @Override Cache getCache(); @Override synchronized void release();  }
@Test public void shouldBeMockable() throws Exception { TXEvent mockTXEvent = mock(TXEvent.class); Cache mockCache = mock(Cache.class); when(mockTXEvent.getCache()).thenReturn(mockCache); assertThat(mockTXEvent.getCache()).isSameAs(mockCache); }