You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Stefan Seifert (Jira)" <ji...@apache.org> on 2022/09/02 11:17:00 UTC

[jira] [Closed] (SLING-10937) Resource in tested Sling Model not equal to Resource it was adapted from (RESOURCERESOLVER_MOCK)

     [ https://issues.apache.org/jira/browse/SLING-10937?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Stefan Seifert closed SLING-10937.
----------------------------------

> Resource in tested Sling Model not equal to Resource it was adapted from (RESOURCERESOLVER_MOCK)
> ------------------------------------------------------------------------------------------------
>
>                 Key: SLING-10937
>                 URL: https://issues.apache.org/jira/browse/SLING-10937
>             Project: Sling
>          Issue Type: Bug
>          Components: Testing
>    Affects Versions: Testing Sling Mock 3.1.2
>            Reporter: Konrad Windszus
>            Assignee: Stefan Seifert
>            Priority: Major
>             Fix For: Testing Sling Mock 3.4.0
>
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> 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.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)