We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Related to #16
Example:
import org.junit.jupiter.api.Test; import java.util.Arrays; import java.util.List; import static com.shazam.shazamcrest.MatcherAssert.assertThat; import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; import static org.hamcrest.CoreMatchers.equalTo; public class CustomMatcherWithCyclicDepsTest { class MyClass { private List<MyClass> myClasses; private String name; MyClass(String name) { this.name = name; } void setMyClasses(List<MyClass> myClasses) { this.myClasses = myClasses; } } @Test void testCustomMatching_inParent() { MyClass expectedChild = new MyClass("child"); MyClass expected = new MyClass("name-matched-by-custom"); expected.setMyClasses(Arrays.asList(expected, expectedChild)); MyClass actualChild = new MyClass("child"); MyClass actual = new MyClass("parent"); actual.setMyClasses(Arrays.asList(actual, actualChild)); assertThat(actual, sameBeanAs(expected) .with("name", equalTo("parent")) // Test only passes with this .ignoring("0x1.name")); } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Related to #16
Custom matching in an object with cyclic references requires ignoring the custom-matched field, otherwise it will fail.
Example:
The text was updated successfully, but these errors were encountered: