Android unit test not mocked

后端 未结 3 1291
我寻月下人不归
我寻月下人不归 2020-12-05 12:46

I followed this guide https://sites.google.com/a/android.com/tools/tech-docs/unit-testing-support but i am stuck with this error:

junit.framework.AssertionF         


        
3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-05 13:32

    android {
    
    
    testOptions {
        unitTests.returnDefaultValues = true
    } }
    
    dependencies {
    testImplementation libs.leakCanaryNoOp
    testImplementation tests.jUnit
    testImplementation tests.mockito
    testImplementation(tests.mokitoKotlin) {
        exclude group: "org.jetbrains.kotlin", module: "kotlin-stdlib"
        exclude group: "org.jetbrains.kotlin", module: "kotlin-runtime"
        exclude group: "org.jetbrains.kotlin", module: "kotlin-reflect"
        exclude group: "org.mockito", module: "mockito-core"
    }
    testImplementation tests.powerMock
    testImplementation tests.powerMockApiMockito
    testImplementation (tests.robolectric) {
        exclude group: 'org.robolectric', module: 'robolectric-resources:'
    }
    testImplementation (tests.robolectricShadowsSupport){
        exclude group: 'org.robolectric', module: 'robolectric'
    }
    kaptTest libs.daggerCompiler
    

    }

提交回复
热议问题