File tree Expand file tree Collapse file tree 2 files changed +41
-0
lines changed Expand file tree Collapse file tree 2 files changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ repositories {
12
12
dependencies {
13
13
testImplementation platform(' org.junit:junit-bom:5.9.1' )
14
14
testImplementation(' org.junit.jupiter:junit-jupiter' )
15
+ testImplementation (' org.junit.jupiter:junit-jupiter:5.10.0' )
15
16
}
16
17
17
18
test {
Original file line number Diff line number Diff line change
1
+ import org .junit .jupiter .api .Test ;
2
+
3
+ import static org .junit .jupiter .api .Assertions .assertEquals ;
4
+
5
+ public class CalculatorTest {
6
+ @ Test
7
+ void testAdd (){
8
+ int result = add (2 ,3 );
9
+ assertEquals (5 ,result );
10
+ }
11
+ @ Test
12
+ void testSubtract (){
13
+ int result = subtract (2 ,3 );
14
+ assertEquals (-1 ,result );
15
+ }
16
+
17
+ @ Test
18
+ void testMultiply (){
19
+ int result = multiply (2 ,3 );
20
+ assertEquals (6 ,result );
21
+ }
22
+ @ Test
23
+ void testDivide (){
24
+ int result = divide (6 ,3 );
25
+ assertEquals (2 ,result );
26
+ }
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
+ }
You can’t perform that action at this time.
0 commit comments