public final class StringSubject extends ComparableSubject<String>
Wrapper over StringSubject.

Since:
1.0
Author:
Iulian Andrei (iulian.andrei@qaitsolutions.com)
  • Constructor Details

    • StringSubject

      public StringSubject(String actual, String message)
      Constructor for regular assertions.

      Parameters:
      actual - Current value to be verified.
      message - Description of the assertion.
    • StringSubject

      public StringSubject(String actual, String message, ErrorTracker tracker)
      Constructor for soft assertions.

      Parameters:
      actual - Current value to be verified.
      message - Description of the assertion.
      tracker - Entity which allows keeping track of existing errors.
  • Method Details

    • hasLength

      public void hasLength(int expected)
      Wrapper over StringSubject.hasLength(int).

      Parameters:
      expected - Value to be verified against.
    • isEmpty

      public void isEmpty()
      Fails if the string is not equal to the zero-length "empty string." Wrapper over StringSubject.isEmpty().
    • isNotEmpty

      public void isNotEmpty()
      Fails if the string is equal to the zero-length "empty string." Wrapper over StringSubject.isNotEmpty().
    • contains

      public void contains(CharSequence string)
      Fails if the string does not contain the given sequence. Wrapper over StringSubject.contains(CharSequence).

      Parameters:
      string - Value to be verified against.
    • doesNotContain

      public void doesNotContain(CharSequence string)
      Fails if the string contains the given sequence. Wrapper over StringSubject.doesNotContain(CharSequence).

      Parameters:
      string - Value to be verified against.
    • startsWith

      public void startsWith(String string)
      Fails if the string does not start with the given string. Wrapper over StringSubject.startsWith(String).

      Parameters:
      string - Value to be verified against.
    • endsWith

      public void endsWith(String string)
      Fails if the string does not end with the given string. Wrapper over StringSubject.endsWith(String).

      Parameters:
      string - Value to be verified against.
    • matches

      public void matches(String regex)
      Fails if the string does not match the given regex. Wrapper over StringSubject.matches(String).

      Parameters:
      regex - Value to be verified against.
    • matches

      public void matches(Pattern regex)
      Fails if the string does not match the given regex. Wrapper over StringSubject.matches(Pattern).

      Parameters:
      regex - Value to be verified against.
    • doesNotMatch

      public void doesNotMatch(String regex)
      Fails if the string matches the given regex. Wrapper over StringSubject.doesNotMatch(String).

      Parameters:
      regex - Value to be verified against.
    • doesNotMatch

      public void doesNotMatch(Pattern regex)
      Fails if the string matches the given regex. Wrapper over StringSubject.doesNotMatch(Pattern).

      Parameters:
      regex - Value to be verified against.
    • containsMatch

      public void containsMatch(Pattern regex)
      Fails if the string does not contain a match on the given regex. Wrapper over StringSubject.containsMatch(Pattern).

      Parameters:
      regex - Value to be verified against.
    • containsMatch

      public void containsMatch(String regex)
      Fails if the string does not contain a match on the given regex. Wrapper over StringSubject.containsMatch(String).

      Parameters:
      regex - Value to be verified against.
    • doesNotContainMatch

      public void doesNotContainMatch(Pattern regex)
      Fails if the string contains a match on the given regex. Wrapper over StringSubject.doesNotContainMatch(Pattern).

      Parameters:
      regex - Value to be verified against.
    • doesNotContainMatch

      public void doesNotContainMatch(String regex)
      Fails if the string contains a match on the given regex. Wrapper over StringSubject.doesNotContainMatch(String).

      Parameters:
      regex - Value to be verified against.
    • ignoringCase

      Wrapper over StringSubject.ignoringCase().