コード例 #1
0
 @Test
 public void we_can_record_the_lifetime_of_a_test_step() throws InterruptedException {
   TestStep step = new TestStep("a narrative description");
   Thread.sleep(150);
   step.recordDuration();
   assertThat(step.getDuration(), is(greaterThanOrEqualTo(100L)));
 }
コード例 #2
0
 @Test
 public void we_can_display_the_lifetime_of_a_test_step_in_seconds() throws InterruptedException {
   TestStep step = new TestStep("a narrative description");
   Thread.sleep(150);
   step.recordDuration();
   double expectedDuration = step.getDuration() / 1000.0;
   assertThat(step.getDurationInSeconds(), closeTo(expectedDuration, 0.01));
 }