Class ShouldContainCharSequenceOnlyOnce

java.lang.Object
org.assertj.core.error.BasicErrorMessageFactory
org.assertj.core.error.ShouldContainCharSequenceOnlyOnce
All Implemented Interfaces:
ErrorMessageFactory

public class ShouldContainCharSequenceOnlyOnce extends BasicErrorMessageFactory
Creates an error message indicating that an assertion that verifies that a CharSequence contains another CharSequence only once failed.
Author:
Pauline Iogna, Joel Costigliola, Mikhail Mazursky
  • Method Details

    • shouldContainOnlyOnce

      public static ErrorMessageFactory shouldContainOnlyOnce(CharSequence actual, CharSequence sequence, int occurrences, org.assertj.core.internal.ComparisonStrategy comparisonStrategy)
      Parameters:
      actual - the actual value in the failed assertion.
      sequence - the String expected to be in actual only once.
      occurrences - the number of occurrences of sequence in actual.
      comparisonStrategy - the ComparisonStrategy used to evaluate assertion.
      Returns:
      the created ErrorMessageFactory.
    • shouldContainOnlyOnce

      public static ErrorMessageFactory shouldContainOnlyOnce(CharSequence actual, CharSequence sequence, int occurrences)
      Parameters:
      actual - the actual value in the failed assertion.
      sequence - the String expected to be in actual only once.
      occurrences - the number of occurrences of sequence in actual.
      Returns:
      the created ErrorMessageFactory.