|
|
@@ -18,62 +18,62 @@ public class CurrencyConverterTest {
|
|
18
|
18
|
CurrencyConverter wuTang = new CurrencyConverter();
|
|
19
|
19
|
double expected = 25.00;
|
|
20
|
20
|
double actual = wuTang.convert("EURO", 23.50, "DOLLAR");
|
|
21
|
|
- assertEquals(expected, actual, 2);
|
|
|
21
|
+ assertEquals(expected, actual, 0.001);
|
|
22
|
22
|
}
|
|
23
|
23
|
@Test
|
|
24
|
24
|
public void testEuroToPound() {
|
|
25
|
25
|
CurrencyConverter wuTang = new CurrencyConverter();
|
|
26
|
|
- double expected = 23.50;
|
|
27
|
|
- double actual = wuTang.convert("EURO", 25.00, "POUND");
|
|
|
26
|
+ double expected = 0.82;
|
|
|
27
|
+ double actual = wuTang.convert("EURO", 0.94, "POUND");
|
|
28
|
28
|
assertEquals(expected, actual, 0.001);
|
|
29
|
29
|
}
|
|
30
|
30
|
@Test
|
|
31
|
31
|
public void testPoundToRupee() {
|
|
32
|
32
|
CurrencyConverter wuTang = new CurrencyConverter();
|
|
33
|
|
- double expected = 23.50;
|
|
34
|
|
- double actual = wuTang.convert("POUND", 25.00, "RUPEE");
|
|
|
33
|
+ double expected = 68.32;
|
|
|
34
|
+ double actual = wuTang.convert("POUND", 0.82, "RUPEE");
|
|
35
|
35
|
assertEquals(expected, actual, 0.001);
|
|
36
|
36
|
}
|
|
37
|
37
|
@Test
|
|
38
|
38
|
public void testRupeeToCANDollar() {
|
|
39
|
39
|
CurrencyConverter wuTang = new CurrencyConverter();
|
|
40
|
|
- double expected = 23.50;
|
|
41
|
|
- double actual = wuTang.convert("RUPEE", 25.00, "CANDOLLAR");
|
|
|
40
|
+ double expected = 1.32;
|
|
|
41
|
+ double actual = wuTang.convert("RUPEE", 68.32, "CANDOLLAR");
|
|
42
|
42
|
assertEquals(expected, actual, 0.001);
|
|
43
|
43
|
}
|
|
44
|
44
|
@Test
|
|
45
|
45
|
public void testCANDollarToSINGDollar() {
|
|
46
|
46
|
CurrencyConverter wuTang = new CurrencyConverter();
|
|
47
|
|
- double expected = 23.50;
|
|
48
|
|
- double actual = wuTang.convert("CANDOLLAR", 25.00, "SINGDOLLAR");
|
|
|
47
|
+ double expected = 1.43;
|
|
|
48
|
+ double actual = wuTang.convert("CANDOLLAR", 1.32, "SINGDOLLAR");
|
|
49
|
49
|
assertEquals(expected, actual, 0.001);
|
|
50
|
50
|
}
|
|
51
|
51
|
@Test
|
|
52
|
52
|
public void testSINGDollarToFranc() {
|
|
53
|
53
|
CurrencyConverter wuTang = new CurrencyConverter();
|
|
54
|
|
- double expected = 23.50;
|
|
55
|
|
- double actual = wuTang.convert("SINGDOLLAR", 25.00, "FRANC");
|
|
|
54
|
+ double expected = 1.01;
|
|
|
55
|
+ double actual = wuTang.convert("SINGDOLLAR", 1.43, "FRANC");
|
|
56
|
56
|
assertEquals(expected, actual, 0.001);
|
|
57
|
57
|
}
|
|
58
|
58
|
@Test
|
|
59
|
59
|
public void testFrancToRinggit() {
|
|
60
|
60
|
CurrencyConverter wuTang = new CurrencyConverter();
|
|
61
|
|
- double expected = 23.50;
|
|
62
|
|
- double actual = wuTang.convert("FRANC", 25.00, "RINGGIT");
|
|
|
61
|
+ double expected = 4.47;
|
|
|
62
|
+ double actual = wuTang.convert("FRANC", 1.01, "RINGGIT");
|
|
63
|
63
|
assertEquals(expected, actual, 0.001);
|
|
64
|
64
|
}
|
|
65
|
65
|
@Test
|
|
66
|
66
|
public void testRinggitToYen() {
|
|
67
|
67
|
CurrencyConverter wuTang = new CurrencyConverter();
|
|
68
|
|
- double expected = 23.50;
|
|
69
|
|
- double actual = wuTang.convert("RINGGIT", 25.00, "YEN");
|
|
|
68
|
+ double expected = 115.84;
|
|
|
69
|
+ double actual = wuTang.convert("RINGGIT", 4.47, "YEN");
|
|
70
|
70
|
assertEquals(expected, actual, 0.001);
|
|
71
|
71
|
}
|
|
72
|
72
|
@Test
|
|
73
|
73
|
public void testYenToRenminbi() {
|
|
74
|
74
|
CurrencyConverter wuTang = new CurrencyConverter();
|
|
75
|
|
- double expected = 23.50;
|
|
76
|
|
- double actual = wuTang.convert("YEN", 25.00, "RENMINBI");
|
|
|
75
|
+ double expected = 6.92;
|
|
|
76
|
+ double actual = wuTang.convert("YEN", 115.84, "RENMINBI");
|
|
77
|
77
|
assertEquals(expected, actual, 0.001);
|
|
78
|
78
|
}
|
|
79
|
79
|
|