You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The FieldMatcher, which is supposed to work like hasField(String fieldName, Matcher<?> valueMatcher) when comparing field values, is unable to do the comparing if the field is private: it internally gets an exception like java.lang.IllegalAccessException: Class com.nitorcreations.matchers.FieldMatcher can not access a member of class foo.bar.Baz with modifiers "private".
The FieldMatcher is able to find the private fields and assert their existence just fine when used without the value matcher. However, I need to assert the value too. Alternatively, I would need a way to assert the return value of the getter of the private field.
My use case is that I've got a collection of entities where only two fields are interesting and the rest should be ignored:
The
FieldMatcher
, which is supposed to work likehasField(String fieldName, Matcher<?> valueMatcher)
when comparing field values, is unable to do the comparing if the field is private: it internally gets an exception likejava.lang.IllegalAccessException: Class com.nitorcreations.matchers.FieldMatcher can not access a member of class foo.bar.Baz with modifiers "private"
.The
FieldMatcher
is able to find the private fields and assert their existence just fine when used without the value matcher. However, I need to assert the value too. Alternatively, I would need a way to assert the return value of the getter of the private field.My use case is that I've got a collection of entities where only two fields are interesting and the rest should be ignored:
The text was updated successfully, but these errors were encountered: