@Test public void filter_binds_work() { final Filter filter = mock(Filter.class); final Class<TestFilter> filterClass = TestFilter.class; Injector injector = Guice.createInjector(new AbstractPlugin() { @Override protected void configure() { buildFilter(filter).withPriority(100).bind(); buildFilter(filterClass).withName("myName").bind(); } }); Set<FilterSpec> filterSpecSet = injector.getInstance(Keys.FilterSpecs); assertThat(filterSpecSet, hasSize(2)); }
protected FilterBinder buildFilter(Filter filter) { Preconditions.checkNotNull(filter, "Filter cannot be null."); buildBinders(); return FilterBinder.forInstance(binder(), filter); }
AbstractPlugin extends AbstractModule implements Plugin { protected FilterBinder buildFilter(Filter filter) { Preconditions.checkNotNull(filter, "Filter cannot be null."); buildBinders(); return FilterBinder.forInstance(binder(), filter); } }
AbstractPlugin extends AbstractModule implements Plugin { protected FilterBinder buildFilter(Filter filter) { Preconditions.checkNotNull(filter, "Filter cannot be null."); buildBinders(); return FilterBinder.forInstance(binder(), filter); }  }
AbstractPlugin extends AbstractModule implements Plugin { protected FilterBinder buildFilter(Filter filter) { Preconditions.checkNotNull(filter, "Filter cannot be null."); buildBinders(); return FilterBinder.forInstance(binder(), filter); }   }
AbstractPlugin extends AbstractModule implements Plugin { protected FilterBinder buildFilter(Filter filter) { Preconditions.checkNotNull(filter, "Filter cannot be null."); buildBinders(); return FilterBinder.forInstance(binder(), filter); }    }