alexruiz / fest-assert-2.x

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

wrong error message from Iterables.assertAreAtMost #160

Open afedorychak opened 10 years ago

afedorychak commented 10 years ago

If condition fails, Iterables.assertAreAtMost should generate an error message via elementsShouldBeAtMost not elementsShouldNotBeAtMost like it's doing right now in 2.0M10.

  public <E> void assertAreAtMost(AssertionInfo info, Iterable<? extends E> actual, int n,
      Condition<? super E> condition) {
    assertNotNull(info, actual);
    conditions.assertIsNotNull(condition);
    try {
      List<E> satisfiesCondition = satisfiesCondition(actual, condition);
      if (satisfiesCondition.size() <= n) {
        return;
      }
      throw failures.failure(info, elementsShouldNotBeAtMost(actual, n, condition));
                                         //      ^^^ wrong
    } catch (ClassCastException e) {
      throw failures.failure(info, shouldBeSameGenericBetweenIterableAndCondition(actual, condition));
    }
  }
joel-costigliola commented 10 years ago

Hi,

FYI, this one has been solved in AssertJ a fork of Fest Assert 2.x available here : https://github.com/joel-costigliola/assertj-core.

Kind regards,

Joel

afedorychak commented 10 years ago

@joel-costigliola I didn't realize FEST is not maintained anymore, will look into AssertJ. Thanks!