Class AbstractSpliteratorAssert<SELF extends AbstractSpliteratorAssert<SELF,ELEMENT>,ELEMENT>

java.lang.Object
org.assertj.core.api.AbstractAssert<SELF,Spliterator<ELEMENT>>
org.assertj.core.api.AbstractSpliteratorAssert<SELF,ELEMENT>
Type Parameters:
SELF - the "self" type of this assertion class.
ELEMENT - the type of elements.
All Implemented Interfaces:
Assert<SELF,Spliterator<ELEMENT>>, Descriptable<SELF>, ExtensionPoints<SELF,Spliterator<ELEMENT>>
Direct Known Subclasses:
SpliteratorAssert

public class AbstractSpliteratorAssert<SELF extends AbstractSpliteratorAssert<SELF,ELEMENT>,ELEMENT> extends AbstractAssert<SELF,Spliterator<ELEMENT>>
Assertions for Spliterator type.
Author:
William Bakker
  • Constructor Details

  • Method Details

    • hasCharacteristics

      public SELF hasCharacteristics(int... characteristics)
      Asserts the actual Spliterator has the given characteristics.

      Example:

       Spliterator<Integer> spliterator = Stream.of(1, 2, 3).spliterator();
      
       // this assertion succeeds:
       assertThat(spliterator).hasCharacteristics(Spliterator.SIZED, Spliterator.ORDERED);
      
       // this assertion fails as the Spliterator does not have characteristic DISTINCT:
       assertThat(spliterator).hasCharacteristics(Spliterator.DISTINCT); 
      Parameters:
      characteristics - the expected characteristics.
      Returns:
      this assertion object.
      Throws:
      AssertionError - if the actual Spliterator is null.
      AssertionError - if the actual Spliterator does not have the expected characteristics.
    • hasOnlyCharacteristics

      public SELF hasOnlyCharacteristics(int... characteristics)
      Asserts the actual Spliterator has only the given characteristics and nothing else.

      Example:

       Spliterator<Integer> spliterator = Stream.of(1, 2, 3).spliterator();
      
       // this assertion succeeds:
       assertThat(spliterator).hasOnlyCharacteristics(Spliterator.SIZED,
                                                      Spliterator.SUBSIZED,
                                                      Spliterator.IMMUTABLE,
                                                      Spliterator.ORDERED);
      
       // this assertion fails as the Spliterator has additional characteristics IMMUTABLE and ORDERED:
       assertThat(spliterator).hasOnlyCharacteristics(Spliterator.SIZED, Spliterator.SUBSIZED); 
      Parameters:
      characteristics - the expected characteristics.
      Returns:
      this assertion object.
      Throws:
      AssertionError - if the actual Spliterator is null.
      AssertionError - if the actual Spliterator does not have the expected characteristics or the actual Spliterator has additional characteristics.