EndpointsMethodHandler { public DispatcherHandler<EndpointsContext> getRestHandler() { return restHandler; } EndpointsMethodHandler(ServletInitializationParameters initParameters,
      ServletContext servletContext, EndpointMethod endpointMethod, ApiMethodConfig methodConfig,
      SystemService systemService); String getRestMethod(); String getRestPath(); DispatcherHandler<EndpointsContext> getRestHandler();  }
@Test public void simple() throws Exception { TestMethodHandler handler = createTestHandler("simple", RESOURCE, RESOURCE); handler.getRestHandler().handle(context); }
@Test public void simple_withCors() throws Exception { TestMethodHandler handler = createTestHandler("simple", RESOURCE, RESOURCE); request.addHeader("Origin", "http: handler.getRestHandler().handle(context); assertThat(response.getHeader("Access-Control-Allow-Origin")).isEqualTo("http: assertThat(response.getHeader("Access-Control-Allow-Credentials")).isEqualTo("true"); }
@Test public void fail() throws Exception { TestMethodHandler handler = createTestHandler("fail", 404); handler.getRestHandler().handle(context); }
@Test public void fail_findService() throws Exception { EndpointMethod method = systemService.resolveService("TestEndpoint", "simple"); ApiMethodConfig methodConfig = new ApiMethodConfig(method, typeLoader, apiConfig.getApiClassConfig()); systemService = SystemService.builder() .withDefaults(classLoader) .addService(ArrayEndpoint.class, new ArrayEndpoint()) .build(); TestMethodHandler handler = new TestMethodHandler( ServletInitializationParameters.builder().build(), method, methodConfig, systemService, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, RESOURCE); handler.getRestHandler().handle(context); }