Class ShouldContainSubsequenceOfCharSequence

  • All Implemented Interfaces:
    ErrorMessageFactory

    public class ShouldContainSubsequenceOfCharSequence
    extends BasicErrorMessageFactory
    Creates an error message indicating that an assertion that verifies that a CharSequence contains a Subsequence of several CharSequences in order failed.
    • Constructor Detail

      • ShouldContainSubsequenceOfCharSequence

        private ShouldContainSubsequenceOfCharSequence​(java.lang.String format,
                                                       java.lang.CharSequence actual,
                                                       java.lang.CharSequence[] strings,
                                                       java.lang.CharSequence foundButBadOrder,
                                                       java.lang.CharSequence foundButBadOrder2,
                                                       ComparisonStrategy comparisonStrategy)
      • ShouldContainSubsequenceOfCharSequence

        private ShouldContainSubsequenceOfCharSequence​(java.lang.String format,
                                                       java.lang.CharSequence actual,
                                                       java.lang.CharSequence[] strings,
                                                       ComparisonStrategy comparisonStrategy)
    • Method Detail

      • shouldContainSubsequence

        public static ErrorMessageFactory shouldContainSubsequence​(java.lang.CharSequence actual,
                                                                   java.lang.CharSequence[] strings,
                                                                   int firstBadOrderIndex)
        Parameters:
        actual - the actual value in the failed assertion.
        strings - the sequence of values expected to be in actual.
        firstBadOrderIndex - first index failing the subsequence.
        Returns:
        the created ErrorMessageFactory.
      • shouldContainSubsequence

        public static ErrorMessageFactory shouldContainSubsequence​(java.lang.CharSequence actual,
                                                                   java.lang.CharSequence[] strings,
                                                                   int badOrderIndex,
                                                                   ComparisonStrategy comparisonStrategy)
        Parameters:
        actual - the actual value in the failed assertion.
        strings - the sequence of values expected to be in actual.
        badOrderIndex - index failing the subsequence.
        comparisonStrategy - the ComparisonStrategy used to evaluate assertion.
        Returns:
        the created ErrorMessageFactory.
      • shouldContainSubsequence

        public static ErrorMessageFactory shouldContainSubsequence​(java.lang.CharSequence actual,
                                                                   java.lang.CharSequence[] strings,
                                                                   java.util.Map<java.lang.CharSequence,​java.lang.Integer> notFoundRepeatedSubsequence,
                                                                   ComparisonStrategy comparisonStrategy)
        Creates a new ShouldContainSubsequenceOfCharSequence with detailed error messages about missing subsequences.
        Parameters:
        actual - the actual value in the failed assertion.
        strings - the sequence of values expected to be in actual.
        notFoundRepeatedSubsequence - a map where each key is a subsequence of strings that was expected to be found in actual and the corresponding value is the number of times it was expected but not found.
        comparisonStrategy - the ComparisonStrategy used to evaluate assertion.
        Returns:
        the created ErrorMessageFactory.
      • ordinal

        private static java.lang.String ordinal​(int i)
        Returns the ordinal representation of a given integer.

        This method converts integers to their ordinal form (e.g., 1 to "1st", 2 to "2nd", etc.). Special cases for numbers ending in 11, 12, and 13 are handled to return "th" instead of "st", "nd", or "rd".

        Parameters:
        i - the integer to convert
        Returns:
        the ordinal representation of i