ApplicationProviderBinder extends ProviderBinder { @Override public <T> MessageBodyReader<T> getMessageBodyReader(Class<T> type, Type genericType, Annotation[] annotations, MediaType mediaType) { MessageBodyReader<T> reader = doGetMessageBodyReader(type, genericType, annotations, mediaType); if (reader == null) { reader = getDefaults().getMessageBodyReader(type, genericType, annotations, mediaType); } return reader; }  @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 retrievesMessageBodyReaderByTypeAndMediaType() { MessageBodyReader<String> stringMessageBodyReader = new StringEntityProvider(); applicationProviders.addMessageBodyReader(stringMessageBodyReader); assertSame(stringMessageBodyReader, applicationProviders.getMessageBodyReader(String.class, null, null, TEXT_PLAIN_TYPE)); }
@Test public void retrievesMessageBodyReaderFromEmbeddedProviderBinderByTypeAndMediaTypeWhenRequiredMessageBodyReaderIsNotAvailableInApplicationProviderBinder() { MessageBodyReader<String> stringMessageBodyReader = mock(MessageBodyReader.class); when(applicationProviders.getMessageBodyReader(String.class, null, null, TEXT_PLAIN_TYPE)).thenReturn(stringMessageBodyReader); assertSame(stringMessageBodyReader, applicationProviders.getMessageBodyReader(String.class, null, null, TEXT_PLAIN_TYPE)); }