FAQ entry: Why we don't support multiple chained calls to assertion methods on the same Subject
- Dominant language
- Java
- Stars
- 2.8k
- Forks
- 275
- Avg merge
- 7m
- Merged PRs (30d)
- 4
Description
Hi
I have the following assertions:
```
String str = ...;
assertWithMessage(errorMessage)
.that(str)
.startsWith("some prefix");
assertWithMessage(errorMessage)
.that(str)
.contains("some content");
assertWithMessage(errorMessage)
.that(str)
.endsWith("some suffix");
```
As you can see I make several assertions over one `str` object
It would be easier to understand if all assertions were combined together like:
```
assertWithMessage(errorMessage)
.that(str)
.startsWith("some prefix")
.contains("some content")
.endsWith("some suffix");
```
I know there are several ways how to overcome it (assign `assertWithMessage(errorMessage).that(str)` to variable and call assertions for it or by using regular expressions), but sequential invocation of assert methods over one object seems more natural to me
--------
Please guide me, if such functionality already exists
Contributor guide
Assessment
This issue has not been assessed yet.