TopicsMessagesObservers { public int sendMessageToTopic(@Observes @MessageEvent MessageToClient msg) { return topicsMessagesBroadcaster.sendMessageToTopic(msg, getPayload(msg)); }  void sendObjectToTopic(@Observes @JsTopicEvent("") Object payload, EventMetadata metadata); int sendMessageToTopic(@Observes @MessageEvent MessageToClient msg); int sendMessageToUserTopic(@Observes @MessageEvent(userScope = true) MessageToClient msg);  }
@Test public void sendMessageToTopicTest() { System.out.println("sendMessageToTopic"); MessageToClient mtc = mock(MessageToClient.class); doReturn(PAYLOAD).when(instance).getPayload(eq(mtc)); when(topicsMessagesBroadcaster.sendMessageToTopic(eq(mtc), eq(PAYLOAD))).thenReturn(1); int result = instance.sendMessageToTopic(mtc); assertThat(result).isEqualTo(1); verify(topicsMessagesBroadcaster).sendMessageToTopic(eq(mtc), eq(PAYLOAD)); }