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

Resource in tested Sling Model not equal to Resource it was adapted from (RESOURCERESOLVER_MOCK)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • Testing Sling Mock 3.1.2
    • Testing Sling Mock 3.4.0
    • Testing
    • None

    Description

      The resources returned from org.apache.sling.testing.mock.sling.RRMockResourceResolverWrapper are of type ResourceResolverResourceWrapper (in case the resource providers are empty).

      When these resources are adapted to a Sling Model, the injected resource is the unwrapped resource which is not equal to the wrapped resource from outside.
      This is due to the fact that ResourceResolverResourceWrapper.adaptTo(...) is not overwritten but just delegated to the underlying Resource. That makes the Adapter only acting on the unwrapped resource which is not equal to the wrapped one.

      This leads to unexpected behaviour when verifying interactions with mocks taking the resource as argument, as the wrapped resource is never equal to the resource used in the Sling Model given to the mock.

      Attachments

        Issue Links

          Activity

            People

              sseifert Stefan Seifert
              kwin Konrad Windszus
              Votes:
              0 Vote for this issue
              Watchers:
              2 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 - 0.5h
                  0.5h