@Test public void testCustomSeverityMixedCase() throws Exception { TestUtil.testBlock(() -> { ProgressCheck check = new Paths().newInstance(key("severity", "minor").key("rules", arr(denyEtc)).get()); CheckReport report = scanWithCheck(check, "test-package-with-etc.zip"); logViolations("level_set:no_unsafe", report); Assert.assertEquals("violations", 6, report.getViolations().size()); assertTrue("all violations are MINOR", report.getViolations().stream() .allMatch(viol -> viol.getSeverity().equals(Severity.MINOR))); }); }
@Override public ProgressCheck newInstance(final JsonObject config) { List<Rule> rules = Rules.fromJsonArray(arrayOrEmpty(config, keys().rules())); final boolean denyAllDeletes = hasNonNull(config, keys().denyAllDeletes()) && config.getBoolean(keys().denyAllDeletes()); final Severity severity = Severity.valueOf( config.getString(keys().severity(), DEFAULT_SEVERITY.name()).toUpperCase()); return new Check(rules, denyAllDeletes, severity); }
Paths implements ProgressCheckFactory { @Override public ProgressCheck newInstance(final JsonObject config) { List<Rule> rules = Rules.fromJsonArray(arrayOrEmpty(config, keys().rules())); final boolean denyAllDeletes = hasNonNull(config, keys().denyAllDeletes()) && config.getBoolean(keys().denyAllDeletes()); final Severity severity = Severity.valueOf( config.getString(keys().severity(), DEFAULT_SEVERITY.name()).toUpperCase()); return new Check(rules, denyAllDeletes, severity); } }
Paths implements ProgressCheckFactory { @Override public ProgressCheck newInstance(final JsonObject config) { List<Rule> rules = Rules.fromJsonArray(arrayOrEmpty(config, keys().rules())); final boolean denyAllDeletes = hasNonNull(config, keys().denyAllDeletes()) && config.getBoolean(keys().denyAllDeletes()); final Severity severity = Severity.valueOf( config.getString(keys().severity(), DEFAULT_SEVERITY.name()).toUpperCase()); return new Check(rules, denyAllDeletes, severity); }  }
Paths implements ProgressCheckFactory { @Override public ProgressCheck newInstance(final JsonObject config) { List<Rule> rules = Rules.fromJsonArray(arrayOrEmpty(config, keys().rules())); final boolean denyAllDeletes = hasNonNull(config, keys().denyAllDeletes()) && config.getBoolean(keys().denyAllDeletes()); final Severity severity = Severity.valueOf( config.getString(keys().severity(), DEFAULT_SEVERITY.name()).toUpperCase()); return new Check(rules, denyAllDeletes, severity); }  @NotNull static JsonKeys keys(); @Override ProgressCheck newInstance(final JsonObject config); }
Paths implements ProgressCheckFactory { @Override public ProgressCheck newInstance(final JsonObject config) { List<Rule> rules = Rules.fromJsonArray(arrayOrEmpty(config, keys().rules())); final boolean denyAllDeletes = hasNonNull(config, keys().denyAllDeletes()) && config.getBoolean(keys().denyAllDeletes()); final Severity severity = Severity.valueOf( config.getString(keys().severity(), DEFAULT_SEVERITY.name()).toUpperCase()); return new Check(rules, denyAllDeletes, severity); }  @NotNull static JsonKeys keys(); @Override ProgressCheck newInstance(final JsonObject config); @Deprecated
    static final String CONFIG_RULES; @Deprecated
    static final String CONFIG_DENY_ALL_DELETES; @Deprecated
    static final String CONFIG_SEVERITY; static final Severity DEFAULT_SEVERITY; }