File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed
Roadmap/13 - PRUEBAS UNITARIAS/java Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change
1
+ public class Astra {
2
+
3
+ /*
4
+ * Funcion que devuelve la suma de 2 numeros enteros*/
5
+ public int sumar (int num1 , int num2 ) {
6
+ int sol = 0 ;
7
+
8
+ sol = num1 + num2 ;
9
+ System .out .println (sol );
10
+ return sol ;
11
+ }
12
+ }
13
+
14
+
15
+
16
+ //Test
17
+
18
+ import static org .junit .jupiter .api .Assertions .*;
19
+ import org .junit .jupiter .api .Test ;
20
+
21
+ class SumarTest {
22
+
23
+ @ Test
24
+ void testSumar () {
25
+ Astra llamar = new Astra ();
26
+
27
+ /*numero positivo en los 2 numeros*/
28
+ assertEquals (20 , llamar .sumar (10 , 10 ));
29
+ /*numero positivo y negativo en los 2 con resultado positivo*/
30
+ assertEquals (2 , llamar .sumar (5 , -3 ));
31
+ assertEquals (5 , llamar .sumar (-5 , 10 ));
32
+ /*numero positivo y negativo en los 2 con resultado negativo*/
33
+ assertEquals (-8 , llamar .sumar (-10 , 2 ));
34
+ assertEquals (-8 , llamar .sumar (2 , -10 ));
35
+ }
36
+
37
+ }
You can’t perform that action at this time.
0 commit comments