-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathAddTester.java
More file actions
70 lines (49 loc) · 1.69 KB
/
AddTester.java
File metadata and controls
70 lines (49 loc) · 1.69 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import java.util.Scanner;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
public class AddTester {
@Test(timeout=1)
public void shouldAddNNumbers(){
AddLogic logic = new AddLogic();
//logic.add("1000","200","1","2","5");
int result = logic.add("1","2","3","4","5","6","7","8","9","10");
//int result = logic.add();
int expectedResult = 55;
Assert.assertEquals(expectedResult, result);
}
Scanner scanner =new Scanner(System.in);
@Ignore
@Test
public void shouldAddTwoEnglishStrings(){
// I Need to take Input From the User
//System.in - Input is very slow Process in Computer
// Scanner - Scanner is a Buffer (Scanner is Predefine Class)
System.out.println("Enter the String Form");
String firstNo = scanner.next();
System.out.println("Enter the String number");
String secondno = scanner.next();
AddLogic logic = new AddLogic(); // Create Object
int result = logic.add(firstNo, secondno);
//scanner.close();
int expectedResult = 100;
Assert.assertEquals(expectedResult, result);
}
@Ignore
@Test
public void shouldAddTwoStrings(){
// I Need to take Input From the User
//System.in - Input is very slow Process in Computer
// Scanner - Scanner is a Buffer (Scanner is Predefine Class)
//Scanner scanner =new Scanner(System.in);
System.out.println("Enter the Number");
String firstNo = scanner.next();
System.out.println("Enter the second number");
String secondno = scanner.next();
AddLogic logic = new AddLogic(); // Create Object
int result = logic.add(firstNo, secondno);
//scanner.close();
int expectedResult = 30;
Assert.assertEquals(expectedResult, result);
}
}