If you want to use JUnit 5, the latest release of JUnit, from Eclipse, then you have to change your import from import org.junit.Test; to import org.junit.jupiter.api.Test;. Notice the jupiter.api there in the middle.

Otherwise, the test runner will complain and tell you that you don't have tests in your project.

The not-so-minimal test that I created was the following:

package test;

import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*;

import org.junit.jupiter.api.Test;

class FirstTest {
    @Test
    void test() {
        assertThat(1+1, is(equalTo(2)));
    }
}
blog comments powered by Disqus