JgroupsMessageSender { public <T> RspList<T> sendToClusterSync(Serializable content) throws Exception { return this.dispatcher.castMessage(getMembersAddresses(), new Message(null, content), SYNC_OPTIONS); } JgroupsMessageSender(MessageDispatcher dispatcher); RspList<T> sendToClusterSync(Serializable content); void sendToClusterAsync(Serializable content, Set<Address> addressesToSkip, FutureListener<RspList<T>> listener); void sendToClusterAsync(Serializable content, FutureListener<RspList<T>> listener); void sendToAddressAsync(Address address, Serializable content); T sendToAddressSync(Address address, Serializable content); boolean isEmptyCluster();  }
@Test public void testSendToClusterSync() throws Exception { new Expectations(jgroupsMessageSender) {{ jgroupsMessageSender.getMembersAddresses(); result = Collections.emptyList(); }}; String id = UUID.randomUUID().toString(); jgroupsMessageSender.sendToClusterSync(id); new Verifications() {{ Message msg; RequestOptions options; List<Address> addresses; dispatcher.castMessage(addresses = withCapture(), msg = withCapture(), options = withCapture()); assertThat(msg.getObject()).isEqualTo(id); assertThat(msg.getDest()).isNull(); assertThat(options.getMode()).isEqualTo(ResponseMode.GET_ALL); assertThat(addresses).isEmpty(); }}; }