EndpointsModule extends ServletModule { protected void configureEndpoints( String urlPattern, Iterable<? extends Class<?>> serviceClasses) { configureEndpoints(urlPattern, serviceClasses, false); }    }
@Test public void testConfigureEndpoints_defaultInitParameters() { module = new EndpointsModule() { @Override protected void configureServlets() { super.configureServlets(); configureEndpoints(URL_PATTERN, SERVICES, true); } }; Injector injector = Guice.createInjector(module, new DummyModule()); Visitor visitor = new Visitor(); for (Binding<?> binding : injector.getAllBindings().values()) { binding.acceptTargetVisitor(visitor); } assertEquals("Servlet not bound.", 1, visitor.linkedServlets.size()); LinkedServletBinding servletBinding = visitor.linkedServlets.get(0); assertEquals("URL pattern does not match", URL_PATTERN, servletBinding.getPattern()); assertEquals("Wrong initialization parameter provided", "true", servletBinding.getInitParams().get("restricted")); assertNotNull("SystemService named provider not found.", visitor.systemServiceProvider); ServiceMap serviceMap = (ServiceMap) visitor.systemServiceProvider.getProvider().get(); Collection<Object> services = serviceMap.getServices(); assertEquals("Incorrect number of services provided", 1, services.size()); assertEquals("Service not provided correctly.", SERVICES.toArray()[0], services.toArray()[0].getClass()); }