[
https://issues.apache.org/jira/browse/SLING-10356?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17370204#comment-17370204
]
Stefan Seifert commented on SLING-10356:
----------------------------------------
i would recommend using Sling Mocks with ResourceResolver type JCR_MOCK - this
uses the "real" resource resolver with a mocked JCR repository.
the [Resource Resolver
Mock|https://github.com/apache/sling-org-apache-sling-testing-resourceresolver-mock]
implements only a subset which is fine for most unit tests, but not for all
scenarios.
> MockResourceResolver does not correctly resolve resources
> ---------------------------------------------------------
>
> Key: SLING-10356
> URL: https://issues.apache.org/jira/browse/SLING-10356
> Project: Sling
> Issue Type: Bug
> Components: Testing
> Reporter: Roy Teeuwen
> Priority: Major
>
> The mock resource resolver does not do the complete cycle of the resolving.
> For example I could have a file:
> /content/dam/my-file.jpg
> If I would now do
> resourceResolver.resolve("/content/dam/my-file.jpg.selector/my-suffix") I
> would expect to get /content/dam/my-file.jpg but it returns a non existing
> resource for path /content/dam/my-file.jpg.selector/my-suffix
> I see that this logic is done by the ResourcePathIterator in the
> ResourceResolverImpl:
> https://github.com/apache/sling-org-apache-sling-resourceresolver/blob/a19b2c2474ae0165e35bce94ecad5e3d23873549/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverImpl.java#L704
> What would be the recommended approach? Copy the internal
> ResourcePathIterator class to the mock testing library and implement the same
> logic?
--
This message was sent by Atlassian Jira
(v8.3.4#803005)