|
@@ -1,2 +1,109 @@
|
|
1
|
+
|
|
2
|
+import org.junit.Assert;
|
|
3
|
+import org.junit.Test;
|
|
4
|
+
|
1
|
5
|
public class CurrencyConverterTest {
|
2
|
|
-}
|
|
6
|
+ @Test
|
|
7
|
+ public void firstCurrTest(){
|
|
8
|
+ CurrencyConverter conv = new CurrencyConverter();
|
|
9
|
+ double actual = conv.firstCurr("jy");
|
|
10
|
+ double expected = 115.84;
|
|
11
|
+ Assert.assertEquals(expected, actual,.0001);
|
|
12
|
+ }
|
|
13
|
+
|
|
14
|
+ @Test
|
|
15
|
+ public void getCurrency2test(){
|
|
16
|
+ CurrencyConverter conv = new CurrencyConverter();
|
|
17
|
+ double actual = conv.secCurr("sd");
|
|
18
|
+ double expected = 1.43;
|
|
19
|
+ Assert.assertEquals(expected, actual,.0001);
|
|
20
|
+ }
|
|
21
|
+
|
|
22
|
+ @Test
|
|
23
|
+ public void convertTest1(){
|
|
24
|
+ CurrencyConverter conv = new CurrencyConverter();
|
|
25
|
+ double actual = conv.convert("us","jy",1);
|
|
26
|
+ double expected = 115.84;
|
|
27
|
+ Assert.assertEquals(expected, actual,.0001);
|
|
28
|
+ }
|
|
29
|
+
|
|
30
|
+ @Test
|
|
31
|
+ public void convertDollarToEuro(){
|
|
32
|
+ CurrencyConverter conv = new CurrencyConverter();
|
|
33
|
+ double actual = conv.convert("us","eu",1);
|
|
34
|
+ double expected = .94;
|
|
35
|
+ Assert.assertEquals(expected, actual,.0001);
|
|
36
|
+ }
|
|
37
|
+
|
|
38
|
+ @Test
|
|
39
|
+ public void convertEuroToDollar(){
|
|
40
|
+ CurrencyConverter conv = new CurrencyConverter();
|
|
41
|
+ double actual = conv.convert("eu","us",1);
|
|
42
|
+ double expected = 1.063829;
|
|
43
|
+ Assert.assertEquals(expected, actual,.0001);
|
|
44
|
+ }
|
|
45
|
+
|
|
46
|
+ @Test
|
|
47
|
+ public void convertEuroToBritishPound(){
|
|
48
|
+ CurrencyConverter conv = new CurrencyConverter();
|
|
49
|
+ double actual = conv.convert("eu","bp",1);
|
|
50
|
+ double expected = .8723404;
|
|
51
|
+ Assert.assertEquals(expected, actual,.0001);
|
|
52
|
+ }
|
|
53
|
+
|
|
54
|
+ @Test
|
|
55
|
+ public void convertBritishPoundToIndianRupee(){
|
|
56
|
+ CurrencyConverter conv = new CurrencyConverter();
|
|
57
|
+ double actual = conv.convert("bp","ir",1);
|
|
58
|
+ double expected = 83.31707;
|
|
59
|
+ Assert.assertEquals(expected, actual,.0001);
|
|
60
|
+ }
|
|
61
|
+
|
|
62
|
+ @Test
|
|
63
|
+ public void convertRupeetoCanadian(){
|
|
64
|
+ CurrencyConverter conv = new CurrencyConverter();
|
|
65
|
+ double actual = conv.convert("ir","cd",1);
|
|
66
|
+ double expected = .01932084;
|
|
67
|
+ Assert.assertEquals(expected, actual,.0001);
|
|
68
|
+ }
|
|
69
|
+
|
|
70
|
+ @Test
|
|
71
|
+ public void convertCanadianToSingapore(){
|
|
72
|
+ CurrencyConverter conv = new CurrencyConverter();
|
|
73
|
+ double actual = conv.convert("cd","sd",1);
|
|
74
|
+ double expected = 1.0833333333;
|
|
75
|
+ Assert.assertEquals(expected, actual,.0001);
|
|
76
|
+ }
|
|
77
|
+
|
|
78
|
+ @Test
|
|
79
|
+ public void convertSingaporeToSwiss(){
|
|
80
|
+ CurrencyConverter conv = new CurrencyConverter();
|
|
81
|
+ double actual = conv.convert("sd","sf",1);
|
|
82
|
+ double expected = .70629370;
|
|
83
|
+ Assert.assertEquals(expected, actual,.0001);
|
|
84
|
+ }
|
|
85
|
+
|
|
86
|
+ @Test
|
|
87
|
+ public void convertSwissToMalaysian(){
|
|
88
|
+ CurrencyConverter conv = new CurrencyConverter();
|
|
89
|
+ double actual = conv.convert("sf","mr",1);
|
|
90
|
+ double expected = 4.4257425;
|
|
91
|
+ Assert.assertEquals(expected, actual,.0001);
|
|
92
|
+ }
|
|
93
|
+
|
|
94
|
+ @Test
|
|
95
|
+ public void convertMalaysianToYen(){
|
|
96
|
+ CurrencyConverter conv = new CurrencyConverter();
|
|
97
|
+ double actual = conv.convert("mr","jy",1);
|
|
98
|
+ double expected = 25.9149888;
|
|
99
|
+ Assert.assertEquals(expected, actual,.0001);
|
|
100
|
+ }
|
|
101
|
+
|
|
102
|
+ @Test
|
|
103
|
+ public void convertYenToYuan(){
|
|
104
|
+ CurrencyConverter conv = new CurrencyConverter();
|
|
105
|
+ double actual = conv.convert("jy","cy",1);
|
|
106
|
+ double expected = .05973756;
|
|
107
|
+ Assert.assertEquals(expected, actual,.0001);
|
|
108
|
+ }
|
|
109
|
+}
|