-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathFeesCalculatorSlicingTest.java
More file actions
60 lines (45 loc) · 1.51 KB
/
FeesCalculatorSlicingTest.java
File metadata and controls
60 lines (45 loc) · 1.51 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
package bank;
import static org.junit.Assert.*;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Collection;
import org.junit.Test;
import org.junit.Before;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameter;
import bank.FeesCalculator;
import org.junit.runner.RunWith;
import static org.junit.Assert.assertEquals;
@RunWith(Parameterized.class)
public class FeesCalculatorSlicingTest {
@Parameter(0)
public int amount;
@Parameter(1)
public int accountBalance;
@Parameter(2)
public boolean student;
@Parameter(3)
public int dayOfWeek;
@Parameter(4)
public float feePercentage; //expected
public FeesCalculator feeCalculator;
@Before
public void initialize() {
feeCalculator = new FeesCalculator();
}
@Parameterized.Parameters
public static Collection<Object[]> data() {
return Arrays.asList(new Object[][] {
{1000, 10000, true, Calendar.SATURDAY, 1000 * 0.0f},
{1000, 10000, true, Calendar.SUNDAY, 1000 * 0.0f},
{1000, 10000, true, Calendar.WEDNESDAY, 1000 * 0.001f},
{1000, 900, false, Calendar.SATURDAY, 1000 * 0.002f},
{1000, 9000, false, Calendar.SATURDAY, 1000 * 0.001f},
{1000, 90000, false, Calendar.SATURDAY, 1000 * 0.0f},
});
}
@Test
public void test() {
assertEquals(feePercentage, feeCalculator.calculateWithdrawalFee(amount, accountBalance, student, dayOfWeek), 0.5);
}
}