Class Strings


  • public class Strings
    extends java.lang.Object
    Reusable assertions for CharSequences.
    • Constructor Detail

      • Strings

        Strings()
    • Method Detail

      • getComparator

        public java.util.Comparator<?> getComparator()
      • assertNullOrEmpty

        public void assertNullOrEmpty​(AssertionInfo info,
                                      java.lang.CharSequence actual)
        Asserts that the given CharSequence is null or empty.
        Parameters:
        info - contains information about the assertion.
        actual - the given CharSequence.
        Throws:
        java.lang.AssertionError - if the given CharSequence is not null *and* it is not empty.
      • assertEmpty

        public void assertEmpty​(AssertionInfo info,
                                java.lang.CharSequence actual)
        Asserts that the given CharSequence is empty.
        Parameters:
        info - contains information about the assertion.
        actual - the given CharSequence.
        Throws:
        java.lang.AssertionError - if the given CharSequence is null.
        java.lang.AssertionError - if the given CharSequence is not empty.
      • assertNotEmpty

        public void assertNotEmpty​(AssertionInfo info,
                                   java.lang.CharSequence actual)
        Asserts that the given CharSequence is not empty.
        Parameters:
        info - contains information about the assertion.
        actual - the given CharSequence.
        Throws:
        java.lang.AssertionError - if the given CharSequence is null.
        java.lang.AssertionError - if the given CharSequence is empty.
      • hasContent

        private static boolean hasContent​(java.lang.CharSequence s)
      • assertBlank

        public void assertBlank​(AssertionInfo info,
                                java.lang.CharSequence actual)
        Asserts that the given CharSequence is Null, empty or consists of one or more whitespace characters.
        Parameters:
        info - contains information about the assertion.
        actual - the given CharSequence.
        Throws:
        java.lang.AssertionError - if the given CharSequence is not blank.
      • assertNotBlank

        public void assertNotBlank​(AssertionInfo info,
                                   java.lang.CharSequence actual)
        Asserts that the given CharSequence contains at least one non-whitespace character.
        Parameters:
        info - contains information about the assertion.
        actual - the given CharSequence.
        Throws:
        java.lang.AssertionError - if the given CharSequence is blank.
      • isBlank

        private boolean isBlank​(java.lang.CharSequence actual)
      • containsWhitespaces

        private boolean containsWhitespaces​(java.lang.CharSequence actual)
      • containsOnlyWhitespaces

        private boolean containsOnlyWhitespaces​(java.lang.CharSequence actual)
      • isNullOrEmpty

        private boolean isNullOrEmpty​(java.lang.CharSequence actual)
      • containsOneOrMoreWhitespaces

        private boolean containsOneOrMoreWhitespaces​(java.lang.CharSequence actual)
      • strictlyContainsWhitespaces

        private boolean strictlyContainsWhitespaces​(java.lang.CharSequence actual)
      • assertContainsWhitespaces

        public void assertContainsWhitespaces​(AssertionInfo info,
                                              java.lang.CharSequence actual)
        Asserts that the given CharSequence contains one or more whitespace characters.
        Parameters:
        info - contains information about the assertion.
        actual - the given CharSequence.
        Throws:
        java.lang.AssertionError - if the given CharSequence does not contain any whitespace characters.
      • assertContainsOnlyWhitespaces

        public void assertContainsOnlyWhitespaces​(AssertionInfo info,
                                                  java.lang.CharSequence actual)
        Asserts that the given CharSequence consists of one or more whitespace characters.
        Parameters:
        info - contains information about the assertion.
        actual - the given CharSequence.
        Throws:
        java.lang.AssertionError - if the given CharSequence is not blank.
      • assertDoesNotContainAnyWhitespaces

        public void assertDoesNotContainAnyWhitespaces​(AssertionInfo info,
                                                       java.lang.CharSequence actual)
        Asserts that the given CharSequence is Null, empty or contains only non-whitespace characters.
        Parameters:
        info - contains information about the assertion.
        actual - the given CharSequence.
        Throws:
        java.lang.AssertionError - if the given CharSequence contains one or more whitespace characters.
      • assertDoesNotContainOnlyWhitespaces

        public void assertDoesNotContainOnlyWhitespaces​(AssertionInfo info,
                                                        java.lang.CharSequence actual)
        Asserts that the given CharSequence is Null, empty or contains at least one non-whitespace character.
        Parameters:
        info - contains information about the assertion.
        actual - the given CharSequence.
        Throws:
        java.lang.AssertionError - if the given CharSequence is blank.
      • assertJavaBlank

        public void assertJavaBlank​(AssertionInfo info,
                                    java.lang.CharSequence actual)
        Asserts that the given CharSequence consists of one or more whitespace characters according to Character.isWhitespace(char).
        Parameters:
        info - contains information about the assertion.
        actual - the given CharSequence.
        Throws:
        java.lang.AssertionError - if the given CharSequence is not blank.
      • assertNotJavaBlank

        public void assertNotJavaBlank​(AssertionInfo info,
                                       java.lang.CharSequence actual)
        Asserts that the given CharSequence is Null, empty or contains at least one non-whitespace character according to Character.isWhitespace(char).
        Parameters:
        info - contains information about the assertion.
        actual - the given CharSequence.
        Throws:
        java.lang.AssertionError - if the given CharSequence is blank.
      • isJavaBlank

        private boolean isJavaBlank​(java.lang.CharSequence actual)
      • assertHasSize

        public void assertHasSize​(AssertionInfo info,
                                  java.lang.CharSequence actual,
                                  int expectedSize)
        Asserts that the size of the given CharSequence is equal to the expected one.
        Parameters:
        info - contains information about the assertion.
        actual - the given CharSequence.
        expectedSize - the expected size of actual.
        Throws:
        java.lang.AssertionError - if the given CharSequence is null.
        java.lang.AssertionError - if the size of the given CharSequence is different than the expected one.
      • assertHasSizeLessThan

        public void assertHasSizeLessThan​(AssertionInfo info,
                                          java.lang.CharSequence actual,
                                          int expectedMaxSizeExcluded)
        Asserts that the size of the given CharSequence is less than the expected size
        Parameters:
        info - contains information about the assertion.
        actual - the given CharSequence.
        expectedMaxSizeExcluded - the expected max size of actual
        Throws:
        java.lang.AssertionError - if the given CharSequence is null.
        java.lang.AssertionError - if the size of the given CharSequence is equal to or greater than the expected max size
      • assertHasSizeLessThanOrEqualTo

        public void assertHasSizeLessThanOrEqualTo​(AssertionInfo info,
                                                   java.lang.CharSequence actual,
                                                   int expectedMaxSizeIncluded)
        Asserts that the size of the given CharSequence is less than or equal to the expected size
        Parameters:
        info - contains information about the assertion.
        actual - the given CharSequence.
        expectedMaxSizeIncluded - the expected max size of actual
        Throws:
        java.lang.AssertionError - if the given CharSequence is null.
        java.lang.AssertionError - if the size of the given CharSequence is greater than the expected max size
      • assertHasSizeGreaterThan

        public void assertHasSizeGreaterThan​(AssertionInfo info,
                                             java.lang.CharSequence actual,
                                             int expectedMinSizeExcluded)
        Asserts that the size of the given CharSequence is greater than the expected size
        Parameters:
        info - contains information about the assertion.
        actual - the given CharSequence.
        expectedMinSizeExcluded - the expected min size of actual
        Throws:
        java.lang.AssertionError - if the given CharSequence is null.
        java.lang.AssertionError - if the size of the given CharSequence is equal to or less than the expected max size
      • assertHasSizeGreaterThanOrEqualTo

        public void assertHasSizeGreaterThanOrEqualTo​(AssertionInfo info,
                                                      java.lang.CharSequence actual,
                                                      int expectedMinSizeIncluded)
        Asserts that the size of the given CharSequence is greater than or equal to the expected size
        Parameters:
        info - contains information about the assertion.
        actual - the given CharSequence.
        expectedMinSizeIncluded - the expected min size of actual
        Throws:
        java.lang.AssertionError - if the given CharSequence is null.
        java.lang.AssertionError - if the size of the given CharSequence is greater than the expected max size
      • assertHasSizeBetween

        public void assertHasSizeBetween​(AssertionInfo info,
                                         java.lang.CharSequence actual,
                                         int lowerBoundary,
                                         int higherBoundary)
        Asserts that the size of the given CharSequence is between the given lower and higher boundary (inclusive).
        Parameters:
        info - contains information about the assertion.
        actual - the given Iterable.
        lowerBoundary - the lower boundary compared to which actual size should be greater than or equal to.
        higherBoundary - the higher boundary compared to which actual size should be less than or equal to.
        Throws:
        java.lang.AssertionError - if the given array is null.
        java.lang.AssertionError - if the number of elements in the given array is not between the boundaries.
      • assertHasLineCount

        public void assertHasLineCount​(AssertionInfo info,
                                       java.lang.CharSequence actual,
                                       int expectedLineCount)
        Asserts that the line count of the given CharSequence is equal to the expected one.
        Parameters:
        info - contains information about the assertion.
        actual - the given CharSequence.
        expectedLineCount - the expected line count of actual.
        Throws:
        java.lang.AssertionError - if the given CharSequence is null.
        java.lang.AssertionError - if the line count of the given CharSequence is different than the expected one.
      • assertHasSameSizeAs

        public void assertHasSameSizeAs​(AssertionInfo info,
                                        java.lang.CharSequence actual,
                                        java.lang.Iterable<?> other)
        Asserts that the number of entries in the given CharSequence has the same size as the other Iterable.
        Parameters:
        info - contains information about the assertion.
        actual - the given CharSequence.
        other - the group to compare
        Throws:
        java.lang.AssertionError - if the given CharSequence is null.
        java.lang.AssertionError - if the given Iterable is null.
        java.lang.AssertionError - if the number of entries in the given CharSequence does not have the same size.
      • assertHasSameSizeAs

        public void assertHasSameSizeAs​(AssertionInfo info,
                                        java.lang.CharSequence actual,
                                        java.lang.Object array)
        Asserts that the number of entries in the given CharSequence has the same size as the other array.
        Parameters:
        info - contains information about the assertion.
        actual - the given CharSequence.
        array - the array to compare
        Throws:
        java.lang.AssertionError - if the given CharSequence is null.
        java.lang.AssertionError - if the given array is null.
        java.lang.AssertionError - if the number of entries in the given CharSequence does not have the same size.
      • assertHasSameSizeAs

        public void assertHasSameSizeAs​(AssertionInfo info,
                                        java.lang.CharSequence actual,
                                        java.lang.CharSequence other)
      • assertContains

        public void assertContains​(AssertionInfo info,
                                   java.lang.CharSequence actual,
                                   java.lang.CharSequence... values)
        Verifies that the given CharSequence contains the given strings.
        Parameters:
        info - contains information about the assertion.
        actual - the actual CharSequence.
        values - the values to look for.
        Throws:
        java.lang.NullPointerException - if the given sequence is null.
        java.lang.IllegalArgumentException - if the given values is empty.
        java.lang.AssertionError - if the given CharSequence is null.
        java.lang.AssertionError - if the actual CharSequence does not contain the given sequence.
      • assertContainsOnlyDigits

        public void assertContainsOnlyDigits​(AssertionInfo info,
                                             java.lang.CharSequence actual)
        Verifies that the given CharSequence contains only digits.
        Parameters:
        info - contains information about the assertion.
        actual - the given CharSequence.
        Throws:
        java.lang.NullPointerException - if actual is null.
        java.lang.AssertionError - if actual contains non-digit characters or contains no digits at all.
      • checkIsNotNull

        private void checkIsNotNull​(java.lang.CharSequence... values)
      • checkIsNotEmpty

        private void checkIsNotEmpty​(java.lang.CharSequence... values)
      • stringContains

        private boolean stringContains​(java.lang.CharSequence actual,
                                       java.lang.CharSequence sequence)
      • assertContainsIgnoringCase

        public void assertContainsIgnoringCase​(AssertionInfo info,
                                               java.lang.CharSequence actual,
                                               java.lang.CharSequence sequence)
        Verifies that the given CharSequence contains the given sequence, ignoring case considerations.
        Parameters:
        info - contains information about the assertion.
        actual - the actual CharSequence.
        sequence - the sequence to search for.
        Throws:
        java.lang.NullPointerException - if the given sequence is null.
        java.lang.AssertionError - if the given CharSequence is null.
        java.lang.AssertionError - if the actual CharSequence does not contain the given sequence.
      • assertDoesNotContain

        public void assertDoesNotContain​(AssertionInfo info,
                                         java.lang.CharSequence actual,
                                         java.lang.CharSequence... values)
        Verifies that the given CharSequence does not contain any one of the given values.
        Parameters:
        info - contains information about the assertion.
        actual - the actual CharSequence.
        values - the values to search for.
        Throws:
        java.lang.NullPointerException - if the given list of values is null.
        java.lang.NullPointerException - if any one of the given values is null.
        java.lang.IllegalArgumentException - if the list of given values is empty.
        java.lang.AssertionError - if the actual CharSequence is null.
        java.lang.AssertionError - if the actual CharSequence contains any one of the given values.
      • checkCharSequenceIsNotNull

        private void checkCharSequenceIsNotNull​(java.lang.CharSequence sequence)
      • assertEqualsIgnoringCase

        public void assertEqualsIgnoringCase​(AssertionInfo info,
                                             java.lang.CharSequence actual,
                                             java.lang.CharSequence expected)
        Verifies that two CharSequences are equal, ignoring case considerations.
        Parameters:
        info - contains information about the assertion.
        actual - the actual CharSequence.
        expected - the expected CharSequence.
        Throws:
        java.lang.AssertionError - if the given CharSequences are not equal.
      • assertNotEqualsIgnoringCase

        public void assertNotEqualsIgnoringCase​(AssertionInfo info,
                                                java.lang.CharSequence actual,
                                                java.lang.CharSequence expected)
        Verifies that two CharSequences are not equal, ignoring case considerations.
        Parameters:
        info - contains information about the assertion.
        actual - the actual CharSequence.
        expected - the expected CharSequence.
        Throws:
        java.lang.AssertionError - if the given CharSequences are equal ignoring case considerations.
      • areEqualIgnoringCase

        private boolean areEqualIgnoringCase​(java.lang.CharSequence actual,
                                             java.lang.CharSequence expected)
      • assertIsEqualToNormalizingNewlines

        public void assertIsEqualToNormalizingNewlines​(AssertionInfo info,
                                                       java.lang.CharSequence actual,
                                                       java.lang.CharSequence expected)
        Verifies that two CharSequences are not equal, normalizing newlines.
        Parameters:
        info - contains information about the assertion.
        actual - the actual CharSequence (newlines will be normalized).
        expected - the expected CharSequence (newlines will be normalized)..
        Throws:
        java.lang.AssertionError - if the given CharSequences are equal after normalizing newlines.
      • normalizeNewlines

        private static java.lang.String normalizeNewlines​(java.lang.CharSequence actual)
      • assertEqualsIgnoringWhitespace

        public void assertEqualsIgnoringWhitespace​(AssertionInfo info,
                                                   java.lang.CharSequence actual,
                                                   java.lang.CharSequence expected)
        Verifies that two CharSequences are equal, ignoring any differences in whitespace.
        Parameters:
        info - contains information about the assertion.
        actual - the actual CharSequence.
        expected - the expected CharSequence.
        Throws:
        java.lang.AssertionError - if the given CharSequences are not equal.
      • assertNotEqualsIgnoringWhitespace

        public void assertNotEqualsIgnoringWhitespace​(AssertionInfo info,
                                                      java.lang.CharSequence actual,
                                                      java.lang.CharSequence expected)
        Verifies that two CharSequences are not equal, ignoring any differences in whitespace.
        Parameters:
        info - contains information about the assertion.
        actual - the actual CharSequence.
        expected - the expected CharSequence.
        Throws:
        java.lang.AssertionError - if the given CharSequences are equal.
      • areEqualIgnoringWhitespace

        private boolean areEqualIgnoringWhitespace​(java.lang.CharSequence actual,
                                                   java.lang.CharSequence expected)
      • removeAllWhitespaces

        private java.lang.String removeAllWhitespaces​(java.lang.CharSequence toBeStripped)
      • assertEqualsNormalizingWhitespace

        public void assertEqualsNormalizingWhitespace​(AssertionInfo info,
                                                      java.lang.CharSequence actual,
                                                      java.lang.CharSequence expected)
        Verifies that two CharSequences are equal, after the whitespace of both strings has been normalized.
        Parameters:
        info - contains information about the assertion.
        actual - the actual CharSequence.
        expected - the expected CharSequence.
        Throws:
        java.lang.AssertionError - if the given CharSequences are not equal.
        Since:
        2.8.0 / 3.8.0
      • assertNotEqualsNormalizingWhitespace

        public void assertNotEqualsNormalizingWhitespace​(AssertionInfo info,
                                                         java.lang.CharSequence actual,
                                                         java.lang.CharSequence expected)
        Verifies that two CharSequences are not equal, after the whitespace of both strings has been normalized.
        Parameters:
        info - contains information about the assertion.
        actual - the actual CharSequence.
        expected - the expected CharSequence.
        Throws:
        java.lang.AssertionError - if the given CharSequences are equal.
        Since:
        2.8.0 / 3.8.0
      • areEqualNormalizingWhitespace

        private boolean areEqualNormalizingWhitespace​(java.lang.CharSequence actual,
                                                      java.lang.CharSequence expected)
      • normalizeWhitespace

        private java.lang.String normalizeWhitespace​(java.lang.CharSequence toNormalize)
      • assertContainsOnlyOnce

        public void assertContainsOnlyOnce​(AssertionInfo info,
                                           java.lang.CharSequence actual,
                                           java.lang.CharSequence sequence)
        Verifies that actual CharSequences contains only once the given sequence.
        Parameters:
        info - contains information about the assertion.
        actual - the actual CharSequence.
        sequence - the given CharSequence.
        Throws:
        java.lang.NullPointerException - if the given sequence is null.
        java.lang.AssertionError - if the given CharSequence is null.
        java.lang.AssertionError - if the actual CharSequence does not contains only once the given CharSequence.
      • countOccurrences

        private int countOccurrences​(java.lang.CharSequence sequenceToSearch,
                                     java.lang.CharSequence actual)
        Count occurrences of sequenceToSearch in actual CharSequence.
        Parameters:
        sequenceToSearch - the sequence to search in in actual CharSequence.
        actual - the CharSequence to search occurrences in.
        Returns:
        the number of occurrences of sequenceToSearch in actual CharSequence.
      • assertStartsWith

        public void assertStartsWith​(AssertionInfo info,
                                     java.lang.CharSequence actual,
                                     java.lang.CharSequence prefix)
        Verifies that the given CharSequence starts with the given prefix.
        Parameters:
        info - contains information about the assertion.
        actual - the actual CharSequence.
        prefix - the given prefix.
        Throws:
        java.lang.NullPointerException - if the given sequence is null.
        java.lang.AssertionError - if the given CharSequence is null.
        java.lang.AssertionError - if the actual CharSequence does not start with the given prefix.
      • assertDoesNotStartWith

        public void assertDoesNotStartWith​(AssertionInfo info,
                                           java.lang.CharSequence actual,
                                           java.lang.CharSequence prefix)
        Verifies that the given CharSequence does not start with the given prefix.
        Parameters:
        info - contains information about the assertion.
        actual - the actual CharSequence.
        prefix - the given prefix.
        Throws:
        java.lang.NullPointerException - if the given sequence is null.
        java.lang.AssertionError - if the given CharSequence is null.
        java.lang.AssertionError - if the actual CharSequence starts with the given prefix.
      • failIfPrefixIsNull

        private static void failIfPrefixIsNull​(java.lang.CharSequence prefix)
      • assertEndsWith

        public void assertEndsWith​(AssertionInfo info,
                                   java.lang.CharSequence actual,
                                   java.lang.CharSequence suffix)
        Verifies that the given CharSequence ends with the given suffix.
        Parameters:
        info - contains information about the assertion.
        actual - the actual CharSequence.
        suffix - the given suffix.
        Throws:
        java.lang.NullPointerException - if the given sequence is null.
        java.lang.AssertionError - if the given CharSequence is null.
        java.lang.AssertionError - if the actual CharSequence does not end with the given suffix.
      • assertDoesNotEndWith

        public void assertDoesNotEndWith​(AssertionInfo info,
                                         java.lang.CharSequence actual,
                                         java.lang.CharSequence suffix)
        Verifies that the given CharSequence does not end with the given suffix.
        Parameters:
        info - contains information about the assertion.
        actual - the actual CharSequence.
        suffix - the given suffix.
        Throws:
        java.lang.NullPointerException - if the given sequence is null.
        java.lang.AssertionError - if the given CharSequence is null.
        java.lang.AssertionError - if the actual CharSequence ends with the given suffix.
      • failIfSuffixIsNull

        private static void failIfSuffixIsNull​(java.lang.CharSequence suffix)
      • assertMatches

        public void assertMatches​(AssertionInfo info,
                                  java.lang.CharSequence actual,
                                  java.lang.CharSequence regex)
        Verifies that the given CharSequence matches the given regular expression.
        Parameters:
        info - contains information about the assertion.
        actual - the given CharSequence.
        regex - the regular expression to which the actual CharSequence is to be matched.
        Throws:
        java.lang.NullPointerException - if the given pattern is null.
        java.util.regex.PatternSyntaxException - if the regular expression's syntax is invalid.
        java.lang.AssertionError - if the given CharSequence is null.
        java.lang.AssertionError - if the actual CharSequence does not match the given regular expression.
      • assertDoesNotMatch

        public void assertDoesNotMatch​(AssertionInfo info,
                                       java.lang.CharSequence actual,
                                       java.lang.CharSequence regex)
        Verifies that the given CharSequence does not match the given regular expression.
        Parameters:
        info - contains information about the assertion.
        actual - the given CharSequence.
        regex - the regular expression to which the actual CharSequence is to be matched.
        Throws:
        java.lang.NullPointerException - if the given pattern is null.
        java.util.regex.PatternSyntaxException - if the regular expression's syntax is invalid.
        java.lang.AssertionError - if the given CharSequence is null.
        java.lang.AssertionError - if the actual CharSequence matches the given regular expression.
      • checkRegexIsNotNull

        private void checkRegexIsNotNull​(java.lang.CharSequence regex)
      • assertMatches

        public void assertMatches​(AssertionInfo info,
                                  java.lang.CharSequence actual,
                                  java.util.regex.Pattern pattern)
        Verifies that the given CharSequence matches the given regular expression.
        Parameters:
        info - contains information about the assertion.
        actual - the given CharSequence.
        pattern - the regular expression to which the actual CharSequence is to be matched.
        Throws:
        java.lang.NullPointerException - if the given pattern is null.
        java.lang.AssertionError - if the given CharSequence is null.
        java.lang.AssertionError - if the given CharSequence does not match the given regular expression.
      • assertDoesNotMatch

        public void assertDoesNotMatch​(AssertionInfo info,
                                       java.lang.CharSequence actual,
                                       java.util.regex.Pattern pattern)
        Verifies that the given CharSequence does not match the given regular expression.
        Parameters:
        info - contains information about the assertion.
        actual - the given CharSequence.
        pattern - the regular expression to which the actual CharSequence is to be matched.
        Throws:
        java.lang.NullPointerException - if the given pattern is null.
        java.lang.AssertionError - if the given CharSequence matches the given regular expression.
      • checkIsNotNull

        private void checkIsNotNull​(java.util.regex.Pattern pattern)
      • patternToMatchIsNull

        private java.lang.NullPointerException patternToMatchIsNull()
      • assertNotNull

        private void assertNotNull​(AssertionInfo info,
                                   java.lang.CharSequence actual)
      • assertContainsSequence

        public void assertContainsSequence​(AssertionInfo info,
                                           java.lang.CharSequence actual,
                                           java.lang.CharSequence[] sequence)
        Verifies that the given charSequence contains the given sequence of charSequence, without any other charSequences between them.
        Parameters:
        info - contains information about the assertion.
        actual - the given charSequence.
        sequence - the sequence of charSequence to look for.
        Throws:
        java.lang.NullPointerException - if the given sequence of charSequence is null.
        java.lang.IllegalArgumentException - if the given sequence of charSequence is empty.
        java.lang.AssertionError - if the given CharSequence is null.
        java.lang.AssertionError - if the given CharSequence does not contain the given sequence of charSequence.
      • assertContainsSubsequence

        public void assertContainsSubsequence​(AssertionInfo info,
                                              java.lang.CharSequence actual,
                                              java.lang.CharSequence[] subsequence)
        Verifies that the actual CharSequence contains all the given values in the given order (possibly with other values between them).
        Parameters:
        info - contains information about the assertion.
        actual - the given CharSequence.
        subsequence - the Strings to look for, in order.
        Throws:
        java.lang.AssertionError - if the given CharSequence is null.
        java.lang.NullPointerException - if the given subsequence is null.
        java.lang.IllegalArgumentException - if the given subsequence is empty.
        java.lang.AssertionError - if the given CharSequence does not contain the given subsequence of charSequence.
      • removeUpTo

        private java.lang.String removeUpTo​(java.lang.String string,
                                            java.lang.CharSequence toRemove)
      • indexOf

        private int indexOf​(java.lang.String string,
                            java.lang.CharSequence toFind)
      • assertXmlEqualsTo

        public void assertXmlEqualsTo​(AssertionInfo info,
                                      java.lang.CharSequence actualXml,
                                      java.lang.CharSequence expectedXml)
      • assertIsSubstringOf

        public void assertIsSubstringOf​(AssertionInfo info,
                                        java.lang.CharSequence actual,
                                        java.lang.CharSequence sequence)
      • assertContainsPattern

        public void assertContainsPattern​(AssertionInfo info,
                                          java.lang.CharSequence actual,
                                          java.lang.CharSequence regex)
        Verifies that the given CharSequence contains the given regular expression.
        Parameters:
        info - contains information about the assertion.
        actual - the given CharSequence.
        regex - the regular expression to find in the actual CharSequence.
        Throws:
        java.lang.NullPointerException - if the given pattern is null.
        java.util.regex.PatternSyntaxException - if the regular expression's syntax is invalid.
        java.lang.AssertionError - if the given CharSequence is null.
        java.lang.AssertionError - if the actual CharSequence does not contain the given regular expression.
      • assertContainsPattern

        public void assertContainsPattern​(AssertionInfo info,
                                          java.lang.CharSequence actual,
                                          java.util.regex.Pattern pattern)
        Verifies that the given CharSequence contains the given regular expression.
        Parameters:
        info - contains information about the assertion.
        actual - the given CharSequence.
        pattern - the regular expression to find in the actual CharSequence.
        Throws:
        java.lang.NullPointerException - if the given pattern is null.
        java.lang.AssertionError - if the given CharSequence is null.
        java.lang.AssertionError - if the given CharSequence does not contain the given regular expression.
      • assertDoesNotContainPattern

        public void assertDoesNotContainPattern​(AssertionInfo info,
                                                java.lang.CharSequence actual,
                                                java.lang.CharSequence regex)
        Verifies that the given CharSequence does not contain the given regular expression.
        Parameters:
        info - contains information about the assertion.
        actual - the given CharSequence.
        regex - the regular expression to find in the actual CharSequence.
        Throws:
        java.lang.NullPointerException - if the given pattern is null.
        java.util.regex.PatternSyntaxException - if the regular expression's syntax is invalid.
        java.lang.AssertionError - if the given CharSequence is null.
        java.lang.AssertionError - if the actual CharSequence contains the given regular expression.
      • assertDoesNotContainPattern

        public void assertDoesNotContainPattern​(AssertionInfo info,
                                                java.lang.CharSequence actual,
                                                java.util.regex.Pattern pattern)
        Verifies that the given CharSequence does not contain the given regular expression.
        Parameters:
        info - contains information about the assertion.
        actual - the given CharSequence.
        pattern - the regular expression to find in the actual CharSequence.
        Throws:
        java.lang.NullPointerException - if the given pattern is null.
        java.lang.AssertionError - if the given CharSequence is null.
        java.lang.AssertionError - if the given CharSequence contains the given regular expression.
      • checkCharSequenceArrayDoesNotHaveNullElements

        private void checkCharSequenceArrayDoesNotHaveNullElements​(java.lang.CharSequence[] values)
      • assertIsEqualToIgnoringNewLines

        public void assertIsEqualToIgnoringNewLines​(AssertionInfo info,
                                                    java.lang.CharSequence actual,
                                                    java.lang.CharSequence expected)
        Verifies that actual is equal to expected ignoring new lines
        Parameters:
        info - contains information about the assertion.
        actual - the actual CharSequence (new lines will be ignored).
        expected - the expected CharSequence (new lines will be ignored).
      • assertLowerCase

        public void assertLowerCase​(AssertionInfo info,
                                    java.lang.CharSequence actual)
      • assertUpperCase

        public void assertUpperCase​(AssertionInfo info,
                                    java.lang.CharSequence actual)
      • removeNewLines

        private static java.lang.String removeNewLines​(java.lang.CharSequence text)
      • doCommonCheckForCharSequence

        private void doCommonCheckForCharSequence​(AssertionInfo info,
                                                  java.lang.CharSequence actual,
                                                  java.lang.CharSequence[] sequence)