ksession.setGlobal("doctor", doctor);
assertTrue(doctor.getNotifications().isEmpty());
//First event
bedEventsEP.insert(new MonitorEvent(patient, MonitorEvent.Symptom.HIGH_TEMPERATURE));
ksession.fireAllRules();
assertTrue(doctor.getNotifications().isEmpty());
//Second event: 5 minutes after
clock.advanceTime(5, TimeUnit.MINUTES);
bedEventsEP.insert(new MonitorEvent(patient, MonitorEvent.Symptom.HIGH_BLOOD_PRESSURE));
ksession.fireAllRules();
assertEquals(1,doctor.getNotifications().size());
doctor.clearNotifications();
//Third event: 15 minutes after the last one
clock.advanceTime(15, TimeUnit.MINUTES);
bedEventsEP.insert(new MonitorEvent(patient, MonitorEvent.Symptom.HIGH_TEMPERATURE));
ksession.fireAllRules();
assertTrue(doctor.getNotifications().isEmpty());
//Fourth event: 7 minutes after the last one
clock.advanceTime(7, TimeUnit.MINUTES);
bedEventsEP.insert(new MonitorEvent(patient, MonitorEvent.Symptom.HIGH_BLOOD_PRESSURE));
ksession.fireAllRules();
assertEquals(1,doctor.getNotifications().size());
doctor.clearNotifications();