mockito-inlineの未解決の依存関係

前提

現在JunitテストでstaticのクラスをMock化しようとしています。
staticのクラスをmockitoのStaticMockでMockしてテストを実施したところエラー(下記エラーメッセージ参照)が発生しました。
検出されたメッセージに従いGradleのdependenciesにmockito-inlineを追記したところ未解決の依存関係のエラーが発生します。

実現したいこと

エラーを解消してstaticクラスのMockを実現したい。

エラーメッセージ

org.mockito.exceptions.base.MockitoException:
The used MockMaker PowerMockMaker does not support the creation of static mocks

Mockito's inline mock maker supports static mocks based on the Instrumentation API.
You can simply enable this mock mode, by placing the 'mockito-inline' artifact where you are currently using 'mockito-core'.
Note that Mockito's inline mock maker is not supported on Android.

該当のソースコード

gradle一部抜粋
dependencies{
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.batch:spring-batch-test'

testImplementation 'org.cokito:mockito-inline'
}

コメントを投稿

0 コメント