How to configure intelliJ to disply errors in java code like eclipse?
see the screenshot
-
What errors? Your code looks fine to me.Oliver Charlesworth– Oliver Charlesworth2014-09-26 08:59:00 +00:00Commented Sep 26, 2014 at 8:59
-
no junit package is missedRonald– Ronald2014-09-26 09:00:38 +00:00Commented Sep 26, 2014 at 9:00
-
Yes this is the problem. eclipse shows that junit package is missing but intellij does not show any errors on the editorKristopher Peter– Kristopher Peter2014-09-26 09:03:59 +00:00Commented Sep 26, 2014 at 9:03
-
Then perhaps the issue is with your Eclipse project setup.Oliver Charlesworth– Oliver Charlesworth2014-09-26 09:05:15 +00:00Commented Sep 26, 2014 at 9:05
-
2+1 for paintbrush skillz.vikingsteve– vikingsteve2014-09-26 09:50:23 +00:00Commented Sep 26, 2014 at 9:50
2 Answers
It does show the errors you expect, if you don't have the JUnit jar files in the classpath.
I created the exact same file as you showed in my IntelliJ and it really shows the errors:

What you might have done is that you have probably accidentally added the jar to the classpath.
Check the External Libraries as you can see in the picture. If there is no JUnit there, then it really is missing.
Now I can easily add the JUnit jar from IntelliJ and you'll notice the difference in the External Libraries:

Here it has been added under External Libraries and the error goes away.

Comments
You almost certainly already included the junit library into your IntelliJ project configuration.
This is easy to do, since IntelliJ has a quick action (alt-enter) to Add junit to classpath.
Look in Settings -> Libraries / Global Libraries and you will see it there. :)
Or you can look directly in Settings on the relevant Module -> Dependencies
Either that, or the project you are working in is configured already (perhaps via maven?) to have a junit dependency.