在运行单个测试用例时,我编写了很多单元测试,它很好。但是,当我试图在类中运行所有测试用例时,它会抛出一个奇怪的错误。
测试用例
@Test
fun `case-4 Do get new list data after refreshing refresh is gone`() {
false `should equal` false
}错误
org.mockito.exceptions.misusing.UnfinishedVerificationException:
Missing method call for verify(mock) here:
-> at com.nhaarman.mockito_kotlin.MockitoKt.verify(Mockito.kt:248)
Example of correct verification:
verify(mock).doSomething()我的环境
testImplementation 'com.nhaarman:mockito-kotlin:1.5.0'
testImplementation 'org.amshove.kluent:kluent:1.30'
testImplementation "android.arch.core:core-testing:1.1.1"发布于 2018-07-18 07:39:50
我把这个写进了密码
@After
fun validate() {
validateMockitoUsage()
}最重要的是,您必须正确导入com.nhaarman.mockito_kotlin.validateMockitoUsage
现在这是我的工作
https://stackoverflow.com/questions/51368020
复制相似问题