### Question:
ThresholdTrigger extends StatefulCondition { @Override public boolean isSatisfiable(ConditionContext context) { for(Model model: context.getModels()) { if(model.getAttribute(attributeName) != null && sourcePredicate.apply(model.getAddress())) { context.logger().trace("Trigger [{}] is satisfiable because at least one model supports [{}] and matches [{}]", this, attributeName, sourcePredicate); return true; } } context.logger().trace("Trigger [{}] is not satisfiable because at no models support [{}] or no models match [{}]", this, attributeName, sourcePredicate); return false; } ThresholdTrigger(String attributeName, double threshold, double sensitivity, TriggerOn triggerOn, Predicate<Address> source); @Override boolean isSatisfiable(ConditionContext context); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object obj);  }### Answer:
@Test public void testSatisfiable() { Model model2 = context.createModel("test", UUID.randomUUID()); attributeName = "test:test"; thresholdValue = 85.0; sensitivityValue = 5.0; Predicate<Address> source = Predicates.equalTo(model.getAddress()); trigger = new ThresholdTrigger(attributeName, thresholdValue, sensitivityValue, TriggerOn.GREATER_THAN, source); trigger.activate(context); assertFalse(trigger.isSatisfiable(context)); model.setAttribute(attributeName, new Double(80)); assertTrue(trigger.isSatisfiable(context)); assertTrue(trigger.shouldFire(context, createValueChange(attributeName, new Double(80), new Double(86)))); assertFalse(trigger.shouldFire(context, createValueChange("test:bad", new Double(80), new Double(86)))); assertFalse(trigger.shouldFire(context, createValueChange(model2, attributeName, new Double(80), new Double(86)))); }