}
});
Injector injector = app.initialize();
LifeCycleManager lifeCycleManager = injector.getInstance(LifeCycleManager.class);
TestingHttpServer server = injector.getInstance(TestingHttpServer.class);
try (HttpClient client = new JettyHttpClient(new HttpClientConfig().setConnectTimeout(new Duration(1, SECONDS)))) {
// test http resources
URI uri = server.getBaseUrl();
assertResource(uri, client, "", "welcome user!");
assertResource(uri, client, "user-welcome.txt", "welcome user!");
assertResource(uri, client, "user.txt", "user");
assertResource(uri, client, "user2.txt", "user2");
assertResource(uri, client, "path", "welcome user!");
assertResource(uri, client, "path/", "welcome user!");
assertResource(uri, client, "path/user-welcome.txt", "welcome user!");
assertResource(uri, client, "path/user.txt", "user");
assertResource(uri, client, "path/user2.txt", "user2");
// verify that servlet did not receive resource requests
assertEquals(servlet.getCallCount(), 0);
}
finally {
lifeCycleManager.stop();
}
}