EntityMatcher is a hamcrest custom matcher to test any model classes.
AssertModel<Model>
is mark interface to indicate the class is an AssertModel of Model
.
- create AssertModel class to assert {@code } class.
- implements
AsertModel<Model>
- add all fields of model class to assert to.
- assertModel's field type is same as model's field type or Matcher of model's field type.
- if field type is primitive, assertModel's field can determine as the boxing type.
- each field can assert by equals, compare, regex, or any matcher. set @AssertFields(rule=Rule.?).
- if field is null, assert null as a value. if skip assertion, set @AssertField(skipIfNull=true).