StringAssertions class

Contains a number of methods to assert that a String is in the expected state.

Inheritance

Constructors

StringAssertions(String? subject, {bool isReversed = false, String? subjectLabel})
Initializes a new instance of the StringAssertion class.

Properties

and StringAssertions
Bind assertions
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
isReversed bool
Checking reverse
finalinherited
not StringAssertions
Invert assertion
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
subject String?
the object which value is being asserted.
finalinherited
subjectLabel String
Friendly label for the subject object
no setterinherited

Methods

as(String subjectLabel) StringAssertions
Set friendly title for the subject
inherited
be(String expected) StringAssertions
Asserts that the value is equal to the specified expected value. expected The expected value
inherited
beAssignableTo<U>() → U?
Asserts that the object is assignable to a variable of type U
inherited
beBlank() StringAssertions
Asserts that a string is either '' or white space
beNull() StringAssertions
Asserts that the object is not null
inherited
beNullOrEmpty() StringAssertions
Asserts that a string is either null or '' />.
beNullOrWhiteSpace() StringAssertions
Asserts that a string is either null or '' or white space
beOfType<U>() → U?
Asserts that the object is not of the specified type U
inherited
beOneOf(Iterable<String> validItems) StringAssertions
Asserts that a value is one of the specified validItems
inherited
contain(String expected, {bool ignoreCase = false}) StringAssertions
copy(String? subject, {bool isReversed = false, String? subjectLabel}) StringAssertions
Copy the matcher
override
endWith(String expected) StringAssertions
Asserts that a string ends exactly with the specified expected value, including the casing and any leading or trailing whitespace.
haveLength(int expected) StringAssertions
Asserts that a string has the specified expected length. expected The expected length of the string
isEqual(String expected) bool
Comparison with an another expected value
inherited
match(String wildcardPattern) StringAssertions
Asserts that a string matches a wildcard pattern. wildcardPattern The wildcard pattern with which the subject is matched, where * and ? have special meanings.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
startWith(String expected) StringAssertions
Asserts that a string starts exactly with the specified expected value, including the casing and any leading or trailing whitespace.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited