[ 
https://issues.apache.org/jira/browse/SLING-13088?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18056355#comment-18056355
 ] 

Bhavik Kothari commented on SLING-13088:
----------------------------------------

While running the build for this PR, I encountered check failures in the ViaIT 
integration tests (specifically Model is null errors):

{code}
[ERROR] org.apache.sling.models.it.testing.ViaIT.test -- Time elapsed: 0.461 s 
<<< FAILURE!
java.lang.AssertionError: Model is null
{code}


Suspecting that the test runtime lacked the new Jakarta JSON bundles, I added 
them to the it-launcher.json provisioning list. This successfully resolved the 
errors in ViaIT and stabilized the build.

> [Sling Models] Migrate ModelAdapterFactory, Ordering, and OSGi tests to JUnit 
> 5
> -------------------------------------------------------------------------------
>
>                 Key: SLING-13088
>                 URL: https://issues.apache.org/jira/browse/SLING-13088
>             Project: Sling
>          Issue Type: Improvement
>          Components: Sling Models
>            Reporter: Bhavik Kothari
>            Priority: Major
>              Labels: junit5, models, test
>
> Continuing the JUnit 5 migration (following SLING-13072).
> This task covers the third batch of the root `org.apache.sling.models.impl` 
> package (files starting M-O).
> Files migrated:
> - ModelAdapterFactory_ImplementationPickerOrderTest
> - ModelAdapterFactory_InjectorOrderTest
> - ModelAdapterFactoryTest
> - ModelPackageBundleListenerTest
> - MultipleInjectorTest
> - OSGiInjectionTest
> - OptionalObjectsTest
> - OptionalPrimitivesTest
> 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
> - Correcting Assertion Argument Order
>  -  Adding {{{}<?>{}}}: Change Type variable to {{Type<?>}} variable
>  -  If {{when(...).thenReturn(...)}} fails with a type error, changing it to 
> {{doReturn(...).when(...).method()}}
> - renaming the local log variable to logger to avoid shadowing the class 
> field.
> - Removing unnecessary eq() usage
> - Removing redundant Throws
> - Cleaning SuppressWarnings and resolved sonar issues with doReturn changes
> - Adding JUnit 5 OSGi dependency and migrating implementation picker & 
> Injector orde test.



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

Reply via email to