2829303132333435363738
public void testEventDurationCalculator0() throws InterruptedException { EventDurationCalculator calc0 = new EventDurationCalculator(); long start = System.nanoTime(); calc0.eventStarted(); Thread.sleep(300); calc0.eventEnded(); Thread.sleep(600); calc0.eventStarted(); Thread.sleep(100); calc0.eventEnded(); Thread.sleep(400);
3233343536373839404142
Thread.sleep(300); calc0.eventEnded(); Thread.sleep(600); calc0.eventStarted(); Thread.sleep(100); calc0.eventEnded(); Thread.sleep(400); calc0.eventStarted(); Thread.sleep(200); calc0.eventEnded(); long end = System.nanoTime();
3637383940414243444546
Thread.sleep(100); calc0.eventEnded(); Thread.sleep(400); calc0.eventStarted(); Thread.sleep(200); calc0.eventEnded(); long end = System.nanoTime(); assertEquals(1600D, (end - start) / 1e6, 10D); assertEquals(200D, calc0.getMean(), 10D); }
5253545556575859606162
Thread.sleep(300); calc0.eventStarted(); Thread.sleep(600); calc0.eventStarted(); Thread.sleep(100); calc0.eventEnded(); Thread.sleep(400); calc0.eventEnded(); Thread.sleep(200); calc0.eventEnded(); long end = System.nanoTime();
5455565758596061626364
Thread.sleep(600); calc0.eventStarted(); Thread.sleep(100); calc0.eventEnded(); Thread.sleep(400); calc0.eventEnded(); Thread.sleep(200); calc0.eventEnded(); long end = System.nanoTime(); assertEquals(1600D, (end - start) / 1e6, 10D); assertEquals(933D, calc0.getMean(), 10D);
5657585960616263646566
Thread.sleep(100); calc0.eventEnded(); Thread.sleep(400); calc0.eventEnded(); Thread.sleep(200); calc0.eventEnded(); long end = System.nanoTime(); assertEquals(1600D, (end - start) / 1e6, 10D); assertEquals(933D, calc0.getMean(), 10D); } }