alexruiz / fest-assert-2.x

FEST Fluent Assertions 2.x
http://fest.easytesting.org
Apache License 2.0
401 stars 69 forks source link

Added DateAssert.hasTime(long) (Issue 48) #76

Closed ggirou closed 12 years ago

ggirou commented 12 years ago

From Paris Hackergarten :)

joel-costigliola commented 12 years ago

Thanks Guillaume and Nicolas, I have integrated your code with few modifications :

  @Test()
  public void should_fail_if_actual_has_not_same_time() {
    AssertionInfo info = someInfo();
    try {
      dates.assertHasTime(someInfo(), actual, 24L);
    } catch (AssertionError e) {
      verify(failures).failure(info, shouldHaveTime(actual, 24L));
      return;
    }
    failBecauseExpectedAssertionErrorWasNotThrown();
  }

Why ? because failBecauseExpectedAssertionErrorWasNotThrown() throws an AssertionError thus it should not be called in a try catch block catching AssertionError.

Last thing : could you add an example of this new assertion in fest-examples project ? that would be great !