protected boolean matchesSafely()

in src/main/java/org/apache/sling/hamcrest/matchers/ResourcePropertiesMatcher.java [48:66]


    protected boolean matchesSafely(Resource item) {
        ValueMap givenProps = item.adaptTo(ValueMap.class);
        for (Map.Entry<String, Object> prop : expectedProps.entrySet()) {
            Object givenValue = givenProps.get(prop.getKey());
            Object expectedValue = prop.getValue();
            if (givenValue != null && expectedValue != null
                    && givenValue.getClass().isArray() && expectedValue.getClass().isArray()) {
                if (!arrayEquals(expectedValue, givenValue)) {
                    return false;
                }
            }
            else {
                if (!objectEquals(expectedValue, givenValue)) {
                    return false;
                }
            }
        }
        return true;
    }