|
@@ -1,2 +1,84 @@
|
|
1
|
+import org.junit.Assert;
|
|
2
|
+import org.junit.Before;
|
|
3
|
+import org.junit.Test;
|
|
4
|
+
|
|
5
|
+import java.util.Arrays;
|
|
6
|
+
|
1
|
7
|
public class CurrencyConverterTest {
|
|
8
|
+ Double USDOLLAREXR = 1.00;
|
|
9
|
+ Double EUROEXR = 0.94;
|
|
10
|
+ Double BRITPOUNDEXR = 0.82;
|
|
11
|
+ Double INDIARUPEEEXR = 68.32;
|
|
12
|
+ Double AUSTDOLLAREXR = 1.35;
|
|
13
|
+ Double CANADADOLLAREXR = 1.32;
|
|
14
|
+ Double SINGDOLLAREXR = 1.43;
|
|
15
|
+ Double SWISSFRANCEXR = 1.01;
|
|
16
|
+ Double MALAYSRINGGITEXR = 4.47;
|
|
17
|
+ Double JAPANYENEXR = 115.84;
|
|
18
|
+ Double CHINAYUANEXR = 6.92;
|
|
19
|
+
|
|
20
|
+ @Test
|
|
21
|
+ public void testDollarToEuro(){
|
|
22
|
+ Double actual = CurrencyConverter.convertCurrency(50_000.00, USDOLLAREXR, EUROEXR);
|
|
23
|
+ Double expected = 47_000.00;
|
|
24
|
+
|
|
25
|
+ Assert.assertEquals(expected, actual);
|
|
26
|
+ }
|
|
27
|
+
|
|
28
|
+ @Test
|
|
29
|
+ public void testEuroToDollar(){
|
|
30
|
+ Double actual = CurrencyConverter.convertCurrency(50000.00, EUROEXR, USDOLLAREXR);
|
|
31
|
+ Double expected = 53_191.49;
|
|
32
|
+
|
|
33
|
+ Assert.assertEquals(expected, actual);
|
|
34
|
+ }
|
|
35
|
+
|
|
36
|
+ @Test
|
|
37
|
+ public void testEuroToBritishPound(){
|
|
38
|
+ Double actual = CurrencyConverter.convertCurrency(50000.00, EUROEXR, BRITPOUNDEXR);
|
|
39
|
+ Double expected = 43_617.02;
|
|
40
|
+
|
|
41
|
+ Assert.assertEquals(expected, actual);
|
|
42
|
+ }
|
|
43
|
+
|
|
44
|
+ @Test
|
|
45
|
+ public void testBritishPoundToIndianRupee(){
|
|
46
|
+ Double actual = CurrencyConverter.convertCurrency(50000.00, BRITPOUNDEXR, INDIARUPEEEXR);
|
|
47
|
+ Double expected = 4_165_853.66;
|
|
48
|
+
|
|
49
|
+ Assert.assertEquals(expected, actual);
|
|
50
|
+ }
|
|
51
|
+
|
|
52
|
+ @Test
|
|
53
|
+ public void testRupeeToCanadianDollar(){
|
|
54
|
+ Double actual = CurrencyConverter.convertCurrency(50000.00, INDIARUPEEEXR, CANADADOLLAREXR);
|
|
55
|
+ Double expected = 966.04;
|
|
56
|
+
|
|
57
|
+ Assert.assertEquals(expected, actual);
|
|
58
|
+ }
|
|
59
|
+
|
|
60
|
+ @Test
|
|
61
|
+ public void testCanadianDollarToSingaporeDollar(){
|
|
62
|
+ Double actual = CurrencyConverter.convertCurrency(50000.00, CANADADOLLAREXR, SINGDOLLAREXR);
|
|
63
|
+ Double expected = 54_166.67;
|
|
64
|
+
|
|
65
|
+ Assert.assertEquals(expected, actual);
|
|
66
|
+ }
|
|
67
|
+
|
|
68
|
+ @Test
|
|
69
|
+ public void testSingaporeDollarToSwissFranc(){
|
|
70
|
+ Double actual = CurrencyConverter.convertCurrency(50000.00, SINGDOLLAREXR, SWISSFRANCEXR);
|
|
71
|
+ Double expected = 35_314.69;
|
|
72
|
+
|
|
73
|
+ Assert.assertEquals(expected, actual);
|
|
74
|
+ }
|
|
75
|
+
|
|
76
|
+ @Test
|
|
77
|
+ public void testSwissFrancToMalaysianRinggit(){
|
|
78
|
+ Double actual = CurrencyConverter.convertCurrency(50000.00, SWISSFRANCEXR, MALAYSRINGGITEXR);
|
|
79
|
+ Double expected = 221_287.13;
|
|
80
|
+
|
|
81
|
+ Assert.assertEquals(expected, actual);
|
|
82
|
+ }
|
|
83
|
+
|
2
|
84
|
}
|