Assuming I have the following DTO
class Foo {
private Map<Integer, String> map = new LinkedHashMap<>();
public Map<Integer, String> getMap() {
return Collections.unmodifiableMap(map);
}
public void setMap(Map<Integer, String> map) {
this.map = map != null ? Collections.unmodifiableMap(map) : Collections.emptyMap();
}
}
The setters store an unmodifiable hash map and the getters return an unmodifiable copy of the map.
The method beanDoesNotHaveValidGetterAndSetterForProperty in AbstractBeanAccessorMatcher generates a Mockito Map and calls the setter of the class and then the getter.
The check testValue.equals(result) always evaluates to false.