BAEL-2263 Using JUnit 5 with Gradle
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
package com.example;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
public class CalculatorJUnit4Test {
|
||||
@Test
|
||||
public void testAdd() {
|
||||
assertEquals(42, Integer.sum(19, 23));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.example;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
import org.junit.jupiter.api.Tag;
|
||||
import org.junit.jupiter.api.Test;;
|
||||
|
||||
public class CalculatorJUnit5Test {
|
||||
|
||||
@Tag("fast")
|
||||
@Test
|
||||
public void testAdd() {
|
||||
assertEquals(42, Integer.sum(19, 23));
|
||||
}
|
||||
|
||||
@Tag("slow")
|
||||
@Test
|
||||
public void testAddMaxInteger() {
|
||||
assertEquals(2147483646, Integer.sum(2147183646, 300000));
|
||||
}
|
||||
|
||||
@Tag("fast")
|
||||
@Test
|
||||
public void testAddZero() {
|
||||
assertEquals(21, Integer.sum(21, 0));
|
||||
}
|
||||
|
||||
@Tag("fast")
|
||||
@Test
|
||||
public void testDivide() {
|
||||
assertThrows(ArithmeticException.class, () -> {
|
||||
Integer.divideUnsigned(42, 0);
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user