Search in sources :

Example 16 with ContractProvider

use of org.glassfish.jersey.model.ContractProvider in project jersey by jersey.

the class CommonConfigTest method testRegisterClassInstanceClash.

@Test
public void testRegisterClassInstanceClash() throws Exception {
    final ComplexEmptyProvider complexEmptyProvider = new ComplexEmptyProvider();
    config.register(ComplexEmptyProvider.class);
    config.register(complexEmptyProvider);
    config.register(ComplexEmptyProvider.class);
    assertTrue(config.getClasses().contains(ComplexEmptyProvider.class));
    assertFalse(config.getInstances().contains(complexEmptyProvider));
    final ContractProvider contractProvider = config.getComponentBag().getModel(ComplexEmptyProvider.class);
    final Set<Class<?>> contracts = contractProvider.getContracts();
    assertEquals(3, contracts.size());
    assertTrue(contracts.contains(ReaderInterceptor.class));
    assertTrue(contracts.contains(ContainerRequestFilter.class));
    assertTrue(contracts.contains(ExceptionMapper.class));
}
Also used : ReaderInterceptor(javax.ws.rs.ext.ReaderInterceptor) ExceptionMapper(javax.ws.rs.ext.ExceptionMapper) ContractProvider(org.glassfish.jersey.model.ContractProvider) ContainerRequestFilter(javax.ws.rs.container.ContainerRequestFilter) Test(org.junit.Test)

Aggregations

ContractProvider (org.glassfish.jersey.model.ContractProvider)16 ContainerRequestFilter (javax.ws.rs.container.ContainerRequestFilter)10 Test (org.junit.Test)10 ReaderInterceptor (javax.ws.rs.ext.ReaderInterceptor)9 ExceptionMapper (javax.ws.rs.ext.ExceptionMapper)5 Annotation (java.lang.annotation.Annotation)4 RuntimeType (javax.ws.rs.RuntimeType)3 WriterInterceptor (javax.ws.rs.ext.WriterInterceptor)3 Type (java.lang.reflect.Type)2 ArrayList (java.util.ArrayList)2 Collection (java.util.Collection)2 Collections (java.util.Collections)2 List (java.util.List)2 Set (java.util.Set)2 Function (java.util.function.Function)2 Collectors (java.util.stream.Collectors)2 Singleton (javax.inject.Singleton)2 NameBinding (javax.ws.rs.NameBinding)2 PreMatching (javax.ws.rs.container.PreMatching)2 OutputStream (java.io.OutputStream)1