File tree Expand file tree Collapse file tree 1 file changed +6
-17
lines changed Expand file tree Collapse file tree 1 file changed +6
-17
lines changed Original file line number Diff line number Diff line change 3
3
import static org .junit .jupiter .api .Assertions .assertEquals ;
4
4
5
5
public class CalculatorTest {
6
+ Calculator c = new Calculator ();
7
+
6
8
@ Test
7
9
void testAdd (){
8
- int result = add (2 ,3 );
10
+ int result = c . add (2 ,3 );
9
11
assertEquals (5 ,result );
10
12
}
11
13
@ Test
12
14
void testSubtract (){
13
- int result = subtract (2 ,3 );
15
+ int result = c . subtract (2 ,3 );
14
16
assertEquals (-1 ,result );
15
17
}
16
18
17
19
@ Test
18
20
void testMultiply (){
19
- int result = multiply (2 ,3 );
21
+ int result = c . multiply (2 ,3 );
20
22
assertEquals (6 ,result );
21
23
}
22
24
@ Test
23
25
void testDivide (){
24
- int result = divide (6 ,3 );
26
+ int result = c . divide (6 ,3 );
25
27
assertEquals (2 ,result );
26
28
}
27
-
28
- int add (int a , int b ){
29
- return a + b ;
30
- }
31
- int subtract (int a , int b ){
32
- return a - b ;
33
- }
34
- int multiply (int a , int b ){
35
- return a * b ;
36
- }
37
- int divide (int a , int b ){
38
- return a / b ;
39
- }
40
29
}
You can’t perform that action at this time.
0 commit comments