Back to the future TDD

Test written in November/2009:

@Test
premiumDisplayedForAShortTermPolicy() {
given(theBroker.hasStartedAQuoteWithMinimumDataToConvertToNewBusiness());
and(theBroker.enters.field(DUE_DATE, "15/12/2009"));
when(theBroker.underwrites());
then(thePolicy.hasCurrentMotorPremiumDisplayed());
}

The intent of DUE DATE was a date in a short future, less than a year. So, one month would be enough. That test broke on the 16/12/2009!!! Back to the future.. The future has come!

A way of showing the intent would be:

@Test
premiumDisplayedForAShortTermPolicy() {
given(theBroker.hasStartedAQuoteWithMinimumDataToConvertToNewBusiness());
and(theBroker.enters.field(DUE_DATE, oneMonthFromToday()));
when(theBroker.underwrites());
then(thePolicy.hasCurrentMotorPremiumDisplayed());
}




Share this story