How to use Mockito with Junit in liferay?How to use Mockito with Junit in liferay?https://liferay.dev/en/c/message_boards/find_thread?p_l_id=119785333&threadId=1216585732024-03-29T02:14:08Z2024-03-29T02:14:08ZHow to use Mockito with Junit in liferay?Bhargav Vaghasiyahttps://liferay.dev/en/c/message_boards/find_message?p_l_id=119785333&messageId=1216585722023-02-27T18:55:54Z2023-02-27T06:33:20Z<p>Hello,</p>
<p>I am writing unit test cases.</p>
<p>Here is the dependency that I have configured</p>
<blockquote>
<p>testCompile group: "junit", name: "junit",
version: "4.12"</p>
<p>testImplementation group: 'org.mockito', name: 'mockito-core',
version: '2.0.0-beta'</p>
<p>testCompile group: 'org.powermock', name:
'powermock-module-junit4', version: '2.0.9'</p>
<p>testCompile group: 'org.powermock', name:
'powermock-module-junit4-rule', version: '2.0.9'</p>
<p>testCompile group: 'org.powermock', name: 'powermock-api-mockito2',
version: '2.0.9'</p>
<p>testCompile group: 'org.powermock', name:
'powermock-classloading-xstream', version: '1.6.6'</p></blockquote>
<p>when I do Mockito.mock(SomeClass.class); I am getting the below error
when I do gradlew.bat test</p>
<blockquote>
<p>java.lang.NoClassDefFoundError: Could not initialize class org.mockito.Mockito</p></blockquote>
<p>
<br /> I have tried almost all versions of dependencies, but it is
showing the same</p>
<p>Here are the basic details of the project configurations</p>
<p>Java version: Oracle 11</p>
<p>Gradle version: 6.6.1</p>
<p>Liferay: dxp-7.4-u50</p>
<p>Looking for urgent support on this.</p>
<p>Thanks in advance<