Difference between hamcrest-library Matchers and hamcrest-core CoreMatchers

后端 未结 3 753
天涯浪人
天涯浪人 2021-02-04 22:55

It looks like the hamcrest org.hamcrest.Matchers class is very similar to org.hamcrest.CoreMatchers (though it looks like Matchers has mor

3条回答
  •  无人共我
    2021-02-04 23:30

    If you use Android's JUnit tests (not connected tests), the CoreMatchers seem to be available inside the already-included junit module, while the Matchers are not.

    Thus, to save overhead, and to avoid importing another library, consider using the CoreMatcher versions of these classes if they suffice:

    assertThat(chrome.twiddle(), is(equalTo(0)));
    

    is possible using only CoreMatchers.

提交回复
热议问题