@Test public void startLapsStopStartStopTest() { t.set(100); w.start(); t.set(200); assertEquals(100L, w.lap()); t.set(500); assertEquals(300L, w.lap()); t.set(600); assertEquals(100L, w.stop()); assertEquals(3L, w.getLaps()); assertEquals(500L, w.getTotal()); t.set(1000); w.start(); t.set(1030); assertEquals(30L, w.lap()); t.set(1100); assertEquals(70L, w.lap()); t.set(1200); assertEquals(100L, w.stop()); assertEquals(3L, w.getLaps()); assertEquals(200L, w.getTotal()); }
@Test public void startLapPauseResumeLapStopTest() { t.set(100); w.start(); t.set(200); assertEquals(100L, w.lap()); t.set(300); assertEquals(100L, w.pause()); t.set(500); w.resume(); t.set(600); assertEquals(200L, w.stop()); assertEquals(2L, w.getLaps()); assertEquals(300L, w.getTotal()); }
@Test public void badLap() { assertEquals(0L, w.lap()); }