1 public class TimerSpec {
2 public void shouldMeasureAPeriodOfTime() throws Exception {
3 // setup
4 Timer timer = new Timer();
5 timer.start();
6
7 // execute
8 // TODO make this not time-dependent - could possibly fail
9 Thread.sleep(10);
10 timer.stop();
11 // verify
12 Verify.that(timer.elapsedTimeMillis() > 0);
13 }
14 }
15