PowerMock 1.7.4 and Mockito 2

880 views
Skip to first unread message

Tom Diffenbach

unread,
Jun 22, 2018, 7:10:40 AM6/22/18
to PowerMock
PowerMock 1.7.4 has test dependencies on both Mockito 2.8.9 (org.mockito:mockito-core:2.8.9) and Mockito 1.10.19 (org.mockito:mockito-core:1.10.19).

Because the PowerMock wiki notes that "Mockito2 support is currently experimental" (https://github.com/powermock/powermock/wiki/Mockito), I'm excluding transitive dependencies to Mockito 2 in my gradle configuration, e.g.:

['powermock-core',
'powermock-api-support',
'powermock-api-mockito-common',
'powermock-api-mockito',
'powermock-api-easymock'
].each {
testCompile ("org.powermock:${it}:1.7.4") {
exclude group: 'org.mockito', module: 'mockito-core'
}
}

testCompile "org.mockito:mockito-core:1.10.19"



1. Is Mockito 2 support still experimental, as stated on the wiki?

2. If so, is there a better way for me to exclude Mockito 2 in gradle?

Артур Загретдинов

unread,
Jul 14, 2018, 5:27:43 AM7/14/18
to PowerMock
1. Yes, Mockito 2 is still experimental and will be left as experimental in PowerMock 1.x. Mockito 2 official will be supported only by PowerMock 2.x. 
2. Only powermock-api-mcokito2 should have test dependencies on Mockito 2.8.9, as you use Mockito 1.x it could be excluded from your dependencies. 
Reply all
Reply to author
Forward
0 new messages