Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mockito+PowerMock gradle configuration

I need to use in my android instrumented tests mockito and powermock.

The main problem is that both of them have some problems with configuring it in gradle because of conflicts and other stuff.

Maybe somebody who has working configuration of .gradle file for mockito+powermock in android instrumented tests could share it?

like image 376
Denis Korbovsky Avatar asked Oct 18 '25 14:10

Denis Korbovsky


1 Answers

This is my gradle configuration to use mockito and powerMock:

dependencies {
    ...

    /**Power mock**/
    testCompile "org.powermock:powermock-core:1.7.3"
    testCompile "org.powermock:powermock-module-junit4:1.7.3"
    testCompile "org.powermock:powermock-api-mockito2:1.7.3"
    /**End of power mock **/


}

NOTE: I had to remove the mockito dependency in order to make it works:

//Remove this line
testImplementation "org.mockito:mockito-core:2.13.0"
like image 150
jmartinalonso Avatar answered Oct 21 '25 04:10

jmartinalonso