R
- The return type.public class FluentStringAssertion<R> extends FluentObjectAssertion<R>
Constructor and Description |
---|
FluentStringAssertion(Assertion creator,
String text,
R returns)
Constructor.
|
FluentStringAssertion(String text,
R returns)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
FluentStringAssertion<R> |
apply(Function<String,String> f)
Applies an abitrary function against the text in this assertion.
|
R |
contains(String... values)
Asserts that the text contains all of the specified substrings.
|
R |
doesNotContain(String... values)
Asserts that the text doesn't contain any of the specified substrings.
|
R |
doesNotEqual(String value)
Asserts that the text equals the specified value.
|
R |
doesNotEqualIc(String value)
Asserts that the text does not equal the specified value ignoring case.
|
R |
doesNotMatch(Pattern pattern)
Asserts that the text doesn't match the specified regular expression pattern.
|
R |
doesNotMatch(String regex)
Asserts that the text doesn't match the specified regular expression.
|
R |
doesNotMatch(String regex,
int flags)
Asserts that the text doesn't match the specified regular expression.
|
R |
endsWith(String string)
Asserts that the text ends with the specified string.
|
R |
is(String value)
Asserts that the text equals the specified value.
|
R |
isEmpty()
Asserts that the text is not empty.
|
R |
isEqual(String value)
Asserts that the text equals the specified value.
|
R |
isEqualIc(String value)
Asserts that the text equals the specified value ignoring case.
|
R |
isEqualLines(String... lines)
Asserts that the lines of text equals the specified value.
|
R |
isEqualSortedLines(String... lines)
Asserts that the text equals the specified value after splitting both by newlines and sorting the rows.
|
R |
isNot(String value)
Asserts that the text equals the specified value.
|
R |
isNotEmpty()
Asserts that the text is not null or empty.
|
FluentStringAssertion<R> |
javaStrings()
When enabled, text in the message is converted to valid Java strings.
|
FluentStringAssertion<R> |
lc()
Converts the text to lowercase.
|
R |
matches(Pattern pattern)
Asserts that the text matches the specified regular expression pattern.
|
R |
matches(String regex)
Asserts that the text matches the specified regular expression.
|
R |
matches(String regex,
int flags)
Asserts that the text matches the specified regular expression.
|
R |
matchesSimple(String searchPattern)
Asserts that the text matches the specified pattern containing
|
FluentStringAssertion<R> |
msg(String msg,
Object... args)
Allows to to specify the assertion failure message.
|
FluentStringAssertion<R> |
replace(String target,
String replacement)
Performs the specified substring replacement on the underlying string.
|
FluentStringAssertion<R> |
replaceAll(String regex,
String replacement)
Performs the specified regular expression replacement on the underlying string.
|
FluentStringAssertion<R> |
sort()
Sorts the contents of the text by lines.
|
R |
startsWith(String string)
Asserts that the text starts with the specified string.
|
FluentStringAssertion<R> |
stderr()
If an error occurs, send the error message to STDERR.
|
FluentStringAssertion<R> |
stdout()
If an error occurs, send the error message to STDOUT.
|
FluentStringAssertion<R> |
uc()
Converts the text to uppercase.
|
FluentStringAssertion<R> |
urlDecode()
URL-decodes the text in this assertion.
|
doesNotEqual, doesNotExist, equivalent, exists, is, isAny, isEqual, isNot, isNotAny, isNotNull, isNull, isType, json, jsonSorted, passes, passes, sameAs, sameAsSerialized, sameAsSorted, serialized, string, string, string
returns
assertNotNull, assertNotNull, className, error
public FluentStringAssertion(String text, R returns)
text
- The text being tested.returns
- The object to return after the test.public FluentStringAssertion(Assertion creator, String text, R returns)
creator
- The assertion that created this assertion.text
- The text being tested.returns
- The object to return after the test.public FluentStringAssertion<R> javaStrings()
value.replaceAll(
public FluentStringAssertion<R> replaceAll(String regex, String replacement)
regex
- The regular expression to which this string is to be matched.replacement
- The string to be substituted for each match.public FluentStringAssertion<R> replace(String target, String replacement)
target
- The sequence of char values to be replaced.replacement
- The replacement sequence of char values.public FluentStringAssertion<R> urlDecode()
public FluentStringAssertion<R> sort()
public FluentStringAssertion<R> lc()
public FluentStringAssertion<R> uc()
public FluentStringAssertion<R> apply(Function<String,String> f)
f
- The function to apply.public R isEqual(String value) throws AssertionError
Similar to is(String)
except error message states diff position.
value
- The value to check against.
AssertionError
- If assertion failed.public R isEqualLines(String... lines) throws AssertionError
lines
- The value to check against.
AssertionError
- If assertion failed.public R isEqualSortedLines(String... lines)
lines
- The value to check against.
AssertionError
- If assertion failed.public R is(String value) throws AssertionError
Similar to isEqual(String)
except error message doesn't state diff position.
value
- The value to check against.
AssertionError
- If assertion failed.public R isEqualIc(String value) throws AssertionError
value
- The value to check against.AssertionError
- If assertion failed.public R doesNotEqual(String value) throws AssertionError
value
- The value to check against.AssertionError
- If assertion failed.public R isNot(String value) throws AssertionError
Equivalent to doesNotEqual(String)
.
value
- The value to check against.AssertionError
- If assertion failed.public R doesNotEqualIc(String value) throws AssertionError
value
- The value to check against.AssertionError
- If assertion failed.public R contains(String... values) throws AssertionError
values
- The values to check against.AssertionError
- If assertion failed.public R doesNotContain(String... values) throws AssertionError
values
- The values to check against.AssertionError
- If assertion failed.public R isEmpty() throws AssertionError
AssertionError
- If assertion failed.public R isNotEmpty() throws AssertionError
AssertionError
- If assertion failed.public R matches(String regex) throws AssertionError
regex
- The pattern to test for.AssertionError
- If assertion failed.public R matchesSimple(String searchPattern) throws AssertionError
The
searchPattern
- The search pattern.AssertionError
- If assertion failed.public R doesNotMatch(String regex) throws AssertionError
regex
- The pattern to test for.AssertionError
- If assertion failed.public R matches(String regex, int flags) throws AssertionError
regex
- The pattern to test for.flags
- Pattern match flags. See Pattern.compile(String, int)
.AssertionError
- If assertion failed.public R doesNotMatch(String regex, int flags) throws AssertionError
regex
- The pattern to test for.flags
- Pattern match flags. See Pattern.compile(String, int)
.AssertionError
- If assertion failed.public R matches(Pattern pattern) throws AssertionError
pattern
- The pattern to test for.AssertionError
- If assertion failed.public R doesNotMatch(Pattern pattern) throws AssertionError
pattern
- The pattern to test for.AssertionError
- If assertion failed.public R startsWith(String string)
string
- The string to test for.AssertionError
- If assertion failed.public R endsWith(String string)
string
- The string to test for.AssertionError
- If assertion failed.public FluentStringAssertion<R> msg(String msg, Object... args)
Assertion
String can contain
msg
in class FluentObjectAssertion<R>
msg
- The assertion failure message.args
- Optional message arguments.public FluentStringAssertion<R> stderr()
Assertion
stderr
in class FluentObjectAssertion<R>
public FluentStringAssertion<R> stdout()
Assertion
stdout
in class FluentObjectAssertion<R>
Copyright © 2016–2020 The Apache Software Foundation. All rights reserved.