@Test public void pipesInputsAndOutputsToThePatchMethod() { final Response expectedResponse = OK(Text("Hello WOrld")); final PatchTestingObject o = new PatchTestingObject("/foo", expectedResponse); final Request input = new MockRequest(o, "/foo"); Response result = HttpObjectUtil.invokeMethod(o, Method.PATCH, input); assertNotNull(result); assertTrue(expectedResponse == result); assertEquals(1, o.requestsRecieved.size()); assertTrue(input == o.requestsRecieved.get(0)); }
public static Response invokeMethod(HttpObject object, final Method m, final Request input) { final Response output; switch(m){ case GET: output = object.get(input); break; case DELETE: output = object.delete(input); break; case POST: output = object.post(input); break; case PUT: output = object.put(input); break; case PATCH: output = object.patch(input); break; case HEAD: output = object.head(input); break; case OPTIONS: output = object.options(input); break; case TRACE: output = object.trace(input); break; default: output = HttpObject.NOT_IMPLEMENTED(); } return output; }
HttpObjectUtil { public static Response invokeMethod(HttpObject object, final Method m, final Request input) { final Response output; switch(m){ case GET: output = object.get(input); break; case DELETE: output = object.delete(input); break; case POST: output = object.post(input); break; case PUT: output = object.put(input); break; case PATCH: output = object.patch(input); break; case HEAD: output = object.head(input); break; case OPTIONS: output = object.options(input); break; case TRACE: output = object.trace(input); break; default: output = HttpObject.NOT_IMPLEMENTED(); } return output; } }
HttpObjectUtil { public static Response invokeMethod(HttpObject object, final Method m, final Request input) { final Response output; switch(m){ case GET: output = object.get(input); break; case DELETE: output = object.delete(input); break; case POST: output = object.post(input); break; case PUT: output = object.put(input); break; case PATCH: output = object.patch(input); break; case HEAD: output = object.head(input); break; case OPTIONS: output = object.options(input); break; case TRACE: output = object.trace(input); break; default: output = HttpObject.NOT_IMPLEMENTED(); } return output; }  }
HttpObjectUtil { public static Response invokeMethod(HttpObject object, final Method m, final Request input) { final Response output; switch(m){ case GET: output = object.get(input); break; case DELETE: output = object.delete(input); break; case POST: output = object.post(input); break; case PUT: output = object.put(input); break; case PATCH: output = object.patch(input); break; case HEAD: output = object.head(input); break; case OPTIONS: output = object.options(input); break; case TRACE: output = object.trace(input); break; default: output = HttpObject.NOT_IMPLEMENTED(); } return output; }  static Response invokeMethod(HttpObject object, final Method m, final Request input); static byte[] toByteArray(Representation r); static String toAscii(Representation r); static String toUtf8(Representation r); static String toString(Representation r, String charsetName); }
HttpObjectUtil { public static Response invokeMethod(HttpObject object, final Method m, final Request input) { final Response output; switch(m){ case GET: output = object.get(input); break; case DELETE: output = object.delete(input); break; case POST: output = object.post(input); break; case PUT: output = object.put(input); break; case PATCH: output = object.patch(input); break; case HEAD: output = object.head(input); break; case OPTIONS: output = object.options(input); break; case TRACE: output = object.trace(input); break; default: output = HttpObject.NOT_IMPLEMENTED(); } return output; }  static Response invokeMethod(HttpObject object, final Method m, final Request input); static byte[] toByteArray(Representation r); static String toAscii(Representation r); static String toUtf8(Representation r); static String toString(Representation r, String charsetName);  }