feat: add junit 5 support

這個提交存在於:
Arnaud Vergnet 2020-11-22 11:05:47 +01:00
父節點 20b2ffc38d
當前提交 8963b70ae2
共有 3 個檔案被更改,包括 27 行新增1 行删除

查看文件

@ -11,7 +11,8 @@ repositories {
} }
dependencies { dependencies {
testCompile group: 'junit', name: 'junit', version: '4.12' testImplementation("org.junit.jupiter:junit-jupiter-api:5.7.0")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.7.0")
} }
javafx { javafx {
@ -19,4 +20,8 @@ javafx {
modules = [ 'javafx.controls', 'javafx.fxml' ] modules = [ 'javafx.controls', 'javafx.fxml' ]
} }
test {
useJUnitPlatform()
}
mainClassName = 'fr.insa.clavardator.MainApp' mainClassName = 'fr.insa.clavardator.MainApp'

查看文件

@ -0,0 +1,7 @@
package fr.insa.clavardator;
public class TestClass {
public int test(int v) {
return v;
}
}

查看文件

@ -0,0 +1,14 @@
import fr.insa.clavardator.TestClass;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
// See here: https://junit.org/junit5/docs/current/user-guide/#overview
public class FirstTest {
private final TestClass t = new TestClass();
@Test
void addition() {
assertEquals(2, t.test(2));
}
}