### Question:
ValueChangeConfig implements ConditionConfig { @Override public Condition generate(Map<String, Object> values) { Preconditions.checkState(attribute != null, "must specify an attribute name"); String attributeName; Object oldValue = null; Object newValue = null; Predicate<Model> query = Predicates.alwaysTrue(); attributeName = FunctionFactory.toString(this.attribute.toTemplate(), values); if(this.oldValue != null) { oldValue = this.oldValue.toTemplate().apply(values); } if(this.newValue != null) { newValue = this.newValue.toTemplate().apply(values); } if(this.query != null) { query = FunctionFactory.toModelPredicate(this.query.toTemplate(), values); } return new ValueChangeTrigger(attributeName, oldValue, newValue, query); }  TemplatedExpression getAttributeExpression(); void setAttributeExpression(TemplatedExpression attributeExpression); TemplatedExpression getOldValueExpression(); void setOldValueExpression(TemplatedExpression oldValueExpression); TemplatedExpression getNewValueExpression(); void setNewValueExpression(TemplatedExpression newValue); TemplatedExpression getQueryExpression(); void setQueryExpression(TemplatedExpression query); @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() { ValueChangeConfig empty = new ValueChangeConfig(); try { empty.generate(ImmutableMap.of()); fail("Allowed to be creqted with missing attributes"); } catch(IllegalStateException e) { } }
@Test public void testItsAllAlright() { ValueChangeConfig config = createFullConfig(); Condition condition = config.generate(ImmutableMap.of( "address", "SERV:note:", "attribute", "base:ValueChange", "new", "new", "old", "old" )); assertTrue(condition instanceof ValueChangeTrigger); }