Resource resource = resourceResolver.getResource(nodePath);
if (resource!=null) {
ValueMap props = resource.adaptTo(ValueMap.class);
Object value = props.get(propertyName);
if (value==null) {
throw new PathNotFoundException();
}
Property prop = mock(Property.class);
when(prop.getName()).thenReturn(propertyName);
if (value instanceof String) {
when(prop.getString()).thenReturn((String)value);
}
else if (value instanceof Boolean) {
when(prop.getBoolean()).thenReturn((Boolean)value);
}
return prop;
}
else {
throw new PathNotFoundException();
}
}
});
}
catch (RepositoryException ex) {