### Question:
DurationTrigger extends StatefulCondition { @Override public boolean isSatisfiable(ConditionContext context) { return matcher.isSatisfiable(context); } DurationTrigger(ContextMatcher matcher, long durationMs); @Override boolean isSatisfiable(ConditionContext context); @Override String toString();  }### Answer:
@Test public void testNotSatisfiable() { EasyMock.expect(selector.apply(model)).andReturn(false).anyTimes(); replay(); trigger.activate(context); assertFalse(trigger.isSatisfiable(context)); assertFalse(trigger.shouldFire(context, new ScheduledEvent())); assertNull(context.getEvents().poll()); verify(); }
@Test public void testNoMatch() throws Exception { EasyMock.expect(selector.apply(model)).andReturn(true).anyTimes(); EasyMock.expect(filter.apply(model)).andReturn(false).anyTimes(); replay(); trigger.activate(context); assertTrue(trigger.isSatisfiable(context)); assertFalse(trigger.shouldFire(context, valueChangeEvent)); assertFalse(trigger.shouldFire(context, valueChangeEvent)); assertNull(context.getEvents().poll()); verify(); }
@Test public void testMatch() { EasyMock.expect(selector.apply(model)).andReturn(true).anyTimes(); EasyMock.expect(filter.apply(model)).andReturn(true).anyTimes(); replay(); trigger.activate(context); assertTrue(trigger.isSatisfiable(context)); ScheduledEvent event = context.getEvents().poll(); assertNotNull(event); assertTrue(trigger.shouldFire(context, event)); assertNull(context.getEvents().poll()); verify(); }