StatusCodesComparator implements ComparatorJob { @Override public void setParameters(Map<String, String> params) throws ParametersException { if (params.containsKey(PARAM_FILTER_RANGE)) { processFilterRangeParam(params.get(PARAM_FILTER_RANGE)); } if (params.containsKey(PARAM_FILTER_CODES)) { processFilterCodesParam(params.get(PARAM_FILTER_CODES)); } if (params.containsKey(PARAM_SHOW_EXCLUDED)) { this.showExcluded = Boolean.valueOf(params.get(PARAM_SHOW_EXCLUDED)); } } StatusCodesComparator(ArtifactsDAO artifactsDAO, ComparatorProperties comparatorProperties,
      List<DataFilterJob> dataFilterJobs); @Override @SuppressWarnings("unchecked") ComparatorStepResult compare(); @Override void setParameters(Map<String, String> params); static final String COMPARATOR_TYPE; static final String COMPARATOR_NAME; }
@Test public void setParameters() throws ParametersException { tested = createNewStatusCodesComparator("expected-data-200-result.json"); Map<String, String> params = ImmutableMap .of(PARAM_FILTER_CODES, FILTER_CODES_SINGLE, PARAM_FILTER_RANGE, FILTER_RANGE); tested.setParameters(params); }
@Test public void setParameters_filterRange() throws ParametersException { tested = createNewStatusCodesComparator("expected-data-200-result.json"); Map<String, String> params = ImmutableMap .of(PARAM_FILTER_RANGE, FILTER_RANGE); tested.setParameters(params); }
@Test(expected = ParametersException.class) public void setParameters_filterRangeInvalid() throws ParametersException { tested = createNewStatusCodesComparator("expected-data-200-result.json"); Map<String, String> params = ImmutableMap .of(PARAM_FILTER_RANGE, FILTER_RANGE_INVALID); tested.setParameters(params); fail("parameters exception expected"); }
@Test(expected = ParametersException.class) public void setParameters_filterRangeNotANumber() throws ParametersException { tested = createNewStatusCodesComparator("expected-data-200-result.json"); Map<String, String> params = ImmutableMap .of(PARAM_FILTER_RANGE, FILTER_RANGE_NAN); tested.setParameters(params); fail("parameters exception expected"); }
@Test(expected = ParametersException.class) public void setParameters_filterRangeUpperBoundLessThanLowerBound() throws ParametersException { tested = createNewStatusCodesComparator("expected-data-200-result.json"); Map<String, String> params = ImmutableMap .of(PARAM_FILTER_RANGE, FILTER_RANGE_UPPER_LESS_THAN_LOWER); tested.setParameters(params); fail("parameters exception expected"); }
@Test public void setParameters_filterCodes() throws ParametersException { tested = createNewStatusCodesComparator("expected-data-200-result.json"); Map<String, String> params = ImmutableMap .of(PARAM_FILTER_CODES, FILTER_CODES_SINGLE); tested.setParameters(params); }
@Test public void setParameters_filterCodesMultipleValues() throws ParametersException { tested = createNewStatusCodesComparator("expected-data-200-result.json"); Map<String, String> params = ImmutableMap .of(PARAM_FILTER_CODES, FILTER_CODES_MULTIPLE); tested.setParameters(params); }
@Test(expected = ParametersException.class) public void setParameters_filterCodesNotANumber() throws ParametersException { tested = createNewStatusCodesComparator("expected-data-200-result.json"); Map<String, String> params = ImmutableMap .of(PARAM_FILTER_CODES, FILTER_CODES_SINGLE_NAN); tested.setParameters(params); fail("parameters exception expected"); }
@Test(expected = ParametersException.class) public void setParameters_filterCodesMultipleValuesNotANumber() throws ParametersException { tested = createNewStatusCodesComparator("expected-data-200-result.json"); Map<String, String> params = ImmutableMap .of(PARAM_FILTER_CODES, FILTER_CODES_MULTIPLE_NAN); tested.setParameters(params); fail("parameters exception expected"); }