Search code examples
javaassertj

Alternatives to deprecated java method from org.assertj.core.api


I'm looking for an alternative of the deprecated method containsOnlyElementsOf.

It has to check whether the given iterable (a list of Integers in my case) contains only Integers in-between given bounds.

I've tried looking at the docs but didn't find any...


Solution

  • I think this is what you are looking for. The name of the method is indeed confusing. The substitute depends on what you want - you either should use isSubsetOf, or containsOnly. Check out the documentation of both, and pick the one you need)