I want to convert my Gradle project test from JUnit 4 to JUnit 5. As there are a lot of tests, I don't want to convert them all at the same time.
I try to configure my build.gradle
like this:
apply plugin: 'java'
compileTestJava {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
repositories {
mavenCentral()
}
dependencies {
testCompile("junit:junit:4.12")
testCompile 'org.junit.jupiter:junit-jupiter-api:5.0.0-M2'
testRuntime("org.junit.vintage:junit-vintage-engine:4.12.0-M2")
testRuntime 'org.junit.jupiter:junit-jupiter-engine:5.0.0-M2'
}
Old test are still running, but Intellij didn't recognize the new JUnit 5 test like this one:
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertTrue;
public class JUnit5Test {
@Test
void test() {
assertTrue(true);
}
}
I'm using Intellij 2016.2 with gradle 2.9