Class SeqAssert<ELEMENT>

  • All Implemented Interfaces:
    org.assertj.core.api.Assert<SeqAssert<ELEMENT>,​io.vavr.collection.Seq<ELEMENT>>, org.assertj.core.api.Descriptable<SeqAssert<ELEMENT>>, org.assertj.core.api.EnumerableAssert<SeqAssert<ELEMENT>,​ELEMENT>, org.assertj.core.api.ExtensionPoints<SeqAssert<ELEMENT>,​io.vavr.collection.Seq<ELEMENT>>, org.assertj.core.api.IndexedObjectEnumerableAssert<SeqAssert<ELEMENT>,​ELEMENT>, org.assertj.core.api.ObjectEnumerableAssert<SeqAssert<ELEMENT>,​ELEMENT>

    public class SeqAssert<ELEMENT>
    extends org.assertj.core.api.AbstractIterableAssert<SELF,​ACTUAL,​ELEMENT,​ELEMENT_ASSERT>
    • Field Summary

      • Fields inherited from class org.assertj.core.api.AbstractIterableAssert

        iterables
      • Fields inherited from class org.assertj.core.api.AbstractAssert

        actual, info, myself, throwUnsupportedExceptionOnEquals
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      ACTUAL actual()  
      SELF contains​(ELEMENT value, org.assertj.core.data.Index index)
      Verifies that the actual Seq contains the given object at the given index.
      SELF containsExactlyInAnyOrder​(io.vavr.collection.Traversable<ELEMENT> values)  
      SELF doesNotContain​(ELEMENT value, org.assertj.core.data.Index index)
      Verifies that the actual group does not contain the given object at the given index.
      SELF has​(org.assertj.core.api.Condition<? super ELEMENT> condition, org.assertj.core.data.Index index)
      Verifies that the actual object at the given index in the actual group satisfies the given condition.
      org.assertj.core.api.WritableAssertionInfo info()  
      SELF is​(org.assertj.core.api.Condition<? super ELEMENT> condition, org.assertj.core.data.Index index)
      Verifies that the actual object at the given index in the actual group satisfies the given condition (alias of has(Condition, Index)).
      SELF isSorted()
      Verifies that the actual sequence is sorted in ascending order according to the natural ordering of its elements.
      SELF isSortedAccordingTo​(Comparator<? super ELEMENT> comparator)
      Verifies that the actual sequence is sorted according to the given comparator.
      Empty sequences are considered sorted whatever the comparator is.
      One element sequences are considered sorted if the element is compatible with comparator.
      protected SeqAssert<ELEMENT> newAbstractIterableAssert​(Iterable<? extends ELEMENT> iterable)  
      org.assertj.core.internal.Objects objects()  
      SELF satisfies​(Consumer<? super ELEMENT> requirements, org.assertj.core.data.Index index)
      Verifies that the actual @{code Seq} contains the value at given Index that satisfy given requirements.
      protected org.assertj.core.api.ObjectAssert<ELEMENT> toAssert​(ELEMENT value, String description)  
      SELF usingElementComparator​(Comparator<? super ELEMENT> customComparator)
      Use given custom comparator instead of relying on actual type A equals method to compare the Seq element's object for incoming assertion checks.
      SELF withAssertionState​(org.assertj.vavr.api.AbstractVavrAssert assertInstance)  
      • Methods inherited from class org.assertj.core.api.AbstractIterableAssert

        allMatch, allMatch, allSatisfy, anyMatch, anySatisfy, are, areAtLeast, areAtLeastOne, areAtMost, areExactly, areNot, as, as, contains, containsAll, containsAnyElementsOf, containsAnyOf, containsExactly, containsExactlyElementsOf, containsExactlyInAnyOrder, containsExactlyInAnyOrderElementsOf, containsNull, containsOnly, containsOnlyElementsOf, containsOnlyNulls, containsOnlyOnce, containsOnlyOnceElementsOf, containsSequence, containsSequence, containsSubsequence, containsSubsequence, describedAs, describedAs, doesNotContain, doesNotContainAnyElementsOf, doesNotContainNull, doesNotContainSequence, doesNotContainSequence, doesNotContainSubsequence, doesNotContainSubsequence, doesNotHave, doesNotHaveAnyElementsOfTypes, doesNotHaveDuplicates, doesNotHaveSameClassAs, doNotHave, element, element, endsWith, endsWith, extracting, extracting, extracting, extracting, extracting, extracting, extractingResultOf, extractingResultOf, filteredOn, filteredOn, filteredOn, filteredOn, filteredOn, filteredOnAssertions, filteredOnNull, first, first, flatExtracting, flatExtracting, flatExtracting, flatExtracting, flatExtracting, flatExtracting, flatMap, flatMap, flatMap, flatMap, getComparatorsByType, getComparatorsForElementPropertyOrFieldTypes, has, hasAtLeastOneElementOfType, hasOnlyElementsOfType, hasOnlyElementsOfTypes, hasOnlyOneElementSatisfying, hasSameClassAs, hasSameElementsAs, hasSameSizeAs, hasSameSizeAs, hasSize, hasSizeBetween, hasSizeGreaterThan, hasSizeGreaterThanOrEqualTo, hasSizeLessThan, hasSizeLessThanOrEqualTo, hasToString, have, haveAtLeast, haveAtLeastOne, haveAtMost, haveExactly, inBinary, inHexadecimal, is, isEmpty, isEqualTo, isExactlyInstanceOf, isIn, isIn, isInstanceOf, isInstanceOfAny, isNot, isNotEmpty, isNotEqualTo, isNotExactlyInstanceOf, isNotIn, isNotIn, isNotInstanceOf, isNotInstanceOfAny, isNotNull, isNotOfAnyClassIn, isNotSameAs, isNullOrEmpty, isOfAnyClassIn, isSameAs, isSubsetOf, isSubsetOf, last, last, map, map, map, navigationDescription, noneMatch, noneSatisfy, overridingErrorMessage, satisfiesExactly, satisfiesExactlyInAnyOrder, singleElement, singleElement, size, startsWith, usingComparator, usingComparator, usingComparatorForElementFieldsWithNames, usingComparatorForElementFieldsWithType, usingComparatorForType, usingComparisonStrategy, usingDefaultComparator, usingDefaultElementComparator, usingElementComparatorIgnoringFields, usingElementComparatorOnFields, usingFieldByFieldElementComparator, usingRecursiveComparison, usingRecursiveComparison, usingRecursiveFieldByFieldElementComparator, usingRecursiveFieldByFieldElementComparator, withFailMessage, withThreadDumpOnError, zipSatisfy
      • Methods inherited from class org.assertj.core.api.AbstractAssert

        asInstanceOf, asList, assertionError, asString, descriptionText, doesNotHaveSameHashCodeAs, doesNotHaveToString, equals, extracting, extracting, failure, failureWithActualExpected, failWithActualExpectedAndMessage, failWithMessage, getWritableAssertionInfo, hashCode, hasSameHashCodeAs, isElementOfCustomAssert, isInstanceOfSatisfying, isNull, matches, matches, newListAssertInstance, overridingErrorMessage, satisfies, satisfies, satisfiesAnyOf, satisfiesAnyOf, satisfiesAnyOf, setCustomRepresentation, setDescriptionConsumer, setPrintAssertionsDescription, throwAssertionError, withFailMessage, withRepresentation
      • Methods inherited from interface org.assertj.core.api.Descriptable

        as
      • Methods inherited from interface org.assertj.core.api.EnumerableAssert

        hasSameSizeAs, hasSameSizeAs, hasSize, hasSizeBetween, hasSizeGreaterThan, hasSizeGreaterThanOrEqualTo, hasSizeLessThan, hasSizeLessThanOrEqualTo, isEmpty, isNotEmpty, isNullOrEmpty, usingDefaultElementComparator
      • Methods inherited from interface org.assertj.core.api.ObjectEnumerableAssert

        allMatch, allMatch, allSatisfy, anyMatch, anySatisfy, are, areAtLeast, areAtLeastOne, areAtMost, areExactly, areNot, contains, containsAll, containsAnyElementsOf, containsAnyOf, containsExactly, containsExactlyElementsOf, containsExactlyInAnyOrder, containsExactlyInAnyOrderElementsOf, containsNull, containsOnly, containsOnlyElementsOf, containsOnlyNulls, containsOnlyOnce, containsOnlyOnceElementsOf, containsSequence, containsSequence, containsSubsequence, containsSubsequence, doesNotContain, doesNotContainAnyElementsOf, doesNotContainNull, doesNotContainSequence, doesNotContainSequence, doesNotContainSubsequence, doesNotContainSubsequence, doesNotHaveAnyElementsOfTypes, doesNotHaveDuplicates, doNotHave, endsWith, endsWith, hasAtLeastOneElementOfType, hasOnlyElementsOfType, hasOnlyElementsOfTypes, hasOnlyOneElementSatisfying, hasSameElementsAs, have, haveAtLeast, haveAtLeastOne, haveAtMost, haveExactly, isSubsetOf, isSubsetOf, noneMatch, noneSatisfy, satisfiesExactly, satisfiesExactlyInAnyOrder, startsWith
    • Method Detail

      • toAssert

        protected org.assertj.core.api.ObjectAssert<ELEMENT> toAssert​(ELEMENT value,
                                                                      String description)
        Specified by:
        toAssert in class org.assertj.core.api.AbstractIterableAssert<SeqAssert<ELEMENT>,​io.vavr.collection.Seq<ELEMENT>,​ELEMENT,​org.assertj.core.api.ObjectAssert<ELEMENT>>
      • usingElementComparator

        public SELF usingElementComparator​(Comparator<? super ELEMENT> customComparator)
        Use given custom comparator instead of relying on actual type A equals method to compare the Seq element's object for incoming assertion checks.
        Specified by:
        usingElementComparator in interface org.assertj.core.api.EnumerableAssert<SELF extends org.assertj.vavr.api.AbstractSeqAssert<SELF,​ACTUAL,​ELEMENT,​ELEMENT_ASSERT>,​ACTUAL extends io.vavr.collection.Seq<? extends ELEMENT>>
        Overrides:
        usingElementComparator in class org.assertj.core.api.AbstractIterableAssert<SELF extends org.assertj.vavr.api.AbstractSeqAssert<SELF,​ACTUAL,​ELEMENT,​ELEMENT_ASSERT>,​ACTUAL extends io.vavr.collection.Seq<? extends ELEMENT>,​ELEMENT,​ELEMENT_ASSERT extends org.assertj.core.api.AbstractAssert<ELEMENT_ASSERT,​ELEMENT>>
        Parameters:
        customComparator - the comparator to use for incoming assertion checks.
        Returns:
        this assertion object.
        Throws:
        NullPointerException - if the given comparator is null.
      • contains

        public SELF contains​(ELEMENT value,
                             org.assertj.core.data.Index index)
        Verifies that the actual Seq contains the given object at the given index.

        Example:

         Seq<Ring> elvesRings = List.of(vilya, nenya, narya);
        
         // assertions will pass
         assertThat(elvesRings).contains(vilya, atIndex(0));
         assertThat(elvesRings).contains(nenya, atIndex(1));
         assertThat(elvesRings).contains(narya, atIndex(2));
        
         // assertions will fail
         assertThat(elvesRings).contains(vilya, atIndex(1));
         assertThat(elvesRings).contains(nenya, atIndex(2));
         assertThat(elvesRings).contains(narya, atIndex(0));
        Specified by:
        contains in interface org.assertj.core.api.IndexedObjectEnumerableAssert<SELF extends org.assertj.vavr.api.AbstractSeqAssert<SELF,​ACTUAL,​ELEMENT,​ELEMENT_ASSERT>,​ACTUAL extends io.vavr.collection.Seq<? extends ELEMENT>>
        Parameters:
        value - the object to look for.
        index - the index where the object should be stored in the actual group.
        Returns:
        this assertion object.
        Throws:
        AssertionError - if the actual group is null or empty.
        NullPointerException - if the given Index is null.
        IndexOutOfBoundsException - if the value of the given Index is equal to or greater than the size of the actual group.
        AssertionError - if the actual group does not contain the given object at the given index.
      • doesNotContain

        public SELF doesNotContain​(ELEMENT value,
                                   org.assertj.core.data.Index index)
        Verifies that the actual group does not contain the given object at the given index.

        Example:

         Seq<Ring> elvesRings = List.of(vilya, nenya, narya);
        
         // assertions will pass
         assertThat(elvesRings).contains(vilya, atIndex(1));
         assertThat(elvesRings).contains(nenya, atIndex(2));
         assertThat(elvesRings).contains(narya, atIndex(0));
        
         // assertions will fail
         assertThat(elvesRings).contains(vilya, atIndex(0));
         assertThat(elvesRings).contains(nenya, atIndex(1));
         assertThat(elvesRings).contains(narya, atIndex(2));
        Specified by:
        doesNotContain in interface org.assertj.core.api.IndexedObjectEnumerableAssert<SELF extends org.assertj.vavr.api.AbstractSeqAssert<SELF,​ACTUAL,​ELEMENT,​ELEMENT_ASSERT>,​ACTUAL extends io.vavr.collection.Seq<? extends ELEMENT>>
        Parameters:
        value - the object to look for.
        index - the index where the object should not be stored in the actual group.
        Returns:
        this assertion object.
        Throws:
        AssertionError - if the actual group is null.
        NullPointerException - if the given Index is null.
        AssertionError - if the actual group contains the given object at the given index.
      • has

        public SELF has​(org.assertj.core.api.Condition<? super ELEMENT> condition,
                        org.assertj.core.data.Index index)
        Verifies that the actual object at the given index in the actual group satisfies the given condition.
        Parameters:
        condition - the given condition.
        index - the index where the object should be stored in the actual group.
        Returns:
        this assertion object.
        Throws:
        AssertionError - if the given Seq is null or empty.
        NullPointerException - if the given Index is null.
        IndexOutOfBoundsException - if the value of the given Index is equal to or greater than the size of the given Seq.
        NullPointerException - if the given Condition is null.
        AssertionError - if the value in the given Seq at the given index does not satisfy the given Condition .
      • is

        public SELF is​(org.assertj.core.api.Condition<? super ELEMENT> condition,
                       org.assertj.core.data.Index index)
        Verifies that the actual object at the given index in the actual group satisfies the given condition (alias of has(Condition, Index)).
        Parameters:
        condition - the given condition.
        index - the index where the object should be stored in the actual group.
        Returns:
        this assertion object.
        Throws:
        AssertionError - if the given Seq is null or empty.
        NullPointerException - if the given Index is null.
        IndexOutOfBoundsException - if the value of the given Index is equal to or greater than the size of the given Seq.
        NullPointerException - if the given Condition is null.
        AssertionError - if the value in the given Seq at the given index does not satisfy the given Condition .
      • isSorted

        public SELF isSorted()
        Verifies that the actual sequence is sorted in ascending order according to the natural ordering of its elements.

        All sequence elements must implement the Comparable interface and must be mutually comparable (that is, e1.compareTo(e2) must not throw a ClassCastException for any elements e1 and e2 in the sequence), examples :

        • a sequence composed of {"a1", "a2", "a3"} is ok because the element type (String) is Comparable
        • a sequence composed of Rectangle {r1, r2, r3} is NOT ok because Rectangle is not Comparable
        • a sequence composed of {True, "abc", False} is NOT ok because elements are not mutually comparable
        Empty sequences are considered sorted.
        Unique element sequences are considered sorted unless the element type is not Comparable.
        Returns:
        this assertion object.
        Throws:
        AssertionError - if the actual sequence is not sorted in ascending order according to the natural ordering of its elements.
        AssertionError - if the actual sequence is null.
        AssertionError - if the actual sequence element type does not implement Comparable.
        AssertionError - if the actual sequence elements are not mutually Comparable.
      • isSortedAccordingTo

        public SELF isSortedAccordingTo​(Comparator<? super ELEMENT> comparator)
        Verifies that the actual sequence is sorted according to the given comparator.
        Empty sequences are considered sorted whatever the comparator is.
        One element sequences are considered sorted if the element is compatible with comparator.
        Parameters:
        comparator - the Comparator used to compare sequence elements
        Returns:
        this assertion object.
        Throws:
        AssertionError - if the actual sequence is not sorted according to the given comparator.
        AssertionError - if the actual sequence is null.
        NullPointerException - if the given comparator is null.
        AssertionError - if the actual sequence elements are not mutually comparable according to given Comparator.
      • satisfies

        public SELF satisfies​(Consumer<? super ELEMENT> requirements,
                              org.assertj.core.data.Index index)
        Verifies that the actual @{code Seq} contains the value at given Index that satisfy given requirements.

        Example:

        
         Seq<TolkienCharacter> ringBearers = List.of(frodo, elrond, gandalf);
        
         // this assertion will pass
         assertThat(ringBearers).satisfies(
             ringBearer -> {
                 assertThat(ringBearer.getAge()).isGreaterThan(200);
                 assertThat(ringBearer.getRace()).isEqualTo(ELF);
             },
             atIndex(1));
        
         // this assertion will fail
         assertThat(ringBearers).satisfies(
             ringBearer -> {
                 assertThat(ringBearer.getRace()).isEqualTo(ELF);
             },
             atIndex(0);
         
        Parameters:
        requirements - the given requirements for the element at Index to meet.
        index - the index where the object should be stored in the actual Seq.
        Returns:
        this assertion object.
        Throws:
        AssertionError - if the value at given Index does not satisfy the requirements.
        AssertionError - if the actual sequence is null.
        NullPointerException - if the given requirements are null.
        NullPointerException - if the given Index is null.
        IndexOutOfBoundsException - if the value of the given Index is equal to or greater than the size of the actual Seq.
      • containsExactlyInAnyOrder

        public SELF containsExactlyInAnyOrder​(io.vavr.collection.Traversable<ELEMENT> values)
      • actual

        public ACTUAL actual()
      • withAssertionState

        public SELF withAssertionState​(org.assertj.vavr.api.AbstractVavrAssert assertInstance)
      • objects

        public org.assertj.core.internal.Objects objects()
      • info

        public org.assertj.core.api.WritableAssertionInfo info()