Bhavik Kothari created SLING-13072:
--------------------------------------
Summary: [Sling Models] Migrate defaults and inheritance root
tests to JUnit 5
Key: SLING-13072
URL: https://issues.apache.org/jira/browse/SLING-13072
Project: Sling
Issue Type: Improvement
Components: Sling Models
Reporter: Bhavik Kothari
Continuing the JUnit 5 migration (following SLING-13066).
This task covers the second batch of the root `org.apache.sling.models.impl`
package (files starting D-I).
Files:
- DefaultInterfaceMethodTest
- DefaultTest
- ExtraDefaultTests
- ImplementsExtendsTest
- InjectorSpecificAnnotationTest
- InterfaceInheritanceTest
- InvalidAdaptationsTest
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
- Spliting the large method to multiple method to reduce assertion count per
method
- Adding {{{}<?>{}}}: Change Type variable to {{Type<?>}} variable
- Switching to {{doReturn}} : If {{when(...).thenReturn(...)}} fails with a
type error, changing it to {{doReturn(...).when(...).method()}}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)