HaraHachiBuApplication extends Application<HaraHachiBuConfiguration> { @Override public void run(HaraHachiBuConfiguration config, Environment environment) throws Exception { final Client client = new JerseyClientBuilder(environment) .using(config.getJerseyClient()) .build(getName()); final DiskSpaceChecker checker = new DiskSpaceCheckerBuilder(environment, client, config.getDiskSpace()).build(); environment.servlets() .addFilter("diskSpaceFilter", new DiskSpaceFilter(checker, config.getProxy(), "/setSpace")) .addMappingForUrlPatterns(EnumSet.of(DispatcherType.REQUEST), true, "/*"); ServletRegistration.Dynamic diskSpaceProxyServlet = environment.servlets().addServlet("diskSpaceProxyServlet", new DiskSpaceProxyServlet()); diskSpaceProxyServlet.setInitParameter(DiskSpaceProxyServlet.DESTINATION_SERVER_PARAM, config.getProxy().getDestinationServer()); diskSpaceProxyServlet.addMapping(DiskSpaceProxyServlet.PROXY_PATH_PREFIX + "/*"); environment.healthChecks().register("Generic disk space checker", new DiskSpaceCheckerHealthCheck(checker)); }  @Override void run(HaraHachiBuConfiguration config, Environment environment); static void main(String[] args);  }
@Test public void buildsServlets() throws Exception { application.run(config, environment); }