[
https://issues.apache.org/jira/browse/SLING-10003?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Stefan Seifert closed SLING-10003.
----------------------------------
> 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)