Friday, December 11, 2015

DateMatchers for unit testing a Date object

Hey, there is no DateMatcher in the HamCrest! Why?

I found a useful library: hamcrest-date. Really cool for unit testing:

assertThat(dola.getTranslationStatus().getResultDate(), is(isToday()));
assertThat(dola.getTranslationStatus().getResultDate(), is(sameDay(new Date())));


No comments:

Post a Comment