static HttpRequest setOperation(HttpRequest request, com.yahoo.jdisc.http.HttpRequest.Method method) {
        return switch (method) {
            case GET -> request.setHttpOperation(HttpRequest.HttpOp.GET);
            case POST -> request.setHttpOperation(HttpRequest.HttpOp.POST);
            case PUT -> request.setHttpOperation(HttpRequest.HttpOp.PUT);
            case DELETE -> request.setHttpOperation(HttpRequest.HttpOp.DELETE);
            default -> throw new IllegalStateException("Unhandled method " + method);
        };
    }
@Test
    void testInvalidMethod() {
        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());
        }
    }