I want to run this line of code:
assertThat(contextPin.get(), equalTo(pinPage.getPinObjFromUi()));
but I want the magazine to be informative
means that I could know which fields are not equal.
So, I thought about implementing a match.
I have googled, but I could not write it correctly
since my method could not combine the actual and expected objects.
here is my code:
how can i write it clean?
public class PinMatcher extends TypeSafeMatcher<Pin> { private Pin actual; private Object item; public PinMatcher(Pin actual) { this.actual = actual; } @Override protected boolean matchesSafely(Pin item) { return false; } @Override public void describeTo(Description description) { }
java equals hamcrest matcher
Elad benda2
source share