blekione:
「延長」する方法JUnit 5
でmockito 3
?
JUnit 5
使用するmockito
バージョンに修道院3.0
新しいの注釈を付けなければテストクラスのニーズJUnit 5
注釈@ExtendWith(MockitoExtension.class)
、例えば:
@ExtendWith(MockitoExtension.class)
public class TestClass {
@Mock
DependencyA dependancyA;
public void myTest() {
...
}
}
そのように、それ以上を使用する必要はありませんMockitoRule
との@Rule
注釈が。
私は今日のベータリリースを試してみましたがmockito-android 3.0.0-beta1
、それは持っていないMockitoExtension
クラスを。
私が代わりに何を使うべきでしょうか?私はそれはまだベータ版であるように理解され、バージョン3.0のための任意のドキュメントを、見つけることができませんでした。
サムBrannen:
MockitoExtension
で公開されているmockito-junit-jupiter
アーティファクト。
次のようにあなたはそれに依存関係を追加することができます。
Mavenの
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
<version>2.27.0</version>
<scope>test</scope>
</dependency>
Gradleの
testCompile 'org.mockito:mockito-junit-jupiter:2.27.0'
また、リソース