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 2026/02/28 12:24:00 UTC

[jira] [Closed] (SLING-13101) [Sling Models] Migrate Request, Resource, and PostConstruct Tests to JUnit 5

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

Stefan Seifert closed SLING-13101.
----------------------------------

> [Sling Models] Migrate Request, Resource, and PostConstruct Tests to JUnit 5 
> -----------------------------------------------------------------------------
>
>                 Key: SLING-13101
>                 URL: https://issues.apache.org/jira/browse/SLING-13101
>             Project: Sling
>          Issue Type: Improvement
>          Components: Sling Models, Testing
>            Reporter: Bhavik Kothari
>            Assignee: Stefan Seifert
>            Priority: Major
>              Labels: junit5, models
>             Fix For: Models Implementation 2.0.2
>
>
> Continuing the JUnit 5 migration for the `org.apache.sling.models.impl` package. 
> This task covers 12 test classes starting with the letters *P through R*
> Files to migrate:
>  - ParameterizedTypeFromRequestAttributeTest
>  - PostConstructTest
>  - ReflectionUtilTest
>  - RequestDisposalTest
>  - RequestInjectionTest
>  - RequestWrapperTest
>  - ResourceModelClassesTest
>  - ResourceModelConstructorTest
>  - ResourceModelInterfacesTest
>  - ResourceOverridingJakartaRequestWrapperTest
>  - ResourceOverridingRequestWrapperTest
>  - ResourcePathInjectionTest
> Key changes:
>  - Replacing `MockitoJUnitRunner` with `@ExtendWith(MockitoExtension.class)`
>  - Updating all imports to `org.junit.jupiter.api`
>  - Applying `lenient()` strictness to shared setup method to preserve legacy test behavior and prevent `UnnecessaryStubbingException` without altering the original test logic
>  - using JUnit 5's {{assertThrows}} instead of the JUnit4's {{@Test(expected)}} attribute
>  - Removing redundant Throws
>  - Correcting Assertion Argument Order
>  - Adding missing assertion statements
>  - new Integer() to Integer.valueOf()
>  - RandomStringUtils.randomAlphabetic(10) to RandomStringUtils.secureStrong().nextAlphabetic(10);



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