forked from hamcrest/JavaHamcrest
-
Notifications
You must be signed in to change notification settings - Fork 0
Test Readability
Narendra Pathai edited this page Jul 1, 2018
·
2 revisions
Hamcrest strives to make your tests as readable as possible. For example, the is matcher is a wrapper that doesn't add any extra behavior to the underlying matcher. The following assertions are all equivalent
assertThat(theBiscuit, equalTo(myBiscuit));
assertThat(theBiscuit, is(equalTo(myBiscuit)));
assertThat(theBiscuit, is(myBiscuit));
The last form is allowed since is(T value)
is overloaded to return is(equalTo(value))
.
- Introduction
- Framework Compatibility
- Getting Started
- Matchers
- Core
- Logical
- Object
- Beans
- Collections
- Number
- Text
- Test Readability with "Sugar"
- Writing Custom Matchers
- Sugar Generation
- Third Party Extensions
- Further Resources