HTTPConfig extends Config { public void intercept(Interceptor interceptor) { if (interceptor.getClass().isSynthetic()) throw new Error("interceptor class must not be anonymous class or lambda, please use static class, interceptorClass=" + interceptor.getClass().getCanonicalName()); new InjectValidator(interceptor).validate(); context.httpServer.handler.interceptors.add(interceptor); }  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 intercept() { assertThatThrownBy(() -> config.intercept(invocation -> null)) .isInstanceOf(Error.class) .hasMessageContaining("interceptor class must not be anonymous class or lambda"); }