Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Cannot resolve @org.unit.Test in IntelliJ Idea

That’s what pom.xml include:

    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.13.2</version>
        <scope>test</scope>
    </dependency>

That’s actual test code:

import org.junit.Assert.*; // Cannot resolve symbol 'Assert'

public class CalculatorTest {

    @org.junit.Test // Cannot resolve symbol 'Test'
    public void add() {
        Assert.assertEquals(5.0, 5.0, 0.01); // Cannot resolve symbol 'Assert'
    }
}

Building Project just says that it cannot fine symbol ‘Assert’.
I tried Alt+Enter -> Add ‘JUnit4’ to classpath but it only doubles the dependency in pop.xml.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Try this (and it appears it worked as per OP’s comment):

  1. File->Invalidate Caches
  2. check all boxes except Ask before downloading...
  3. Invalidate and Restart
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading