### Question:
FilterFactories { public static Filter createFilterFromFilterSpec(Request request, String filterSpec) throws FilterFactory.FilterNotCreatedException { Description topLevelDescription = request.getRunner().getDescription(); String[] tuple; if (filterSpec.contains("=")) { tuple = filterSpec.split("=", 2); } else { tuple = new String[]{ filterSpec, "" }; } return createFilter(tuple[0], new FilterFactoryParams(topLevelDescription, tuple[1])); }  static Filter createFilterFromFilterSpec(Request request, String filterSpec); static Filter createFilter(String filterFactoryFqcn, FilterFactoryParams params); static Filter createFilter(Class<? extends FilterFactory> filterFactoryClass, FilterFactoryParams params);  }### Answer:
@Test public void shouldCreateFilterWithArguments() throws Exception { Filter filter = FilterFactories.createFilterFromFilterSpec( createSuiteRequest(), ExcludeCategories.class.getName() + "=" + DummyCategory.class.getName()); assertThat(filter.describe(), startsWith("excludes ")); }
@Test public void shouldCreateFilterWithNoArguments() throws Exception { Filter filter = FilterFactories.createFilterFromFilterSpec( createSuiteRequest(), FilterFactoryStub.class.getName()); assertThat(filter, instanceOf(DummyFilter.class)); }
@Test public void shouldPassOnDescriptionToFilterFactory() throws Exception { Request request = createSuiteRequest(); Description description = request.getRunner().getDescription(); Filter filter = FilterFactories.createFilterFromFilterSpec( request, FilterFactoryStub.class.getName()); assumeThat(filter, instanceOf(DummyFilter.class)); DummyFilter dummyFilter = (DummyFilter) filter; assertThat(dummyFilter.getTopLevelDescription(), is(description)); }