ProcessFilterParser implements TextParser<List<ProcessFilter>> { @NotNull @Override public List<ProcessFilter> parse(@NotNull final String filtersText) { final List<ProcessFilter> filters = new ArrayList<ProcessFilter>(); for(String mask: StringUtil.split(filtersText, ourlineSeparator)) { if(StringUtil.isEmptyOrSpaces(mask)) { continue; } filters.add(new ProcessFilter(mask)); } return Collections.unmodifiableList(filters); }  @NotNull @Override List<ProcessFilter> parse(@NotNull final String filtersText);  }
@Test(dataProvider = "parseFiltersFromStringCases") public void shouldParseFiltersFromString(@NotNull final String text, @NotNull final List<ProcessFilter> expectedFilters, boolean expectedExceptionThrown) { final TextParser<List<ProcessFilter>> instance = createInstance(); List<ProcessFilter> actualFilters = null; boolean actualExceptionThrown = false; try { actualFilters = instance.parse(text); } catch (BuildException ex) { actualExceptionThrown = true; } if(!expectedExceptionThrown) { then(actualFilters).containsExactlyElementsOf(expectedFilters); } then(actualExceptionThrown).isEqualTo(expectedExceptionThrown); }