feat: add junit 5 support
這個提交存在於:
父節點
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;
|
||||||
|
}
|
||||||
|
}
|
14
src/test/java/FirstTest.java
一般檔案
14
src/test/java/FirstTest.java
一般檔案
|
@ -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));
|
||||||
|
}
|
||||||
|
}
|
載入中…
新增問題並參考