Introduce MatcherMatcher, a hamcrest matcher for matchers#1
Introduce MatcherMatcher, a hamcrest matcher for matchers#1scarytom merged 0 commit intohamcrest:masterfrom
Conversation
|
Thanks Tom, I'll take a look. Is TG happy with any licensing issues? That said, this might be better in the hamcrest-java-extras I've started. Actually, do you think they'd be prepared to release some of the other generic matchers, like JSON? Also, you might want to look at the Condition stuff I've been introducing. I'm hoping it helps with compound matchers. Ta S. On 5 Apr 2012, at 11:19, Tom Denley wrote:
Steve Freeman Winner of the Agile Alliance Gordon Pask award 2006 +44 797 179 4105 |
|
I'm sure that TG will be fine with this contribution. We've recently started open sourcing our Matcher extensions here https://github.com/youdevise/Matchers -- and it can only be a win for us if we get things further upstream and into hamcrest itself. Our Matchers project is pretty sparse at the moment, but I would expect us to grow it to include most of our generic matchers (including the JSON ones) as we extract them from our various internal codebases. My hope is to cherry-pick the good bits from our Matchers project and re-package them for inclusion into hamcrest, tidying things up as I go -- and ensuring the tests are up to scratch -- then issuing pull requests for you. Let me know if you want me to adopt a different strategy, or if you need anything formal signed off to cover licensing. I imagine that anything too niche would better sit in hamcrest-java-extras, but I'd like to get MatcherMatcher a bit further up, so I can use it to tidy up some of the existing unit tests for the other matchers in hamcrest-library. I noticed that they are all JUnit3 at the moment -- would you be happy for me to start modernising them? I'm keen to give back to a project that has been so tremendously useful to me personally over the years. I'll have a look over the Condition stuff over the Easter weekend if I can, sounds interesting. Thanks, |
|
I'll take a look at your contributions. I'm not totally sure that matchermatcher belongs in the core, since it might be a bit too recursive ;) We still support junit 3, so it doesn't really matter if we use it for the tests. That said, maybe it is time to modernise. not sure. I'm off for a few days, ping you when i get back. S. On 5 Apr 2012, at 22:25, Tom Denley wrote:
Steve Freeman Winner of the Agile Alliance Gordon Pask award 2006 +44 797 179 4105 |
|
Roger that. Have a good break and we'll speak next week. Can always meet for a coffee if you want. |
Hi Steve, Tom Denley here.
Now that you have transitioned hamcrest onto github, I thought I'd try to contribute some of our work at youDevise back into hamcrest, starting with the MatcherMatcher. This is a hamcrest matcher for hamcrest matchers, which facilitates test-driven development of new matcher implementations.
The MatcherMatcher allows for three assertions to be made against a matcher implementation:
assertThat(myFooMatcher, is(aMatcherWithDescription(equalTo("a Foo"))));
assertThat(myFooMatcher, is(aMatcherThatMatches(new Foo())));
assertThat(myFooMatcher, is(aMatcherGivingAMismatchDesctiptionOf(new Bar(), equalTo("was a Bar"))));