Class ShouldContainSubsequenceOfCharSequence

java.lang.Object
org.assertj.core.error.BasicErrorMessageFactory
org.assertj.core.error.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 Details

  • Method Details

    • shouldContainSubsequence

      public static ErrorMessageFactory shouldContainSubsequence(CharSequence actual, 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(CharSequence actual, 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(CharSequence actual, CharSequence[] strings, Map<CharSequence,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 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