### Question:
ReadOnlyInterceptor implements Serializable { @AroundInvoke public Object markReadOnly(InvocationContext ic) throws Exception { try { return ic.proceed(); } finally { utTransactionHolder.getUserTransaction().setRollbackOnly(); } } ReadOnlyInterceptor();  ReadOnlyInterceptor(UserTransaction aTx); @AroundInvoke Object markReadOnly(InvocationContext ic);  }### Answer:
@Test public void beginAndRollbackTransaction() throws Exception { transactionFactory.expectNoTransaction(); transactionFactory.expectBeginTransaction(); transactionFactory.expectSetRollbackOnly(); transactionFactory.expectRollbackTransaction(); transactionFactory.replay(); try { final InvocationContext mock = createMock(InvocationContext.class); expect(mock.proceed()).andAnswer(new IAnswer<Object>() { public Object answer() throws Throwable { return readOnlyInterceptor.markReadOnly(mock); } }); expect(mock.proceed()).andReturn(null); replay(mock); txInterceptor.applyTransaction(mock); verify(mock); } finally { transactionFactory.verify(); } }