@Test public void testEmpty() throws Exception { AlarmPoint underTest = createAlarm("testEmpty"); AlarmHistory hist = underTest.history(); AlarmEvent event1 = hist.firstEvent(); AlarmEvent event2 = hist.lastEvent(); assertNull(event1); assertNull(event2); assertEquals("Activate Counter", 0, hist.activateCounter()); }
@Test public void testFirstNotLast() throws Exception { AlarmPoint underTest = createAlarm("testFirstNotLast"); underTest.updateCondition(true); underTest.updateCondition(false); AlarmHistory hist = underTest.history(); AlarmEvent event1 = hist.firstEvent(); AlarmEvent event2 = hist.lastEvent(); assertFalse(event1.equals(event2)); Assert.assertEquals(AlarmPoint.STATUS_ACTIVATED, event1.newStatus().get().name(null)); Assert.assertEquals(AlarmPoint.STATUS_NORMAL, event2.newStatus().get().name(null)); }