Class StringSubject
java.lang.Object
com.google.common.truth.Subject<StringSubject, String>
com.google.common.truth.ComparableSubject<StringSubject, String>
com.google.common.truth.StringSubject
Propositions for string subjects.
-
Nested Class Summary
Nested classes/interfaces inherited from class Subject
Subject.HasField -
Field Summary
FieldsFields inherited from class Subject
failureStrategy -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcontains(CharSequence string) Fails if the string does not contain the given sequence.voidcontainsMatch(String regex) Fails if the string does not contain a match on the given regex.voidcontainsMatch(Pattern pattern) Fails if the string does not contain a match on the given regex.voiddoesNotContain(CharSequence string) Fails if the string contains the given sequence.voiddoesNotContainMatch(String regex) Fails if the string contains a match on the given regex.voiddoesNotContainMatch(Pattern pattern) Fails if the string contains a match on the given regex.voiddoesNotMatch(String regex) Fails if the string matches the given regex.voiddoesNotMatch(Pattern regex) Fails if the string matches the given regex.voidFails if the string does not end with the given string.protected StringvoidhasLength(int expectedLength) Fails if the string does not have the given length.voidvoidisEmpty()Fails if the string is not equal to the zero-length "empty string."voidFails if the subject is not equal to the given object.voidFails if the string is equal to the zero-length "empty string."voidisNull()Fails if the string is not null.voidFails if the string does not match the given regex.voidFails if the string does not match the given regex.private static Stringquote(CharSequence toBeWrapped) voidstartsWith(String string) Fails if the string does not start with the given string.Methods inherited from class ComparableSubject
comparesEqualTo, isAtLeast, isAtMost, isGreaterThan, isIn, isLessThan, isNotInMethods inherited from class Subject
check, equals, fail, fail, fail, failWithBadResults, failWithCustomSubject, failWithoutSubject, failWithRawMessage, getSubject, hasField, hashCode, internalCustomName, isA, isInstanceOf, isNotA, isNotEqualTo, isNotInstanceOf, isNotNull, isNotSameAs, isSameAs, labeled, named
-
Field Details
-
STRING
Deprecated.Use afor eachstyle loop over yourIterable<Integer>instead.
-
-
Constructor Details
-
StringSubject
-
-
Method Details
-
getDisplaySubject
- Overrides:
getDisplaySubjectin classSubject<StringSubject, String>
-
is
- Overrides:
isin classSubject<StringSubject, String>
-
isEqualTo
-
isNull
public void isNull()Fails if the string is not null.- Overrides:
isNullin classSubject<StringSubject, String>
-
hasLength
public void hasLength(int expectedLength) Fails if the string does not have the given length. -
isEmpty
public void isEmpty()Fails if the string is not equal to the zero-length "empty string." -
isNotEmpty
public void isNotEmpty()Fails if the string is equal to the zero-length "empty string." -
contains
Fails if the string does not contain the given sequence. -
doesNotContain
Fails if the string contains the given sequence. -
startsWith
Fails if the string does not start with the given string. -
endsWith
Fails if the string does not end with the given string. -
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
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
Fails if the string contains a match on the given regex. -
doesNotContainMatch
Fails if the string contains a match on the given regex. -
quote
-
for eachstyle loop over yourIterable<Integer>instead.