feat: add junit 5 support
This commit is contained in:
parent
20b2ffc38d
commit
8963b70ae2
3 changed files with 27 additions and 1 deletions
|
@ -11,7 +11,8 @@ repositories {
|
|||
}
|
||||
|
||||
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 {
|
||||
|
@ -19,4 +20,8 @@ javafx {
|
|||
modules = [ 'javafx.controls', 'javafx.fxml' ]
|
||||
}
|
||||
|
||||
test {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
|
||||
mainClassName = 'fr.insa.clavardator.MainApp'
|
7
src/main/java/fr/insa/clavardator/TestClass.java
Normal file
7
src/main/java/fr/insa/clavardator/TestClass.java
Normal file
|
@ -0,0 +1,7 @@
|
|||
package fr.insa.clavardator;
|
||||
|
||||
public class TestClass {
|
||||
public int test(int v) {
|
||||
return v;
|
||||
}
|
||||
}
|
14
src/test/java/FirstTest.java
Normal file
14
src/test/java/FirstTest.java
Normal 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));
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue