Konrad Windszus created SLING-10003:
---------------------------------------
Summary: 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
Affects Versions: Testing ResourceResolver Mock 1.1.28
Reporter: Konrad Windszus
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)