@Test public void testBadSeverity() throws Exception { TestUtil.testBlock(() -> { boolean threw = false; try { ProgressCheck check = new Paths().newInstance(key("severity", "whoops").key("rules", arr(denyEtc)).get()); } catch (IllegalArgumentException e) { threw = true; } assertTrue("bad severity should cause exception on construction.", threw); }); }
@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; }