You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Konrad Windszus (Jira)" <ji...@apache.org> on 2025/06/17 11:31:00 UTC
[jira] [Created] (SLING-12831) ResourceMatchers.resourceType("") does not properly check resource type
Konrad Windszus created SLING-12831:
---------------------------------------
Summary: ResourceMatchers.resourceType("") does not properly check resource type
Key: SLING-12831
URL: https://issues.apache.org/jira/browse/SLING-12831
Project: Sling
Issue Type: Bug
Components: Testing
Affects Versions: Testing Hamcrest 1.0.2
Reporter: Konrad Windszus
The implementation at https://github.com/apache/sling-org-apache-sling-testing-hamcrest/blob/4970c4c44c978a710d682109973659f4bd481ed2/src/main/java/org/apache/sling/hamcrest/ResourceMatchers.java#L121 just checks for a property with name {{sling:resourceType}} which is not the same as checking if a resource has a certain type. I would suggest to rather build a dedicated matcher based on https://sling.apache.org/apidocs/sling13/org/apache/sling/api/resource/ResourceResolver.html#isResourceType(org.apache.sling.api.resource.Resource,java.lang.String) (allowing inheritance) or https://sling.apache.org/apidocs/sling13/org/apache/sling/api/resource/Resource.html#getResourceType() (only direct match).
Compare with SLING-12781.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)