ApplicationProviderBinder extends ProviderBinder { @Override public <T> ContextResolver<T> getContextResolver(Class<T> contextType, MediaType mediaType) { ContextResolver<T> resolver = doGetContextResolver(contextType, mediaType); if (resolver == null) { resolver = getDefaults().getContextResolver(contextType, mediaType); } return resolver; }  @Override List<MediaType> getAcceptableWriterMediaTypes(Class<?> type, Type genericType, Annotation[] annotations); @Override ContextResolver<T> getContextResolver(Class<T> contextType, MediaType mediaType); @Override ExceptionMapper<T> getExceptionMapper(Class<T> type); @Override MessageBodyReader<T> getMessageBodyReader(Class<T> type, Type genericType, Annotation[] annotations, MediaType mediaType); @Override MessageBodyWriter<T> getMessageBodyWriter(Class<T> type, Type genericType, Annotation[] annotations, MediaType mediaType); @Override List<MethodInvokerFilter> getMethodInvokerFilters(String path); @Override List<RequestFilter> getRequestFilters(String path); @Override List<ResponseFilter> getResponseFilters(String path);  }
@Test public void retrievesContextResolverByClassAndMediaType() { ContextResolverText stringContextResolver = new ContextResolverText(); applicationProviders.addContextResolver(stringContextResolver); assertSame(stringContextResolver, applicationProviders.getContextResolver(String.class, TEXT_PLAIN_TYPE)); }
@Test public void retrievesContextResolverFromEmbeddedProviderBinderByClassAndMediaTypeWhenRequiredContextResolverIsNotAvailableInApplicationProviderBinder() { ContextResolver<String> contextResolver = mock(ContextResolver.class); when(embeddedProviders.getContextResolver(String.class, TEXT_PLAIN_TYPE)).thenReturn(contextResolver); assertSame(contextResolver, applicationProviders.getContextResolver(String.class, TEXT_PLAIN_TYPE)); }