SourceValidator extends AbstractComplianceChecker { @Override public void configure(Map<String, String> configMap) { super.configure(configMap); threshold = Integer.parseInt(getConfigValue("threshold", configMap, "80")); missingSourcesWhiteList = context.getConfiguration().getValidForMissingSources(); incompleteSourcesWhiteList = context.getConfiguration().getValidForIncompleteSources(); final String MISSING_SOURCES_KEY = "missingSourcesSeverity"; final String INCOMPLETE_SOURCES_KEY = "incompleteSourcesSeverity"; missingSourcesSeverity = getSeverityFromConfig(MISSING_SOURCES_KEY, configMap, IEvaluationResult.Severity.FAIL); incompleteSourcesSeverity = getSeverityFromConfig(INCOMPLETE_SOURCES_KEY, configMap, IEvaluationResult.Severity.WARN); reporter = context.getProcessingReporter(); } SourceValidator(); @Override IPolicyEvaluation evaluate(Collection<Artifact> artifacts); @Override String getRulesetDescription(); @Override void configure(Map<String, String> configMap);  }
@Test public void testParsingOfThreshold() throws NoSuchFieldException, IllegalAccessException { configure(Collections.singletonMap("threshold", "40")); Field f = SourceValidator.class.getDeclaredField("threshold"); f.setAccessible(true); final int threshold = (int) f.get(validator); assertThat(threshold == 40); }