JavaHamcrest
JavaHamcrest copied to clipboard
Improve generics on some collection matchers.
The following classes are no longer parameterized as they don't care what is in the collection they match:
- IsCollectionWithSize
- IsIterableWithSize
- IsMapWithSize
- IsEmptyCollection
- IsEmptyIterable
I think this will be superseded by our plans for collection-specific factory methods
@sf105 Are those methods available already?
I'm running into generics compilation errors with the JDT 3.20 compiler for the following code:
List<String> result = ...
assertThat(result, allOf(hasSize(1), hasItems("foo")));
The error is: The method allOf(Matcher<? super T>, Matcher<? super T>) in the type Matchers is not applicable for the arguments (Matcher<Collection<? extends Object>>, Matcher<Iterable<String>>)
@fbarber fancy rebasing this from master, as hamcrest-core and hamcrest-library have been refactored a lot and also deprecated, so that everything is just in hamcrest.
I've got some custom collections matchers, which do similar and would be interested getting richer collection matches into hamcrest. i.e. if the collection is the wrong size then output the collection, so when debugging you can shortcut having to run it yourself and get a start on working out the issue.
Sure. I will update with a rebased version soon.
@nhojpatrick Rebase done.
Going to try and kick start hamcrest, so if you want to get it merged, please rebase from the branch v2.3-candidates.
Still trying to understand how has permissions to perform a release.