-
Notifications
You must be signed in to change notification settings - Fork 101
Open
Labels
Description
Try following test:
public class JGivenDurationReporting extends
ScenarioTest<JGivenDurationReporting.Fixtures<?>, JGivenDurationReporting.Actions<?>, JGivenDurationReporting.Verifications<?>> {
static class Actions<SELF extends Actions<SELF>> extends Stage<SELF> {
public SELF doing_nothing(final long millis) {
sleep(millis);
return self();
}
}
static class Fixtures<SELF extends Fixtures<SELF>> extends Stage<SELF> {
public SELF nothing() {
return self();
}
}
static class Verifications<SELF extends Verifications<SELF>>
extends Stage<SELF> {
public SELF succeeds() {
return self();
}
}
@Test
public void missesDurationReports() {
given().nothing();
when().doing_nothing(1_000)
.and().doing_nothing(1_000)
.and().doing_nothing(1_000);
then().succeeds();
}
@Test
public void reportsDurationOnEveryStep() {
given().nothing();
when().doing_nothing(1_000)
.doing_nothing(1_000)
.doing_nothing(1_000);
then().succeeds();
}
}
First one is reported like this:
Given nothing (11ms)
When doing nothing 1000
And doing nothing 1000
And doing nothing 1000 (1.001s)
Then succeeds
Second one, without the intro-words, is reported:
Given nothing
When doing nothing 1000 (1.001s)
doing nothing 1000 (1.000s)
doing nothing 1000 (1.001s)
Then succeeds