JDiscHttpRequestHandler extends LoggingRequestHandler { static HttpRequest setOperation(HttpRequest request, com.yahoo.jdisc.http.HttpRequest.Method method) { switch (method) { case GET: return request.setHttpOperation(HttpRequest.HttpOp.GET); case POST: return request.setHttpOperation(HttpRequest.HttpOp.POST); case PUT: return request.setHttpOperation(HttpRequest.HttpOp.PUT); case DELETE: return request.setHttpOperation(HttpRequest.HttpOp.DELETE); default: throw new IllegalStateException("Unhandled method " + method); } } JDiscHttpRequestHandler(HttpRequestHandler handler, LoggingRequestHandler.Context parentCtx); @Override com.yahoo.container.jdisc.HttpResponse handle(com.yahoo.container.jdisc.HttpRequest request);  }
@Test public void testInvalidMethod() throws Exception { try{ HttpRequest request = new HttpRequest(); JDiscHttpRequestHandler.setOperation(request, com.yahoo.jdisc.http.HttpRequest.Method.CONNECT); fail("Control should not reach here"); } catch (IllegalStateException e) { assertEquals("Unhandled method CONNECT", e.getMessage()); } }