-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathFeesCalculatorTransferTest.java
76 lines (54 loc) · 2.01 KB
/
FeesCalculatorTransferTest.java
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
71
72
73
74
75
76
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 FeesCalculatorTransferTest {
@Parameter(0)
public int amount;
@Parameter(1)
public int fromAccountBalance;
@Parameter(2)
public int toAccountBalance;
@Parameter(3);
public boolean student;
@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[][] {
{9000, 90000, 90000, true, 9000 * 0.001f},
{9000, 90000, 100000, true, 9000 * 0.005f},
{9000, 100000, 90000, true, 9000 * 0.005f},
{9000, 100000, 100000, true, 9000 * 0.0025f},
{10000, 90000, 90000, true, 10000 * 0.0005f},
{10000, 90000, 100000, true, 10000 * 0.00025f},
{10000, 100000, 90000, true, 10000 * 0.0025f},
{10000, 100000, 100000, true, 10000 * 0.00125f},
{9000, 90000, 90000, false, 9000 * 0.002f},
{9000, 90000, 100000, false, 9000 * 0.001f},
{9000, 100000, 90000, false, 9000 * 0.01f},
{9000, 100000, 100000, false, 9000 * 0.005f},
{10000, 90000, 90000, false, 10000 * 0.001f},
{10000, 90000, 100000, false, 10000 * 0.0005f},
{10000, 100000, 90000, false, 10000 * 0.005f},
{10000, 100000, 100000, false, 10000 * 0.0025f},
});
}
@Test
public void test() {
assertEquals(feePercentage, feeCalculator.calculateDepositInterest(amount, accountBalance, student), 0.5);
}