@Test public void testCompositeRuleReturnsOkWhenAllTestsReturnOk() throws Exception { CompositeRule rule = new CompositeRule(false, mockedRule1, mockedRule2); RuleResult result = rule.verify(null); Assert.assertEquals(result.getResultCode(), VerificationResultCode.OK); }
public final CompositeRuleResult verify(VerificationContext context) throws KSIException { CompositeRuleResult result = new CompositeRuleResult(skipOnFirstAppliedRule); for (Rule rule : rules) { result.addRuleResult(rule, rule.verify(context)); if (VerificationResultCode.OK.equals(result.getResultCode()) && skipOnFirstAppliedRule) { return result; } if (!skipOnFirstAppliedRule && (VerificationResultCode.FAIL.equals(result.getResultCode()) || VerificationResultCode.NA.equals(result.getResultCode()))) { return result; } } return result; }
CompositeRule implements Rule { public final CompositeRuleResult verify(VerificationContext context) throws KSIException { CompositeRuleResult result = new CompositeRuleResult(skipOnFirstAppliedRule); for (Rule rule : rules) { result.addRuleResult(rule, rule.verify(context)); if (VerificationResultCode.OK.equals(result.getResultCode()) && skipOnFirstAppliedRule) { return result; } if (!skipOnFirstAppliedRule && (VerificationResultCode.FAIL.equals(result.getResultCode()) || VerificationResultCode.NA.equals(result.getResultCode()))) { return result; } } return result; } }
CompositeRule implements Rule { public final CompositeRuleResult verify(VerificationContext context) throws KSIException { CompositeRuleResult result = new CompositeRuleResult(skipOnFirstAppliedRule); for (Rule rule : rules) { result.addRuleResult(rule, rule.verify(context)); if (VerificationResultCode.OK.equals(result.getResultCode()) && skipOnFirstAppliedRule) { return result; } if (!skipOnFirstAppliedRule && (VerificationResultCode.FAIL.equals(result.getResultCode()) || VerificationResultCode.NA.equals(result.getResultCode()))) { return result; } } return result; } CompositeRule(boolean skipOnFirstAppliedRule, Rule... rules); }
CompositeRule implements Rule { public final CompositeRuleResult verify(VerificationContext context) throws KSIException { CompositeRuleResult result = new CompositeRuleResult(skipOnFirstAppliedRule); for (Rule rule : rules) { result.addRuleResult(rule, rule.verify(context)); if (VerificationResultCode.OK.equals(result.getResultCode()) && skipOnFirstAppliedRule) { return result; } if (!skipOnFirstAppliedRule && (VerificationResultCode.FAIL.equals(result.getResultCode()) || VerificationResultCode.NA.equals(result.getResultCode()))) { return result; } } return result; } CompositeRule(boolean skipOnFirstAppliedRule, Rule... rules); final CompositeRuleResult verify(VerificationContext context); String toString(); }
CompositeRule implements Rule { public final CompositeRuleResult verify(VerificationContext context) throws KSIException { CompositeRuleResult result = new CompositeRuleResult(skipOnFirstAppliedRule); for (Rule rule : rules) { result.addRuleResult(rule, rule.verify(context)); if (VerificationResultCode.OK.equals(result.getResultCode()) && skipOnFirstAppliedRule) { return result; } if (!skipOnFirstAppliedRule && (VerificationResultCode.FAIL.equals(result.getResultCode()) || VerificationResultCode.NA.equals(result.getResultCode()))) { return result; } } return result; } CompositeRule(boolean skipOnFirstAppliedRule, Rule... rules); final CompositeRuleResult verify(VerificationContext context); String toString();  }