### Question:
ServerXAResource extends UnicastExportable implements RemoteXAResource { public boolean isSameRM(RemoteXAResource remote) throws XAException { XAResource local = (remote == null) ? null : txnListener.getXAResource(remote); return (local == null) ? false : xaRes.isSameRM(local); } ServerXAResource(XAResource xaRes, ServerTransactionListener txnListener, Exporter exporter); void commit(Xid xid, boolean onePhase); void end(Xid xid, int flags); void forget(Xid xid); int getTransactionTimeout(); boolean isSameRM(RemoteXAResource remote); int prepare(Xid xid); Xid[] recover(int flag); void rollback(Xid xid); boolean setTransactionTimeout(int seconds); void start(Xid xid, int flags);  }### Answer:
@Test public void testIsSameRM() throws RemoteException, XAException { reset(res); expect(res.isSameRM(res)).andReturn(true); expect(txn.getXAResource(sx)).andReturn(res); expect(txn.getXAResource(isA(ServerXAResource.class))).andReturn(null); replay(res); replay(txn); assertTrue(sx.isSameRM(sx)); assertFalse(sx.isSameRM(null)); assertFalse(sx.isSameRM(new ServerXAResource(res, txn, exporter))); verify(res); verify(txn); }