ProviderBinder implements Providers { public List<MethodInvokerFilter> getMethodInvokerFilters(String path) { ApplicationContext context = ApplicationContext.getCurrent(); return doGetMatchedFilters(path, invokerFilters).stream() .map(factory -> (MethodInvokerFilter)factory.getInstance(context)) .collect(toList()); } protected  ProviderBinder(); static ProviderBinder getInstance(); static void setInstance(ProviderBinder providerBinder); void addContextResolver(Class<? extends ContextResolver> contextResolverClass); void addContextResolver(ContextResolver contextResolver); @SuppressWarnings({"unchecked"}) void addExceptionMapper(Class<? extends ExceptionMapper> exceptionMapperClass); @SuppressWarnings({"unchecked"}) void addExceptionMapper(ExceptionMapper exceptionMapper); void addMessageBodyReader(Class<? extends MessageBodyReader> messageBodyReaderClass); @SuppressWarnings({"unchecked"}) void addMessageBodyReader(MessageBodyReader messageBodyReader); void addMessageBodyWriter(Class<? extends MessageBodyWriter> messageBodyWriter); void addMessageBodyWriter(MessageBodyWriter messageBodyWriter); void addMethodInvokerFilter(Class<? extends MethodInvokerFilter> methodInvokerFilterClass); void addMethodInvokerFilter(MethodInvokerFilter methodInvokerFilter); void addRequestFilter(Class<? extends RequestFilter> requestFilterClass); void addRequestFilter(RequestFilter requestFilter); void addResponseFilter(Class<? extends ResponseFilter> responseFilterClass); void addResponseFilter(ResponseFilter responseFilter); List<MediaType> getAcceptableWriterMediaTypes(Class<?> type, Type genericType, Annotation[] annotations); @Override ContextResolver<T> getContextResolver(Class<T> contextType, MediaType mediaType); @Override ExceptionMapper<T> getExceptionMapper(Class<T> errorType); @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); List<MethodInvokerFilter> getMethodInvokerFilters(String path); List<RequestFilter> getRequestFilters(String path); List<ResponseFilter> getResponseFilters(String path); void addContextResolver(ObjectFactory<ProviderDescriptor> contextResolverFactory); @SuppressWarnings("unchecked") void addExceptionMapper(ObjectFactory<ProviderDescriptor> exceptionMapperFactory); void addMessageBodyReader(ObjectFactory<ProviderDescriptor> readerFactory); void addMessageBodyWriter(ObjectFactory<ProviderDescriptor> writerFactory); void addMethodInvokerFilter(ObjectFactory<FilterDescriptor> filterFactory); void addRequestFilter(ObjectFactory<FilterDescriptor> filterFactory); void addResponseFilter(ObjectFactory<FilterDescriptor> filterFactory);  }
@Test @UseDataProvider("methodInvokerFiltersByPath") public void retrievesMethodInvokerFiltersByPath(boolean singletonOrPerRequest, String path, List<Object> expectedMethodInvokerFilterClassesOrInstances) throws Exception { if (singletonOrPerRequest == SINGLETON) { registerSingletonMethodInvokerFilters(); } else { registerPerRequestMethodInvokerFilters(); } List<MethodInvokerFilter> methodInvokerFilters = providers.getMethodInvokerFilters(path); if (singletonOrPerRequest == SINGLETON) { expectedMethodInvokerFilterClassesOrInstances.removeAll(methodInvokerFilters); assertTrue(String.format("MethodInvoker filters %s expected but not found", expectedMethodInvokerFilterClassesOrInstances), expectedMethodInvokerFilterClassesOrInstances.isEmpty()); } else { List<Class> methodInvokerFiltersClasses = methodInvokerFilters.stream().map(Object::getClass).collect(toList()); expectedMethodInvokerFilterClassesOrInstances.removeAll(methodInvokerFiltersClasses); assertTrue(String.format("MethodInvoker filters %s expected but not found", expectedMethodInvokerFilterClassesOrInstances), expectedMethodInvokerFilterClassesOrInstances.isEmpty()); } }