Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Intellij "java: package org.junit does not exist"

Tags:

When i try to run my test i get the following Errors: I looked up on google and found somthing on google but this didn't help.

Error:(3, 24) java: package org.junit does not exist
Error:(3, 1) java: static import only from classes and interfaces
Error:(5, 17) java: package org.junit does not exist
Error:(6, 17) java: package org.junit does not exist
Error:(12, 10) java: cannot find symbol
    symbol:   class Before
    location: class edu.kit.ipd.swt1.SimpleEditMeTest
Error:(17, 10) java: cannot find symbol
    symbol:   class Test
    location: class edu.kit.ipd.swt1.SimpleEditMeTest
[...]

My test code:

package edu.kit.ipd.swt1;
import static org.junit.Assert.assertNotNull;
import org.junit.Before;
import org.junit.Test;

public class SimpleEditMeTest {
private EditMe editMe;
@Before
public void setUp() throws Exception {
    editMe = new EditMe();
}
@Test
public void test() {
    assertNotNull(editMe.getFoo());
}
}

Screenshot of the whole project

Run configurations

Dependencies i.stack.imgur. com/OiQWU.png (Can't post more than 2 links)

like image 951
user3630298 Avatar asked Apr 20 '15 07:04

user3630298


People also ask

What is JUnit package?

It is an open-source testing framework for java programmers. The java programmer can create test cases and test his/her own code. It is one of the unit testing framework. Current version is junit 4.


1 Answers

This worked for me:

  1. Right click pom.xml
  2. Select Maven
  3. Reload project
like image 197
Charlie Avatar answered Sep 18 '22 15:09

Charlie