public Resource getResource()

in src/main/java/org/apache/sling/testing/resourceresolver/MockResourceResolver.java [154:173]


    public Resource getResource(final @NotNull String path) {
        Resource resource = getResourceInternal(path);

        // if not resource found check if this is a reference to a property
        if (resource == null && path != null) {
            String parentPath = ResourceUtil.getParent(path);
            if (parentPath != null) {
                String name = ResourceUtil.getName(path);
                Resource parentResource = getResourceInternal(parentPath);
                if (parentResource!=null) {
                    ValueMap props = ResourceUtil.getValueMap(parentResource);
                    if (props.containsKey(name)) {
                        return new MockPropertyResource(path, props, this);
                    }
                }
            }
        }

        return resource;
    }