[
https://issues.apache.org/jira/browse/SLING-10003?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17264170#comment-17264170
]
Stefan Seifert commented on SLING-10003:
----------------------------------------
ah, understood. so you would need a feature to provided mocked search result
interdependently of an already opened resource resolver/session as it might by
opened in the production code you are testing. this problem applies to both
jcr-mock and this new feature in resourceresolver-mock.
would make sense to create a new ticket for it, and to clarify for which
resource resolver types of sling-mock it's relevant (jcr-mock,
resourceresolver-mock)
> Allow to mock findResources in MockResourceResolver
> ---------------------------------------------------
>
> Key: SLING-10003
> URL: https://issues.apache.org/jira/browse/SLING-10003
> Project: Sling
> Issue Type: Improvement
> Components: Testing
> Reporter: Konrad Windszus
> Assignee: Stefan Seifert
> Priority: Major
> Fix For: Testing ResourceResolver Mock 1.2.0
>
> Time Spent: 2h
> Remaining Estimate: 0h
>
> Currently there is no easy way to override the method
> [MockResourceResolver.findResources().|https://github.com/apache/sling-org-apache-sling-testing-resourceresolver-mock/blob/6ef6bd69ce1679b06d6b4d52b1b170dce51d102c/src/main/java/org/apache/sling/testing/resourceresolver/MockResourceResolver.java#L455]
> There should be a way to override that without relying on other mock
> frameworks like Mockito.
> One way could be to add a static method
> {{MockResourceResolver.registerFindResourcesFunction(ResourceResolver
> resolver, BiFunction<String, String, Iterator<Resource>
> findResourcesFunction)}} which allows to easily override the default
> implementation (which always throws an UnsupportedOperationException) for the
> given resolver (in case this is a MockResourceResolver). The registration
> should only affect the given resource resolver as usually there is different
> functions necessary per test method.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)