public interface CustomisableMatcher<T>
extends org.hamcrest.Matcher<T>
Matcher implementation where fields and object types can be skipped from the comparison, or matched with
custom matchers.| Modifier and Type | Method and Description |
|---|---|
CustomisableMatcher<T> |
ignoring(Class<?> clazz)
Specify the object type of the fields to be skipped from the matcher comparison.
|
CustomisableMatcher<T> |
ignoring(org.hamcrest.Matcher<String> fieldNamePattern)
Specify the pattern of field names to ignore.
|
CustomisableMatcher<T> |
ignoring(String fieldPath)
Specify the path of the field to be skipped from the matcher comparison.
|
<V> CustomisableMatcher<T> |
with(String fieldPath,
org.hamcrest.Matcher<V> matcher)
Specify the path of the field to be matched with a specific matcher.
|
CustomisableMatcher<T> ignoring(String fieldPath)
sameBeanAs(expected).ignoring("beanField.subBeanField")fieldPath - the path of the field to be skipped from the comparison.CustomisableMatcher<T> ignoring(Class<?> clazz)
sameBeanAs(expected).ignoring(Bean.class)
clazz - the object type to be skipped from the comparison.<V> CustomisableMatcher<T> with(String fieldPath, org.hamcrest.Matcher<V> matcher)
sameBeanAs(expected).with("beanField.subBeanField", contains("element"))fieldPath - the path of the field to be matched with the provided matcher.matcher - the Hamcrest matcher used to match the specified field.CustomisableMatcher<T> ignoring(org.hamcrest.Matcher<String> fieldNamePattern)
assertThat(myBean, sameBeanAs(myResultBean).ignoring(is("mutationdate")).ignoring(containsString("version")))pattern - the Hamcrest matcher used to match field names.Copyright © 2015. All Rights Reserved.