### Question:
Service { public void sendResponse(ServiceResponse response, String id) { JsonObject call = Json.createObjectBuilder() .add(JRosbridge.FIELD_OP, JRosbridge.OP_CODE_SERVICE_RESPONSE) .add(JRosbridge.FIELD_ID, id) .add(JRosbridge.FIELD_SERVICE, this.name) .add(JRosbridge.FIELD_VALUES, response.toJsonObject()) .add(JRosbridge.FIELD_RESULT, response.getResult()).build(); this.ros.send(call); } Service(Ros ros, String name, String type); Ros getRos(); String getName(); String getType(); boolean isAdvertised(); void callService(ServiceRequest request, ServiceCallback cb); void sendResponse(ServiceResponse response, String id); void advertiseService(CallServiceCallback cb); void unadvertiseService(); synchronized ServiceResponse callServiceAndWait(
			ServiceRequest request);  }### Answer:
@Test public void testSendResponse() { ServiceResponse resp = new ServiceResponse("{\"test1\":\"test2\"}", true); s1.sendResponse(resp, "myServiceId"); while (DummyHandler.latest == null) { Thread.yield(); } assertNotNull(DummyHandler.latest); assertEquals( "{\"op\":\"service_response\",\"id\":\"myServiceId\"," + "\"service\":\"myService\",\"values\":{\"test1\":\"test2\"},\"result\":true}", DummyHandler.latest.toString()); }