@Test(expected = IllegalStateException.class) public void deserializedRequestsShouldThrowWhenSecondParameterIsNotJson() throws JsonParseException, JsonMappingException, IOException { JsonNode[] nodes = new JsonNode[] { new ObjectNode(new JsonNodeFactory(false)).textNode("getAccounts"), new ObjectNode(new JsonNodeFactory(false)).textNode("true"), new ObjectNode(new JsonNodeFactory(false)).textNode("#0")}; InvocationRequest.deserialize(nodes); }
public static InvocationRequest deserialize(JsonNode[] json) { Preconditions.checkState(json.length == 3, "should have three elements"); Preconditions.checkState(json[0].isTextual(), "first element should be a String"); Preconditions.checkState(json[1].isObject(), "second element should be a Json"); Preconditions.checkState(json[2].isTextual(), "third element should be a String"); return new InvocationRequest(Method.Request.name(json[0].textValue()), (ObjectNode) json[1], MethodCallId.of(json[2].textValue())); }
InvocationRequest { public static InvocationRequest deserialize(JsonNode[] json) { Preconditions.checkState(json.length == 3, "should have three elements"); Preconditions.checkState(json[0].isTextual(), "first element should be a String"); Preconditions.checkState(json[1].isObject(), "second element should be a Json"); Preconditions.checkState(json[2].isTextual(), "third element should be a String"); return new InvocationRequest(Method.Request.name(json[0].textValue()), (ObjectNode) json[1], MethodCallId.of(json[2].textValue())); } }
InvocationRequest { public static InvocationRequest deserialize(JsonNode[] json) { Preconditions.checkState(json.length == 3, "should have three elements"); Preconditions.checkState(json[0].isTextual(), "first element should be a String"); Preconditions.checkState(json[1].isObject(), "second element should be a Json"); Preconditions.checkState(json[2].isTextual(), "third element should be a String"); return new InvocationRequest(Method.Request.name(json[0].textValue()), (ObjectNode) json[1], MethodCallId.of(json[2].textValue())); } protected  InvocationRequest(Method.Request.Name method, ObjectNode parameters, MethodCallId methodCallId); }
InvocationRequest { public static InvocationRequest deserialize(JsonNode[] json) { Preconditions.checkState(json.length == 3, "should have three elements"); Preconditions.checkState(json[0].isTextual(), "first element should be a String"); Preconditions.checkState(json[1].isObject(), "second element should be a Json"); Preconditions.checkState(json[2].isTextual(), "third element should be a String"); return new InvocationRequest(Method.Request.name(json[0].textValue()), (ObjectNode) json[1], MethodCallId.of(json[2].textValue())); } protected  InvocationRequest(Method.Request.Name method, ObjectNode parameters, MethodCallId methodCallId); static InvocationRequest deserialize(JsonNode[] json); Method.Request.Name getMethodName(); ObjectNode getParameters(); MethodCallId getMethodCallId(); }
InvocationRequest { public static InvocationRequest deserialize(JsonNode[] json) { Preconditions.checkState(json.length == 3, "should have three elements"); Preconditions.checkState(json[0].isTextual(), "first element should be a String"); Preconditions.checkState(json[1].isObject(), "second element should be a Json"); Preconditions.checkState(json[2].isTextual(), "third element should be a String"); return new InvocationRequest(Method.Request.name(json[0].textValue()), (ObjectNode) json[1], MethodCallId.of(json[2].textValue())); } protected  InvocationRequest(Method.Request.Name method, ObjectNode parameters, MethodCallId methodCallId); static InvocationRequest deserialize(JsonNode[] json); Method.Request.Name getMethodName(); ObjectNode getParameters(); MethodCallId getMethodCallId();  }