Class HasNumberOfElements

  • All Implemented Interfaces:
    Quality<java.lang.Iterable<?>>

    public final class HasNumberOfElements
    extends QualityComposition<java.lang.Iterable<?>>
    • Constructor Summary

      Constructors 
      Constructor Description
      HasNumberOfElements​(int size)
      Creates a Quality that matches if the Iterable under test iterates a number of elements equal to the given value.
      HasNumberOfElements​(Quality<? super java.lang.Integer> delegate)
      Creates a Quality that matches if the Iterable under test iterates a number of elements that matches the given Quality.
    • Method Summary

      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • HasNumberOfElements

        public HasNumberOfElements​(int size)
        Creates a Quality that matches if the Iterable under test iterates a number of elements equal to the given value.
             assertThat(asList(1,2,3), hasNumberOfElements(3));
         
      • HasNumberOfElements

        public HasNumberOfElements​(Quality<? super java.lang.Integer> delegate)
        Creates a Quality that matches if the Iterable under test iterates a number of elements that matches the given Quality.
             assertThat(asList(1,2,3), hasNumberOfElements(lessThan(4)));