Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
How to use Mockito with Junit in liferay?
Hello,
I am writing unit test cases.
Here is the dependency that I have configured
testCompile group: "junit", name: "junit", version: "4.12"
testImplementation group: 'org.mockito', name: 'mockito-core', version: '2.0.0-beta'
testCompile group: 'org.powermock', name: 'powermock-module-junit4', version: '2.0.9'
testCompile group: 'org.powermock', name: 'powermock-module-junit4-rule', version: '2.0.9'
testCompile group: 'org.powermock', name: 'powermock-api-mockito2', version: '2.0.9'
testCompile group: 'org.powermock', name: 'powermock-classloading-xstream', version: '1.6.6'
when I do Mockito.mock(SomeClass.class); I am getting the below error when I do gradlew.bat test
java.lang.NoClassDefFoundError: Could not initialize class org.mockito.Mockito
I have tried almost all versions of dependencies, but it is
showing the same
Here are the basic details of the project configurations
Java version: Oracle 11
Gradle version: 6.6.1
Liferay: dxp-7.4-u50
Looking for urgent support on this.
Thanks in advance
Powered by Liferay™