JavaHamcrest
JavaHamcrest copied to clipboard
Java (and original) version of Hamcrest
When I test maps I often need to apply a matcher for the value and check equality for the key. Currently there is no `hasEntry` matcher that would consume a...
The links for getting started and Javadocs, were going to a 404 error page. Updated them with correct hyper links. Thanks.
Discussion in issues like #295 suggest a desire for a consistent code style. This PR seeks to implement that. Enforced indentation style of 2 spaces (with further details matching Google's...
While working on #294 I noticed that `FeatureMatcher#featureValueOf` may throw. Right now, that may happen in: - HasToString, if the actual object has a custom toString method which throws -...
Resolving my own #174. I'm leaving the commits separate for easier reviewing, I'll squash them afterwards. Briefly, the solution introduces a base class (I called it `SizeMatcher`) for the matchers...
Implements the enhancement in hamcrest/JavaHamcrest#172 Instead of a linear search over all entries, this change leverages Map.containsKey(K key) to check that a map hasKey() or hasEntry().
Covers all 4 visibilities, and all reflective elements (classes, methods, fields, etc.) with reasonable messages when used incorrectly. These matchers are helpful, for example, when enforcing the scope of a...
Changed signature of method containsInAnyOrder to allow avoid calling toArray() method or casting to the array and build next construction List actual = Arrays.asList("a", "b", "c"); List expected = Arrays.asList("a",...
**Motivation** I needed to give detailed descriptions of an object in case of a mismatch and couldn't use toString(). **Solution** * Use the existing `SelfDescribing` Interface and retrieve a description...
The `IsCloseTo`/`closeTo` matcher should be able to check all numerical types are within the bounds set, rather than just doubles. The implementation already worked if a primitive value was cast...