### Question:
JettyWebSocketHandler extends EngineIoWebSocket implements WebSocketListener { @Override public void onWebSocketText(String message) { emit("message", (Object) message); } @SuppressWarnings("WeakerAccess")  JettyWebSocketHandler(EngineIoServer server); @Override Map<String, String> getQuery(); @Override void write(String message); @Override void write(byte[] message); @Override void close(); @Override void onWebSocketConnect(Session session); @Override void onWebSocketClose(int statusCode, String reason); @Override void onWebSocketError(Throwable cause); @Override void onWebSocketBinary(byte[] payload, int offset, int len); @Override void onWebSocketText(String message);  }### Answer:
@Test public void testOnMessage_string() { final String message = "FooBarBaz"; final EngineIoServer server = new EngineIoServer(); final JettyWebSocketHandler handler = Mockito.spy(new JettyWebSocketHandler(server)); handler.onWebSocketText(message); Mockito.verify(handler, Mockito.times(1)) .emit(Mockito.eq("message"), Mockito.eq(message)); }