### Question:
JSDebuggerWebSocketClient extends WebSocketListener { public void loadApplicationScript( String sourceURL, HashMap<String, String> injectedObjects, JSDebuggerCallback callback) { int requestID = mRequestID.getAndIncrement(); mCallbacks.put(requestID, callback); try { StringWriter sw = new StringWriter(); JsonWriter js = new JsonWriter(sw) .beginObject() .name("id").value(requestID) .name("method").value("executeApplicationScript") .name("url").value(sourceURL) .name("inject").beginObject(); for (String key : injectedObjects.keySet()) { js.name(key).value(injectedObjects.get(key)); } js.endObject().endObject().close(); sendMessage(requestID, sw.toString()); } catch (IOException e) { triggerRequestFailure(requestID, e); } }  void connect(String url, JSDebuggerCallback callback); void prepareJSRuntime(JSDebuggerCallback callback); void loadApplicationScript(
      String sourceURL,
      HashMap<String, String> injectedObjects,
      JSDebuggerCallback callback); void executeJSCall(
      String methodName,
      String jsonArgsArray,
      JSDebuggerCallback callback); void closeQuietly(); @Override void onMessage(WebSocket webSocket, String text); @Override void onFailure(WebSocket webSocket, Throwable t, Response response); @Override void onOpen(WebSocket webSocket, Response response); @Override void onClosed(WebSocket webSocket, int code, String reason);  }### Answer:
@Test public void test_loadApplicationScript_ShouldSendCorrectMessage() throws Exception { final JSDebuggerWebSocketClient.JSDebuggerCallback cb = PowerMockito.mock(JSDebuggerWebSocketClient.JSDebuggerCallback.class); JSDebuggerWebSocketClient client = PowerMockito.spy(new JSDebuggerWebSocketClient()); HashMap<String, String> injectedObjects = new HashMap<>(); injectedObjects.put("key1", "value1"); injectedObjects.put("key2", "value2"); client.loadApplicationScript("http: PowerMockito.verifyPrivate(client).invoke("sendMessage", 0, "{\"id\":0,\"method\":\"executeApplicationScript\",\"url\":\"http: ",\"inject\":{\"key1\":\"value1\",\"key2\":\"value2\"}}"); }