Skip to content

Improve generics on some collection matchers. #29

Open
fbarber wants to merge 1 commit intohamcrest:masterfrom
fbarber:master
Open

Improve generics on some collection matchers. #29
fbarber wants to merge 1 commit intohamcrest:masterfrom
fbarber:master

Conversation

@fbarber
Copy link
Copy Markdown

@fbarber fbarber commented Feb 22, 2013

The following classes are no longer parameterized as they don't care what is in
the collection they match:

  • IsCollectionWithSize
  • IsIterableWithSize
  • IsMapWithSize
  • IsEmptyCollection
  • IsEmptyIterable

@npryce npryce added this to the 2.1.0.0 milestone Dec 28, 2014
@sf105
Copy link
Copy Markdown
Member

sf105 commented Dec 30, 2014

I think this will be superseded by our plans for collection-specific factory methods

@guw
Copy link
Copy Markdown

guw commented Mar 6, 2020

@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>)

@nhojpatrick
Copy link
Copy Markdown
Member

@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.

The following classes are no longer parameterized as they don't care what is in
the collection they match:
- IsArrayWithSize
- IsCollectionWithSize
- IsIterableWithSize
- IsMapWithSize
- IsEmptyCollection
- IsEmptyIterable
@fbarber
Copy link
Copy Markdown
Author

fbarber commented Jul 3, 2020

Sure. I will update with a rebased version soon.

@fbarber
Copy link
Copy Markdown
Author

fbarber commented Jul 7, 2020

@nhojpatrick Rebase done.

@nhojpatrick
Copy link
Copy Markdown
Member

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.

@nhojpatrick nhojpatrick force-pushed the master branch 2 times, most recently from 9bc653b to e9f7fc8 Compare February 13, 2022 17:06
@tumbarumba tumbarumba modified the milestones: 2.1.0.0, 2.3 Dec 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

No open projects
Status: High priority

Development

Successfully merging this pull request may close these issues.

6 participants