HTTPConfig extends Config { public void route(HTTPMethod method, String path, Controller controller) { if (HTTPIOHandler.HEALTH_CHECK_PATH.equals(path)) throw new Error("/health-check is reserved path"); context.route(method, path, controller, false); }  void route(HTTPMethod method, String path, Controller controller); void route(HTTPMethod method, String path, LambdaController controller); void bean(Class<?> beanClass); void intercept(Interceptor interceptor); void errorHandler(ErrorHandler handler); void httpPort(int port); void httpsPort(int port); LimitRateConfig limitRate(); void maxForwardedIPs(int maxIPs); AccessConfig access(); void gzip();  }
@Test void route() { var controllers = new TestControllers(); config.route(GET, "/route-test", controllers::get); config.route(POST, "/route-test", controllers::post); var controller = new TestController(); config.route(PUT, "/route-test", controller); config.route(DELETE, "/route-test", controller); config.route(PATCH, "/route-test", controller); }
@Test void routeWithReservedPath() { assertThatThrownBy(() -> config.route(GET, HTTPIOHandler.HEALTH_CHECK_PATH, new TestController())) .isInstanceOf(Error.class) .hasMessageContaining("/health-check is reserved path"); }