Git Product home page Git Product logo

javahamcrest's People

Contributors

alb-i986 avatar andremoniy avatar arend-von-reinersdorff avatar bodiam avatar buckett avatar dgroup avatar ghostd avatar hochraldo avatar josephw avatar kay avatar kerrykimbrough avatar markslater avatar michalfotyga avatar mle-enso avatar mle-idealo avatar nhojpatrick avatar nick-rivera-meredith avatar npathai avatar npryce avatar perlun avatar phoenix384 avatar plow avatar redcatbear avatar ris58h avatar rjmunro avatar scarytom avatar sf105 avatar tsundberg avatar tumbarumba avatar vicziani avatar

Watchers

 avatar

javahamcrest's Issues

Is matcher has wrong default equalTo semantics

"Is" is about object identity, corresponding to the == Java operator.
"Is equal to" is about object equality, corresponding to the equalTo method.
Hamcrest 2.x gets these semantics wrong because it defaults the Is matcher to the semantics of equalTo.
To fix this, is should default to sameInstance instead of equalTo.

This would be a breaking change, not in the compile-time sense of the work, but in the semantical sense.
Something for Hamcrest 3.x.

Remove Matcher._dont_implement_Matcher___instead_extend_BaseMatcher_

The design of the Matcher API is not ideal:

  • On the one hand, the Matcher interface is a prominent member of the API, and intuitively, users would implement it. But apparently that is not the intent. Code smell: Matcher._dont_implement_Matcher___instead_extend_BaseMatcher_.
  • So users are supposed to extend BaseMatcher or a subclass thereof instead. What does it add? A toStringand describeMismatchimplementation, but neither are final so subclasses can override them - which would make them eligible to implement Matcher directly, but then they're not supposed to do that. It makes no sense - why have a Matcher interface then in the first place? The impression I get is that someone thought that "an interface looks better on the API than an abstract class".

The solution is to consolidate both in one abstract class.
Or, alternatively, an interface with default methods.

Update to the latest gradle (7.x)

Now that Java source compatibility has been updated to 1.8 (on this fork), we are no longer restricted to Gradle 4.x, and we can finally update Gradle (and Checkstyle).

Have a default implementation for all Matcher methods besides matches(Object)

Whenever one implements Matcher, one has to implement at least two methods: matches(Object) and describeTo(Description description). It would be vastly more intuitive if there was a default implementation for the latter. Then one could implement a Matcher using a lambda. And usually, it's hard to come up with a good implementation of describeToanyway.

Rename MatcherAssert to MatcherAssertions

Currently, Hamcrest's assertThat family of methods is defined on MatcherAssert.
It would be better to rename this to MatcherAssertions, to align with JUnit 5's Assertions which defines the assert family of methods.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.