@Test
@UseDataProvider("contextResolverByClassAndMediaTypeData")
public void retrievesContextResolverByClassAndMediaType(boolean singletonOrPerRequest,
                                                        Class<?> aClass,
                                                        MediaType mediaType,
                                                        Object expectedContextResolverClassOrInstance) throws Exception {

    if (singletonOrPerRequest == SINGLETON) {
        registerSingletonContextResolvers();
    } else {
        registerPerRequestContextResolvers();
    }
    ContextResolver<?> contextResolver = providers.getContextResolver(aClass, mediaType);
    if (singletonOrPerRequest == SINGLETON) {
        assertSame(expectedContextResolverClassOrInstance, contextResolver);
    } else {
        if (expectedContextResolverClassOrInstance == null) {
            assertNull(contextResolver);
        } else {
            assertNotNull(contextResolver);
            assertEquals(expectedContextResolverClassOrInstance, contextResolver.getClass());
        }
    }
}