-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtask4Test.java
36 lines (30 loc) · 856 Bytes
/
task4Test.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
public class MathFunctionsTest {
@Test
public void testAdd() {
int result = MathFunctions.add(5, 3);
Assertions.assertEquals(8, result);
}
@Test
public void testSubtract() {
int result = MathFunctions.subtract(5, 3);
Assertions.assertEquals(2, result);
}
@Test
public void testMultiply() {
int result = MathFunctions.multiply(5, 3);
Assertions.assertEquals(15, result);
}
@Test
public void testDivide() {
int result = MathFunctions.divide(6, 3);
Assertions.assertEquals(2, result);
}
@Test
public void testDivideByZero() {
Assertions.assertThrows(IllegalArgumentException.class, () -> {
MathFunctions.divide(6, 0);
});
}
}