### Question:
ContextQueryConfig extends FilterConfig { @Override public Condition generate(Map<String, Object> values) { Preconditions.checkArgument(getCondition() != null, "Must specify a delegate condition"); Preconditions.checkArgument(matcher != null, "Must specify a matcher"); Predicate<Model> selectorPred = Predicates.alwaysTrue(); if(selector != null) { selectorPred = FunctionFactory.toModelPredicate(selector.toTemplate(), values); } Predicate<Model> matcherPred = FunctionFactory.toModelPredicate(matcher.toTemplate(), values); Condition condition = getCondition().generate(values); return new MatcherFilter(condition, new ModelPredicateMatcher(selectorPred, matcherPred)); }  TemplatedExpression getSelectorExpression(); void setSelectorExpression(TemplatedExpression selector); TemplatedExpression getMatcherExpression(); void setMatcherExpression(TemplatedExpression matcher); @Override String getType(); @Override Condition generate(Map<String, Object> values); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object obj); static final String TYPE; }### Answer:
@Test public void testInvalidConfig() { ContextQueryConfig empty = new ContextQueryConfig(); try { empty.generate(ImmutableMap.of()); fail("Allowed to be creqted without a delegate condition"); } catch(IllegalArgumentException e) { } }
@Test public void testItsAllAlright() { ContextQueryConfig config = createFullConfig(); Condition condition = config.generate(ImmutableMap.of( "var1", "dev", "var2", "SERV:note:" )); assertTrue(condition instanceof MatcherFilter); }