### Question:
WebSocketEndpoint { @OnMessage public void onMessage(String message, @PathParam("username") String username) { broadcaster.broadcast(">> " + username + ": " + message); LOGGER.info(username + " send message: " + message); }  @OnOpen void onOpen(Session session, @PathParam("username") String username); @OnClose void onClose(Session session, @PathParam("username") String username); @OnError void onError(Session session, @PathParam("username") String username, Throwable throwable); @OnMessage void onMessage(String message, @PathParam("username") String username);  }### Answer:
@Test void onMessage() { webSocketEndpoint.onMessage("Message!", "user2"); Mockito.verify(broadcaster).broadcast(">> user2: Message!"); }