コード例 #1
0
  @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();
  }
コード例 #2
0
  @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();
  }
コード例 #3
0
  @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();
  }
コード例 #4
0
  @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();
  }