Uploaded image for project: 'Sling'
  1. Sling
  2. SLING-10003

Allow to mock findResources in MockResourceResolver

    XMLWordPrintableJSON

Details

    Description

      Currently there is no easy way to override the method MockResourceResolver.findResources().

      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.

      Attachments

        Issue Links

          Activity

            People

              sseifert Stefan Seifert
              kwin Konrad Windszus
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 2h
                  2h