npathai / hamcrest-optional

Matchers for JDK 8 Optional
MIT License
42 stars 3 forks source link

rename hasValue to isPresentAnd/isPresentAndIs #26

Closed sweiler closed 7 years ago

sweiler commented 7 years ago

Avoid naming conflicts with Hamcrest's hasValue Resolves issue #24, but chose different names to allow for fluent method chains like:

Optional<String> optionalName = Optional.of("some name");
assertThat(optionalName, isPresentAnd(startsWith("some")));
coveralls commented 7 years ago

Coverage Status

Coverage remained the same at 93.548% when pulling 047afbc2b643a96ec19d816909bc53d1b588c981 on sweiler:pullreq into 27b9995dde2505d7637708f9176eb37e5d1c9205 on npathai:master.

npathai commented 7 years ago

@sweiler I appologize for late reply. I really like the names and I will incorporate them as a replacement for current methods. I am wondering if I should bump up the version number (breaking changes) and release it or just deprecate the previous methods and incorporate these methods as replacement for previous methods. Any suggestions?

sweiler commented 7 years ago

No worries @npathai :) I would prefer the option to deprecate the old method names and then a 1.1 release. (or 1.0.1 if you like that more) That way people can gradually migrate to the new version.