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(core/test): replace deprecated mockito api verifyZeroInteractions() with verifyNoMoreInteractions() during upgrade to spring boot 2.6.x #1014

Merged
merged 2 commits into from
Jan 12, 2024

Conversation

j-sandy
Copy link
Contributor

@j-sandy j-sandy commented Jan 12, 2024

While upgrading spring boot 2.6.15 and spring cloud 2021.0.8, encounter errors in kayenta-core module during test compilation:

> Task :kayenta-core:compileTestGroovy
/kayenta/kayenta-core/src/test/groovy/com/netflix/kayenta/metrics/SynchronousQueryProcessorTest.java:29: error: cannot find symbol
import static org.mockito.Mockito.verifyZeroInteractions;
^
  symbol:   static verifyZeroInteractions
  location: class Mockito
/kayenta/kayenta-core/src/test/groovy/com/netflix/kayenta/metrics/SynchronousQueryProcessorTest.java:121: error: cannot find symbol
    verifyZeroInteractions(storageService);
    ^
  symbol:   method verifyZeroInteractions(StorageService)
  location: class SynchronousQueryProcessorTest
/kayenta/kayenta-core/src/test/groovy/com/netflix/kayenta/metrics/SynchronousQueryProcessorTest.java:201: error: cannot find symbol
    verifyZeroInteractions(storageService);
    ^
  symbol:   method verifyZeroInteractions(StorageService)
  location: class SynchronousQueryProcessorTest
/kayenta/kayenta-core/src/test/groovy/com/netflix/kayenta/metrics/SynchronousQueryProcessorTest.java:229: error: cannot find symbol
    verifyZeroInteractions(storageService);
    ^
  symbol:   method verifyZeroInteractions(StorageService)
  location: class SynchronousQueryProcessorTest
/kayenta/kayenta-core/src/test/groovy/com/netflix/kayenta/metrics/SynchronousQueryProcessorTest.java:259: error: cannot find symbol
    verifyZeroInteractions(storageService);
    ^
  symbol:   method verifyZeroInteractions(StorageService)
  location: class SynchronousQueryProcessorTest
Note: /kayenta/kayenta-core/src/test/groovy/com/netflix/kayenta/metrics/SynchronousQueryProcessorTest.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
5 errors
startup failed:
Compilation failed; see the compiler error output for details.
1 error
> Task :kayenta-core:compileTestGroovy FAILED

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()

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

While upgrading spring boot 2.6.15 and spring cloud 2021.0.8, encounter errors in kayenta-core module during test compilation:
```
> Task :kayenta-core:compileTestGroovy
/kayenta/kayenta-core/src/test/groovy/com/netflix/kayenta/metrics/SynchronousQueryProcessorTest.java:29: error: cannot find symbol
import static org.mockito.Mockito.verifyZeroInteractions;
^
  symbol:   static verifyZeroInteractions
  location: class Mockito
/kayenta/kayenta-core/src/test/groovy/com/netflix/kayenta/metrics/SynchronousQueryProcessorTest.java:121: error: cannot find symbol
    verifyZeroInteractions(storageService);
    ^
  symbol:   method verifyZeroInteractions(StorageService)
  location: class SynchronousQueryProcessorTest
/kayenta/kayenta-core/src/test/groovy/com/netflix/kayenta/metrics/SynchronousQueryProcessorTest.java:201: error: cannot find symbol
    verifyZeroInteractions(storageService);
    ^
  symbol:   method verifyZeroInteractions(StorageService)
  location: class SynchronousQueryProcessorTest
/kayenta/kayenta-core/src/test/groovy/com/netflix/kayenta/metrics/SynchronousQueryProcessorTest.java:229: error: cannot find symbol
    verifyZeroInteractions(storageService);
    ^
  symbol:   method verifyZeroInteractions(StorageService)
  location: class SynchronousQueryProcessorTest
/kayenta/kayenta-core/src/test/groovy/com/netflix/kayenta/metrics/SynchronousQueryProcessorTest.java:259: error: cannot find symbol
    verifyZeroInteractions(storageService);
    ^
  symbol:   method verifyZeroInteractions(StorageService)
  location: class SynchronousQueryProcessorTest
Note: /kayenta/kayenta-core/src/test/groovy/com/netflix/kayenta/metrics/SynchronousQueryProcessorTest.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
5 errors
startup failed:
Compilation failed; see the compiler error output for details.
1 error
> Task :kayenta-core:compileTestGroovy FAILED
```
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 Reviewed and ready for merge label Jan 12, 2024
@mergify mergify bot added the auto merged label Jan 12, 2024
@mergify mergify bot merged commit dcae9d6 into spinnaker:master Jan 12, 2024
11 checks passed
@j-sandy j-sandy deleted the mockito-dep branch January 16, 2024 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants