TopicsMessagesObservers { Object getPayload(MessageToClient msg) { Object payload; if(null != msg.getJson()) { payload = msg.getJson(); } else { payload = msg.getResponse(); } return payload; }  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 getPayloadTest() { System.out.println("getPayload"); MessageToClient mtc = new MessageToClient(); mtc.setResponse("RESPONSE"); Object result = instance.getPayload(mtc); assertThat(result).isEqualTo("RESPONSE"); mtc = new MessageToClient(); mtc.setJson("JSON"); result = instance.getPayload(mtc); assertThat(result).isEqualTo("JSON"); }