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));
}
Aggregations