Class Re2jSubjects.Re2jStringSubject
java.lang.Object
com.google.common.truth.Subject
com.google.common.truth.extensions.re2j.Re2jSubjects.Re2jStringSubject
- Enclosing class:
Re2jSubjects
-
Nested Class Summary
Nested classes/interfaces inherited from class Subject
Subject.Factory<SubjectT,ActualT> -
Method Summary
Modifier and TypeMethodDescriptionprotected StringReturns a string representation of the actual value for inclusion in failure messages.voidcontainsMatch(com.google.re2j.Pattern pattern) Fails if the string does not contain a match on the given regex.voidcontainsMatch(String regex) Fails if the string does not contain a match on the given regex.voiddoesNotContainMatch(com.google.re2j.Pattern pattern) Fails if the string contains a match on the given regex.voiddoesNotContainMatch(String regex) Fails if the string contains a match on the given regex.voiddoesNotMatch(com.google.re2j.Pattern regex) Fails if the string matches the given regex.voiddoesNotMatch(String regex) Fails if the string matches the given regex.voidmatches(com.google.re2j.Pattern regex) Fails if the string does not match the given regex.voidFails if the string does not match the given regex.Methods inherited from class Subject
check, equals, failWithActual, failWithActual, failWithoutActual, hashCode, ignoreCheck, isAnyOf, isEqualTo, isIn, isInstanceOf, isNoneOf, isNotEqualTo, isNotIn, isNotInstanceOf, isNotNull, isNotSameInstanceAs, isNull, isSameInstanceAs, toStringModifier and TypeMethodDescriptionprotected final StandardSubjectBuilderReturns a builder for creating a derived subject.final booleanDeprecated.protected final voidfailWithActual(Fact first, Fact... rest) Fails, reporting a message with the given facts, followed by an automatically added fact of the form: but was: actual value.protected final voidfailWithActual(String key, @Nullable Object value) Fails, reporting a message with two "facts": key: value but was: actual value.protected final voidfailWithoutActual(Fact first, Fact... rest) Fails, reporting a message with the given facts, without automatically adding the actual value.final inthashCode()Deprecated.Object.hashCode()is not supported on Truth subjects.protected final StandardSubjectBuilderBegins a new call chain that ignores any failures.voidChecks that the value under test is equal to any of the given elements.voidChecks that the value under test is equal to the given object.voidChecks that the value under test is equal to any element in the given iterable.voidisInstanceOf(@Nullable Class<?> clazz) Checks that the value under test is an instance of the given class.voidChecks that the value under test is not equal to any of the given elements.voidisNotEqualTo(@Nullable Object other) Checks that the value under test is not equal to the given object.voidChecks that the value under test is not equal to any element in the given iterable.voidisNotInstanceOf(@Nullable Class<?> clazz) Checks that the value under test is not an instance of the given class.voidChecks that the value under test is not null.final voidisNotSameInstanceAs(@Nullable Object other) Checks that the value under test is not the same instance as the given object.voidisNull()Checks that the value under test is null.final voidisSameInstanceAs(@Nullable Object expected) Checks that the value under test is the same instance as the given object.toString()Deprecated.Object.toString()is not supported on Truth subjects.
-
Method Details
-
actualCustomStringRepresentation
Description copied from class:SubjectReturns a string representation of the actual value for inclusion in failure messages.Subjects should override this with care.
By default, this method returns
String.valueOf(getActualValue())for most types. It does have some special logic for a few cases, like arrays.- Overrides:
actualCustomStringRepresentationin classSubject
-
matches
Fails if the string does not match the given regex. -
matches
Fails if the string does not match the given regex. -
doesNotMatch
Fails if the string matches the given regex. -
doesNotMatch
Fails if the string matches the given regex. -
containsMatch
@GwtIncompatible("com.google.re2j.Pattern") public void containsMatch(com.google.re2j.Pattern pattern) Fails if the string does not contain a match on the given regex. -
containsMatch
Fails if the string does not contain a match on the given regex. -
doesNotContainMatch
@GwtIncompatible("com.google.re2j.Pattern") public void doesNotContainMatch(com.google.re2j.Pattern pattern) Fails if the string contains a match on the given regex. -
doesNotContainMatch
Fails if the string contains a match on the given regex.
-
Object.equals(Object)is not supported on Truth subjects.