Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wrong error message from Iterables.assertAreAtMost #160

Open
afedorychak opened this issue Nov 26, 2013 · 2 comments
Open

wrong error message from Iterables.assertAreAtMost #160

afedorychak opened this issue Nov 26, 2013 · 2 comments

Comments

@afedorychak
Copy link

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
Copy link
Contributor

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
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants