Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(test): replace deprecated mockito api verifyZeroInteractions() with verifyNoMoreInteractions() during upgrade to spring boot 2.6.x #4622

Merged
merged 2 commits into from
Dec 23, 2023

Conversation

j-sandy
Copy link
Contributor

@j-sandy j-sandy commented Dec 22, 2023

While upgrading spring boot 2.6.15, encounter similar errors as given below in multiple module of orca (keiko-core, keiko-tck, orca-clouddriver, orca-queue) during test compilation:

com.netflix.spinnaker.q.sql.SqlQueueTest > describe polling the queue > given there are no messages > com.netflix.spinnaker.q.sql.SqlQueueTest.it does not invoke the callback FAILED
    java.lang.NoSuchMethodError: 'void org.mockito.Mockito.verifyZeroInteractions(java.lang.Object[])'
        at com.nhaarman.mockito_kotlin.MockitoKt.verifyZeroInteractions(Mockito.kt:259)
        at com.netflix.spinnaker.q.QueueTest$1$1$1$5.invoke(QueueTest.kt:75)
        at com.netflix.spinnaker.q.QueueTest$1$1$1$5.invoke(QueueTest.kt:74)

Spring boot 2.6.15 brings mockito 4.0.0 as transitive dependency. The verifyZeroInteractions() was deprecated in 3.x as mentioned here: mockito/mockito-kotlin#383 And now it is removed from mockito 4.0.0. To fix these issues, replacing verifyZeroInteractions() with verifyNoMoreInteractions().

…() with verifyNoMoreInteractions() during upgrade to spring boot 2.6.x

While upgrading spring boot 2.6.15, encounter similar errors as given below in multiple module of orca (keiko-core, keiko-tck, orca-clouddriver, orca-queue) during test compilation:
```
com.netflix.spinnaker.q.sql.SqlQueueTest > describe polling the queue > given there are no messages > com.netflix.spinnaker.q.sql.SqlQueueTest.it does not invoke the callback FAILED
    java.lang.NoSuchMethodError: 'void org.mockito.Mockito.verifyZeroInteractions(java.lang.Object[])'
        at com.nhaarman.mockito_kotlin.MockitoKt.verifyZeroInteractions(Mockito.kt:259)
        at com.netflix.spinnaker.q.QueueTest$1$1$1$5.invoke(QueueTest.kt:75)
        at com.netflix.spinnaker.q.QueueTest$1$1$1$5.invoke(QueueTest.kt:74)
```
Spring boot [2.6.15](https://repo1.maven.org/maven2/org/springframework/boot/spring-boot-dependencies/2.6.15/spring-boot-dependencies-2.6.15.pom) brings mockito 4.0.0 as transitive dependency. The `verifyZeroInteractions()` was deprecated in 3.x as mentioned here:
mockito/mockito-kotlin#383
And now it is removed from mockito [4.0.0](https://github.com/mockito/mockito/releases/tag/v4.0.0).
To fix these issues, replacing `verifyZeroInteractions()` with `verifyNoMoreInteractions()`.
@dbyron-sf dbyron-sf added the ready to merge Approved and ready for merge label Dec 23, 2023
@mergify mergify bot added the auto merged Merged automatically by a bot label Dec 23, 2023
@mergify mergify bot merged commit d382b38 into spinnaker:master Dec 23, 2023
4 checks passed
@j-sandy j-sandy deleted the mockito-dep branch December 27, 2023 14:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto merged Merged automatically by a bot ready to merge Approved and ready for merge target-release/1.34
Projects
None yet
3 participants