-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathTestBank.java
More file actions
52 lines (45 loc) · 1.23 KB
/
TestBank.java
File metadata and controls
52 lines (45 loc) · 1.23 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
import org.testng.Assert;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
public class TestBank {
@DataProvider(name="giveData")
public Object[][] provideData(){
Object array[][]= null;
try {
array = ExcelReader.readExcel();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
/*Object array[][]= {
{10,20,30},{100,200,300},{90,90,180}
};*/
return array;
}
@Test(dataProvider="giveData")
public void testAdd(int first, int second, int expected){
Logic logic = new Logic();
int result = logic.add(first,second);
Assert.assertEquals(result, expected);
}
/*
@Test(enabled=false,timeOut=1000)
public void testPerformance(){
Logic logic = new Logic();
logic.withDraw(9090);
}
@Test
public void testWithDraw(){
boolean expectedResult = true;
Logic logic = new Logic();
boolean actualResult = logic.withDraw(9090);
Assert.assertEquals(actualResult, expectedResult);
}
@Test(expectedExceptions={RuntimeException.class})
public void testWithDrawNegative(){
boolean expectedResult = false;
Logic logic = new Logic();
boolean actualResult = logic.withDraw(0);
Assert.assertEquals(actualResult, expectedResult);
}*/
}