Posted by mkarg
on September 1, 2012 at 1:31 AM PDT
hamcrest-reflection provides fluent assertions for reflection-based assertions. I uploaded it to Maven Central this week, so using it got even simpler now.
It eventually happened that I had to ensure that a class of mine is annotated in a particular way (I didn't want to bind the whole framework that uses the annotation just to ensure this single issue, as this was a unit test but not an integration test). So I wrote my own Hamcrest matcher with few pieces of reflection inside. Short time later I noticed that Hamcrest co-owner Nat PRYCE already did the same and published his stuff on Google Code in a rather disregarded project named hamcrest-reflection, so I decided to get rid of my own hack and use his library instead. Unfortunately it was not found in Maven Central so far, so there was a good opportunity to give back a micro-contribution to the Open Source Community: I contributed a POM and uploaded the library to oss.sonatype.org , so few minutes later it was sync'ed to Maven Central . Now everybody can easily replace his own stuff (like I did) by a rather well-tested common piece of open source, simply by adding the following dependency to his own POM:
This is a simple example how open source helps to reduce the amount of own code (and in turn reduces the amount of possible bugs), and how easy it is to contribute to open source (everybody can write a POM for a library and upload
it to oss.sonatype.org).
Support Maven Central: Adopt an open source project and upload the artifacts to oss.sonatype.org!
A collection of all my publications can be found on my personal web site Head Crashing Informatics