i've always wanted to define the hamcrest matchers configuration in a clean
java style instead of the (refactoring-unsafe!) XML file. so i came up with the
following solution (see patch):
**
class SampleHamcrestConfiguration implements HamcrestConfiguration {
public static void main(String[] args) {
new JavaGeneratorBuilder()
.addConfigurations(new SampleHamcrestConfiguration())
.targetClass("com.foobar.SampleMatchers")
.build()
.generate();
}
public Collection<Class<?>> matchers() {
Collection<Class<?>> matcher = new LinkedList<Class<?>>();
matcher.add(MyMatcher.class);
return matcher;
}
}
**
what do you guys think? next step would be to allow a package scan, so new
custom matchers will be picked up automatically ;)
~christoph
Original issue reported on code.google.com by christop...@gmail.com on 6 Apr 2014 at 2:30
Original issue reported on code.google.com by
christop...@gmail.com
on 6 Apr 2014 at 2:30Attachments: