@Test public void testAsyncApp2() throws InterruptedException, ExecutionException { ContainerRequest req = RequestContextBuilder.from(BASE_URI, BASE_URI + "a/b/d", "GET").build(); Future<ContainerResponse> res = setupApplication1().apply(req); assertEquals("A-B-D", res.get().getEntity()); }
@Test public void testEmptyAppCreationPasses() throws InterruptedException, ExecutionException { final ResourceConfig resourceConfig = new ResourceConfig(); final ApplicationHandler application = new ApplicationHandler(resourceConfig); ContainerRequest req = RequestContextBuilder.from(BASE_URI, BASE_URI, "GET").build(); assertEquals(404, application.apply(req).get().getStatus()); }
@Test public void testappBuilderClasses() throws InterruptedException, ExecutionException { final ResourceConfig resourceConfig = new ResourceConfig(ResourceA.class); final ApplicationHandler application = new ApplicationHandler(resourceConfig); ContainerRequest req = RequestContextBuilder.from(BASE_URI, BASE_URI, "GET").build(); assertEquals("get!", application.apply(req).get().getEntity()); }
@Test public void testAppBuilderJaxRsApplication() throws InterruptedException, ExecutionException { Application jaxRsApplication = new Application() { @Override public Set<Class<?>> getClasses() { HashSet<Class<?>> set = new HashSet<Class<?>>(); set.add(ResourceA.class); return set; } @Override public Set<Object> getSingletons() { return super.getSingletons(); } }; final ApplicationHandler application = new ApplicationHandler(jaxRsApplication); ContainerRequest req = RequestContextBuilder.from(BASE_URI, BASE_URI, "GET").build(); assertEquals("get!", application.apply(req).get().getEntity()); }