### Question:
ScheduledReference { public ScheduledReference(String name) { this.name=name; } ScheduledReference(String name); boolean isReferencedEvent(ActionContext context, RuleEvent event); boolean isReferencedEvent(ActionContext context, ScheduledEvent event); void setTimeout(ActionContext context, long delayMs); void setTimeout(ActionContext context, Date wakeup); boolean restore(ActionContext context); boolean hasScheduled(ActionContext context); void cancel(ActionContext context);  }### Answer:
@Test public void testScheduledReference() { reference = new ScheduledReference("testref"); reference.setTimeout(context,timeoutAt); Date timeout = (Date)context.getVariable("testref"); assertEquals(timeoutAt.getTime(), timeout.getTime()); assertTrue(reference.hasScheduled(context)); ScheduledEvent event = new ScheduledEvent(timeoutAt.getTime()); assertTrue(reference.isReferencedEvent(context, event)); reference.cancel(context); assertFalse(reference.isReferencedEvent(context, event)); assertFalse(reference.hasScheduled(context)); }