### Question:
QueryChangeConfig implements ConditionConfig { @Override public Condition generate(Map<String, Object> values) { Preconditions.checkState(condition != null, "Must specify a condition"); Predicate<Model> query; Predicate<Model> condition; if(this.query == null) { query = Predicates.alwaysTrue(); } else { query = FunctionFactory.toModelPredicate(this.query.toTemplate(), values); } condition = FunctionFactory.toModelPredicate(this.condition.toTemplate(), values); return new QueryChangeTrigger(query, condition); }  TemplatedExpression getQueryExpression(); void setQueryExpression(TemplatedExpression query); TemplatedExpression getConditionExpression(); void setConditionExpression(TemplatedExpression condition); @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() { QueryChangeConfig empty = new QueryChangeConfig(); try { empty.generate(ImmutableMap.of()); fail("Allowed to be creqted with missing attributes"); } catch(IllegalStateException e) { } }
@Test public void testItsAllAlright() { QueryChangeConfig config = createFullConfig(); Condition condition = config.generate(ImmutableMap.of( "var1", "dev", "var2", "SERV:note:" )); assertTrue(condition instanceof QueryChangeTrigger); }