Reputation: 15092
I am new to intellij. Trying to make the switch from Eclipse.
I have imported my project into intellij and feel that went well. The project structure follows the maven standard src/main/java
for code and src/test/java
for the unit tests. I then place the unit tests in the same package as the original java classes, but have directory separation for builds so my unit tests never end up in production.
I feel that I have imported the junit libraries properly because I can access them by creating a new unit test in src/main/java
and it shows me the junit classes.
My unit tests in src/test/java
are another matter. I am getting class not found errors on Assert and Before and also on the classes from src/main/java
that I'm testing.
I feel like I've missed something in the setup. Please point out my error.
Upvotes: 0
Views: 664
Reputation: 34321
In the Project Explorer you need to mark the src/test/java
directory as a 'Test Source Root'.
To do this right-click the directory and on the popup menu you'll see an item 'Mark Directory As', which will give you the option to mark the directory as a 'Test Source Root'.
If that doesn't work, then try downloading the junit jar file and adding it manually to the dependency path.
Upvotes: 3