### Question:
AbstractArithmeticRule extends AbstractRule { @Override public int groundAll(AtomManager atomManager, GroundRuleStore groundRuleStore) { if (!validatedByAtomManager) { validateForGrounding(atomManager); } int groundCount = 0; if (!hasSummation()) { groundCount = groundAllNonSummationRule(atomManager, groundRuleStore); } else { groundCount = groundAllSummationRule(atomManager, groundRuleStore); } log.debug("Grounded {} instances of rule {}", groundCount, this); return groundCount; } AbstractArithmeticRule(ArithmeticRuleExpression expression, Map<SummationVariable, Formula> filterClauses, String name); boolean hasSummation(); ArithmeticRuleExpression getExpression(); @Override boolean requiresSplit(); @Override List<Rule> split(); Set<Predicate> getBodyPredicates(); @Override int hashCode(); @Override boolean equals(Object other); @Override boolean supportsGroundingQueryRewriting(); @Override Formula getRewritableGroundingFormula(AtomManager atomManager); @Override boolean supportsIndividualGrounding(); @Override RawQuery getGroundingQuery(AtomManager atomManager); @Override void ground(Constant[] constants, Map<Variable, Integer> variableMap, AtomManager atomManager,
            List<GroundRule> results); @Override int groundAll(AtomManager atomManager, GroundRuleStore groundRuleStore);  }### Answer:
@Test public void testFilterOpenPredicate() { List<Coefficient> coefficients = Arrays.asList( (Coefficient)(new ConstantNumber(1)) ); List<SummationAtomOrAtom> atoms = Arrays.asList( (SummationAtomOrAtom)(new SummationAtom(singleClosed, new SummationVariableOrTerm[]{new SummationVariable("A")})) ); Map<SummationVariable, Formula> filters = new HashMap<SummationVariable, Formula>(); filters.put(new SummationVariable("A"), new QueryAtom(singleOpened, new Variable("A"))); ArithmeticRuleExpression expression = new ArithmeticRuleExpression( coefficients, atoms, FunctionComparator.EQ, new ConstantNumber(1)); AbstractArithmeticRule rule = new UnweightedArithmeticRule(expression, filters); SimpleAtomManager atomManager = new SimpleAtomManager(database); GroundRuleStore groundRuleStore = new MemoryGroundRuleStore(); try { rule.groundAll(atomManager, groundRuleStore); fail("IllegalArgumentException not thrown when trying to ground an open predicate in the filter."); } catch (IllegalArgumentException ex) { } }