@Test public void testIsActiveFalse() throws Exception { expect(et.isActive()).andReturn(false).anyTimes(); expect(em.getTransaction()).andReturn(et).anyTimes(); cache.put("teste", em); expect(producer.getCache()).andReturn(cache); replay(producer); replayAll(); replay(em); replay(et); assertEquals(false, tx.isActive()); verifyAll(); }
@Test public void testBegin() throws SystemException { et.begin(); expect(et.isActive()).andReturn(false); expect(em.getTransaction()).andReturn(et).anyTimes(); cache.put("teste", em); expect(producer.getCache()).andReturn(cache); replay(producer); replayAll(); replay(em); replay(et); tx.begin(); verifyAll(); }
@Test public void testIsMarkedRollbackTrue() throws Exception { expect(et.isActive()).andReturn(true); expect(et.getRollbackOnly()).andReturn(true).anyTimes(); expect(em.getTransaction()).andReturn(et).anyTimes(); cache.put("teste", em); expect(producer.getCache()).andReturn(cache); replay(producer); replayAll(); replay(em); replay(et); assertEquals(true, tx.isMarkedRollback()); verifyAll(); }
@Test public void testSetRollbackOnly() throws Exception { et.setRollbackOnly(); expect(et.isActive()).andReturn(true); expect(em.getTransaction()).andReturn(et).anyTimes(); cache.put("teste", em); expect(producer.getCache()).andReturn(cache); replay(producer); replayAll(); replay(em); replay(et); tx.setRollbackOnly(); verifyAll(); }