public interface AssertThatString extends AssertThatCastableObject<String>
This interface is returned by the various methods
assertThat
exposed by TestSuite
.
Modifier and Type | Method and Description |
---|---|
default boolean |
containsString(String substring)
Check that a string another string.
|
default boolean |
endsWith(String prefix)
Check that a string ends with another one.
|
default boolean |
matchesRegex(Pattern pattern)
Validate a string with a
Pattern . |
default boolean |
matchesRegex(String regex)
Validate a string with a regex.
|
default boolean |
startsWith(String prefix)
Check that a string starts with another one.
|
as, as
default boolean containsString(String substring)
This method is a shortcut to is(containsString(substring))
.
By default, assertion can only be used from the main thread of the
test ; When used from another thread, the assertion will be lost. In the
case the fastFail
attribute of @Test
annotation is used, the assertion may not be lost, in case the thread use
an assertion method from the test object instance.
substring
- the other string.Test.fastFail()
: If true
, then
fail the test, else, return false and the test will be failed
later.The documentation of the fastFail
attribute of the @Test
annotation, regarding the action
done by this assertion.
default boolean startsWith(String prefix)
This method is a shortcut to is(startsWith(prefix))
.
By default, assertion can only be used from the main thread of the
test ; When used from another thread, the assertion will be lost. In the
case the fastFail
attribute of @Test
annotation is used, the assertion may not be lost, in case the thread use
an assertion method from the test object instance.
prefix
- the prefix.Test.fastFail()
: If true
, then
fail the test, else, return false and the test will be failed
later.The documentation of the fastFail
attribute of the @Test
annotation, regarding the action
done by this assertion.
default boolean endsWith(String prefix)
This method is a shortcut to is(endsWith(prefix))
.
By default, assertion can only be used from the main thread of the
test ; When used from another thread, the assertion will be lost. In the
case the fastFail
attribute of @Test
annotation is used, the assertion may not be lost, in case the thread use
an assertion method from the test object instance.
prefix
- the prefix.Test.fastFail()
: If true
, then
fail the test, else, return false and the test will be failed
later.The documentation of the fastFail
attribute of the @Test
annotation, regarding the action
done by this assertion.
default boolean matchesRegex(Pattern pattern)
Pattern
.
This method is a shortcut to is(matchesRegex(pattern))
.
By default, assertion can only be used from the main thread of the
test ; When used from another thread, the assertion will be lost. In the
case the fastFail
attribute of @Test
annotation is used, the assertion may not be lost, in case the thread use
an assertion method from the test object instance.
pattern
- the pattern to be used.Test.fastFail()
: If true
, then
fail the test, else, return false and the test will be failed
later.The documentation of the fastFail
attribute of the @Test
annotation, regarding the action
done by this assertion.
default boolean matchesRegex(String regex)
This method is a shortcut to is(matchesRegex(regex))
.
By default, assertion can only be used from the main thread of the
test ; When used from another thread, the assertion will be lost. In the
case the fastFail
attribute of @Test
annotation is used, the assertion may not be lost, in case the thread use
an assertion method from the test object instance.
regex
- The regex to be used for the validation.Test.fastFail()
: If true
, then
fail the test, else, return false and the test will be failed
later.The documentation of the fastFail
attribute of the @Test
annotation, regarding the action
done by this assertion.
Copyright © 2015 Powerunit. All rights reserved.