@Test public void testDenyAll() throws Exception { TestUtil.testBlock(() -> { ProgressCheck check = new Subpackages().newInstance(key("denyAll", false).get()); CheckReport report = scanWithCheck(check, "subtest_with_content.zip"); logViolations("denyAll:false", report); Assert.assertEquals("no violations", 0, report.getViolations().size()); assertTrue("all violations have packageIds", report.getViolations().stream() .allMatch(viol -> !viol.getPackages().isEmpty())); }); TestUtil.testBlock(() -> { ProgressCheck check = new Subpackages().newInstance(key("denyAll", true).get()); CheckReport report = scanWithCheck(check, "subtest_with_content.zip"); logViolations("denyAll:false", report); Assert.assertEquals("two violations", 2, report.getViolations().size()); assertTrue("all violations have packageIds", report.getViolations().stream() .allMatch(viol -> !viol.getPackages().isEmpty())); }); }
@Override public ProgressCheck newInstance(final JsonObject config) { List<Rule> rules = Rules.fromJsonArray(arrayOrEmpty(config, keys().rules())); final boolean denyAll = hasNonNull(config, keys().denyAll()) && config.getBoolean(keys().denyAll()); return new Check(rules, denyAll); }
Subpackages implements ProgressCheckFactory { @Override public ProgressCheck newInstance(final JsonObject config) { List<Rule> rules = Rules.fromJsonArray(arrayOrEmpty(config, keys().rules())); final boolean denyAll = hasNonNull(config, keys().denyAll()) && config.getBoolean(keys().denyAll()); return new Check(rules, denyAll); } }
Subpackages implements ProgressCheckFactory { @Override public ProgressCheck newInstance(final JsonObject config) { List<Rule> rules = Rules.fromJsonArray(arrayOrEmpty(config, keys().rules())); final boolean denyAll = hasNonNull(config, keys().denyAll()) && config.getBoolean(keys().denyAll()); return new Check(rules, denyAll); }  }
Subpackages implements ProgressCheckFactory { @Override public ProgressCheck newInstance(final JsonObject config) { List<Rule> rules = Rules.fromJsonArray(arrayOrEmpty(config, keys().rules())); final boolean denyAll = hasNonNull(config, keys().denyAll()) && config.getBoolean(keys().denyAll()); return new Check(rules, denyAll); }  @NotNull static JsonKeys keys(); @Override ProgressCheck newInstance(final JsonObject config); }
Subpackages implements ProgressCheckFactory { @Override public ProgressCheck newInstance(final JsonObject config) { List<Rule> rules = Rules.fromJsonArray(arrayOrEmpty(config, keys().rules())); final boolean denyAll = hasNonNull(config, keys().denyAll()) && config.getBoolean(keys().denyAll()); return new Check(rules, denyAll); }  @NotNull static JsonKeys keys(); @Override ProgressCheck newInstance(final JsonObject config); @Deprecated
    static final String CONFIG_RULES; @Deprecated
    static final String CONFIG_DENY_ALL; }