RemoveLinesDataModifier implements DataFilterJob<String> { public void validateParameters(String dataRanges, String patternRanges) throws ParametersException { if (StringUtils.isBlank(dataRanges) && StringUtils.isBlank(patternRanges)) { throw new ParametersException("Either dataRanges or patternRanges should not be empty!"); } for (String ranges : new String[]{dataRanges, patternRanges}) { if (StringUtils.isNotBlank(ranges) && !PARAM_REGEX.matcher(ranges).matches()) { throw new ParametersException("Bad format : " + ranges); } } }  @Override void setParameters(Map<String, String> params); @Override String modifyData(String data); @Override String modifyPattern(String data); @Override String getInfo(); void validateParameters(String dataRanges, String patternRanges); static final String NAME; }
@TestWith({"2,3-4,5", "1,1;10,12-10,12;15,30;13,14", "-10,12", "50,55-"}) public void testParameters(String dataRanges, String patternRanges) throws ParametersException { tested.validateParameters(dataRanges, patternRanges); }
@Test public void testParametersNull() throws ParametersException { verifyException(tested, ParametersException.class).validateParameters(null, null); }
@Test public void testParametersBlank() throws ParametersException { verifyException(tested, ParametersException.class).validateParameters("", " "); }
@TestWith({"2-4,5", "1,1;10;12-10,12;15,30;13,14", "10;12-", "-50;55"}) public void testBadParameters(String dataRanges, String patternRanges) throws ParametersException { verifyException(tested, ParametersException.class) .validateParameters(dataRanges, patternRanges); }