You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Henry Kuijpers (Jira)" <ji...@apache.org> on 2022/04/05 12:28:00 UTC
[jira] [Created] (SLING-11252) RRMockResourceResolverWrapper supports no way of mocking searches
Henry Kuijpers created SLING-11252:
--------------------------------------
Summary: RRMockResourceResolverWrapper supports no way of mocking searches
Key: SLING-11252
URL: https://issues.apache.org/jira/browse/SLING-11252
Project: Sling
Issue Type: Bug
Components: Testing
Affects Versions: Testing Sling Mock 3.2.2
Reporter: Henry Kuijpers
Previously, it was possible to call ((MockResourceResolver)context.resourceResolver()).addFindResourceHandler(...)
Currently, we have to add a "find resource handler" this way:
{code:java}
final Field wrappedField = ResourceResolverWrapper.class.getDeclaredField("wrapped");
wrappedField.setAccessible(true);
((MockResourceResolver) wrappedField.get(context.resourceResolver())).addFindResourceHandler((s, s1) -> {
assertEquals(ContentProfileResourceProvider.CONTENT_PROFILES_SIMPLE_SEARCH, s);
assertEquals("search", s1);
return contentResource.listChildren();
});
{code}
This wrapping seems to have been added in: https://github.com/apache/sling-org-apache-sling-testing-sling-mock/commit/a6d01ff058d422ff544c2a137b42291bd550f603
We could add logic that consults the ResourceProviders to see if they can execute the custom search that we'd like to do, or, we could add the methods also on RRMockResourceResolverWrapper.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)