feat: add junit 5 support

This commit is contained in:
Arnaud Vergnet 2020-11-22 11:05:47 +01:00
parent 20b2ffc38d
commit 8963b70ae2
3 changed files with 27 additions and 1 deletions

View file

@ -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'

View file

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

View file

@ -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));
}
}