### Question:
ServerTransactionListener extends UnicastExportable implements Transaction, RemoteTransactionListener { public void registerSynchronization(Synchronization sync) throws RollbackException, IllegalStateException, SystemException { RemoteSynchronization rsync; try { rsync = new ServerSynchronization(sync, getExporter()); } catch (RemoteException e) { throw (SystemException) new SystemException("Failed to export Synchronization").initCause(e); } try { executeOnClient(new RegisterSynchronization(rsync)); } catch (ExecutionException e) { Throwable cause = e.getCause(); if (cause instanceof RollbackException) throw (RollbackException) cause; if (cause instanceof SystemException) throw (SystemException) cause; if (cause instanceof RuntimeException) throw (RuntimeException) cause; throw new RuntimeException("Error reported by server", cause); } } ServerTransactionListener(final BlobStore store, final Map<String, String> hints,
                                   Exporter exporter); Operation<?> getNextOperation(); void postResult(Result<?> result); void commit(); boolean delistResource(XAResource xaRes, int flags); boolean enlistResource(XAResource xaRes); int getStatus(); void registerSynchronization(Synchronization sync); void rollback(); void setRollbackOnly(); XAResource getXAResource(RemoteXAResource res);  }### Answer:
@Test public void testRegisterSynchronization() throws Exception { final Synchronization sync = createMock(Synchronization.class); Future<Void> future = executor.submit(new Callable<Void>() { public Void call() throws Exception { st.registerSynchronization(sync); return null; } }); Operation<?> op = st.getNextOperation(); assertTrue(op instanceof RegisterSynchronization); RemoteSynchronization rsync = ((RegisterSynchronization) op).getSynchronization(); assertTrue(rsync instanceof ServerSynchronization); assertEquals(sync, ((ServerSynchronization) rsync).getSynchronization()); st.postResult(new Result<Void>()); assertNull(future.get()); }