use of javax.ws.rs.core.Application in project jersey by jersey.
the class ConstrainedToServerTest method testSpecificApplication.
@Test
public void testSpecificApplication() throws ExecutionException, InterruptedException {
Application app = new Application() {
@Override
public Set<Class<?>> getClasses() {
final HashSet<Class<?>> classes = new HashSet<>();
classes.add(Resource.class);
classes.add(MyClientFilter.class);
classes.add(MyServerWrongFilter.class);
return classes;
}
};
ApplicationHandler handler = new ApplicationHandler(app);
final ContainerResponse response = handler.apply(RequestContextBuilder.from("/resource", "GET").build()).get();
assertEquals(200, response.getStatus());
}
use of javax.ws.rs.core.Application in project jersey by jersey.
the class ApplicationTest method testGetClassesNull.
@Test
public void testGetClassesNull() {
Application a = new Application() {
@Override
public Set<Class<?>> getClasses() {
return null;
}
@Override
public Set<Object> getSingletons() {
return Collections.emptySet();
}
};
new ApplicationHandler(a);
}
use of javax.ws.rs.core.Application in project jersey by jersey.
the class ApplicationTest method testGetClassesContainsNull.
@Test
public void testGetClassesContainsNull() {
Application a = new Application() {
@Override
public Set<Class<?>> getClasses() {
return new HashSet<Class<?>>() {
{
add(null);
add(DummyResource.class);
}
};
}
@Override
public Set<Object> getSingletons() {
return Collections.emptySet();
}
};
new ApplicationHandler(a);
}
use of javax.ws.rs.core.Application in project jersey by jersey.
the class ApplicationTest method testGetSingletonsContainsNull.
@Test
public void testGetSingletonsContainsNull() {
Application a = new Application() {
@Override
public Set<Class<?>> getClasses() {
return Collections.emptySet();
}
@Override
public Set<Object> getSingletons() {
return new HashSet<Object>() {
{
add(null);
add(new DummyResource());
}
};
}
};
new ApplicationHandler(a);
}
use of javax.ws.rs.core.Application in project jersey by jersey.
the class AsyncApplicationBuildingTest method testAppBuilderJaxRsApplication.
@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());
}
Aggregations