Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

using mockito with IntelliJ

I am new to Java, and my background mainly in .NET. I am trying to use mockito in a java project in IntelliJ. I am trying to follow this simple example:

http://code.google.com/p/mockito/

so, I added the library mockito-all-1.9.5.jar to the folder c:\{my app path}\web\app\WEB-INF\lib

and I added in IntelliJ using Project Structure and then Libraries.

and I created a test class and add the following

import static org.mockito.Mockito.*; and I am getting this error:

"static imports are not supported at this language level"

like image 764
Ghassan Karwchan Avatar asked Oct 29 '25 09:10

Ghassan Karwchan


1 Answers

Under File - Project structure - Project, make sure to have the project language level set to at least 5.0. (I would expect 6.0 or 7.0 now). Static imports are indeed supported only since Java 5.

Also, Mockito is used only in tests, and has thus no reason to be part of the deployed libraries of the webapp. It should thus not be under WEB-INF/lib.

like image 73
JB Nizet Avatar answered Nov 01 '25 01:11

JB Nizet



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!