RequestParser { HTTPMethod httpMethod(String method) { try { return HTTPMethod.valueOf(method); } catch (IllegalArgumentException e) { throw new MethodNotAllowedException("method not allowed, method=" + method, e); } }  void parse(RequestImpl request, HttpServerExchange exchange, ActionLog actionLog); final ClientIPParser clientIPParser; public boolean logSiteHeaders; }
@Test void httpMethod() { assertThat(parser.httpMethod("POST")).isEqualTo(HTTPMethod.POST); assertThatThrownBy(() -> parser.httpMethod("TRACK")) .isInstanceOf(MethodNotAllowedException.class) .hasMessageContaining("method=TRACK"); }