IntelliJ + Gradle + JUnit5でHelloTestまで
#Java #IntelliJ #JUnit5
code: build.gradle
...
dependencies {
// https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-api
testCompile group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.5.2'
testCompile group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.5.2'
}
test {
useJUnitPlatform()
}
code: HelloTest.java
package hogehoge
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
class HelloTest {
@Test
void helloTest() {
assertEquals(1, 1);
}
}
微妙にハマった
IntelliJ側のJUnitプラグインの有効化
これしないと、IntelliJからJUnitが実行できなかった