### Question:
ClientXAResource implements XAResource { public int prepare(Xid xid) throws XAException { try { return remote.prepare(serialized(xid)); } catch (RemoteException e) { throw (XAException) new XAException("RMI faiure").initCause(e); } } ClientXAResource(RemoteXAResource xaRes, ClientTransactionListener txn); void commit(Xid xid, boolean onePhase); void end(Xid xid, int flags); void forget(Xid xid); int getTransactionTimeout(); boolean isSameRM(XAResource xa); int prepare(Xid xid); Xid[] recover(int flag); void rollback(Xid xid); boolean setTransactionTimeout(int seconds); void start(Xid xid, int flag);  }### Answer:
@Test public void testPrepare() throws XAException { reset(res); expect(res.prepare(isA(SerializedXid.class))).andReturn(XAResource.XA_OK); replay(res); assertEquals(XAResource.XA_OK, cx.prepare(xid)); verify(res); }