-
Notifications
You must be signed in to change notification settings - Fork 105
Expand file tree
/
Copy pathCurrencyConverterTest.java
More file actions
104 lines (81 loc) · 2.98 KB
/
CurrencyConverterTest.java
File metadata and controls
104 lines (81 loc) · 2.98 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import java.util.TreeMap;
public class CurrencyConverterTest {
CurrencyConverter converter;
@Before
public void Setup() {
converter = new CurrencyConverter();
}
@Test
public void testDollarToEuro() {
double expected = 1128.00;
double actual = converter.convertCurrentToDestinationCurrency(
"Us Dollar", "Euro", 1200);
Assert.assertEquals(expected, actual,.01 );
}
@Test
public void testEuroToDollar() {
double expected = 2180.85;
double actual = converter.convertCurrentToDestinationCurrency(
"Euro", "Us Dollar", 2050);
Assert.assertEquals(expected, actual,.01 );
}
@Test
public void testEuroToBritishPound() {
double expected = 283.51;
double actual = converter.convertCurrentToDestinationCurrency(
"Euro", "British Pound", 325);
Assert.assertEquals(expected, actual,.01 );
}
@Test
public void testBritishPoundToIndianRupee() {
double expected = 185797.07;
double actual = converter.convertCurrentToDestinationCurrency(
"British Pound", "Indian Rupee", 2230);
Assert.assertEquals(expected, actual,.01 );
}
@Test
public void testRupeeToCanadianDollar() {
double expected = 96.60;
double actual = converter.convertCurrentToDestinationCurrency(
"Indian Rupee", "Canadian Dollar", 5000);
Assert.assertEquals(expected, actual,.01 );
}
@Test
public void testCanadianDollarToSingaporeDollar() {
double expected = 59.58;
double actual = converter.convertCurrentToDestinationCurrency(
"Canadian Dollar", "Singapore Dollar", 55);
Assert.assertEquals(expected, actual,.01 );
}
@Test
public void testSingaporeDollarToSwissFranc() {
double expected = 234.49;
double actual = converter.convertCurrentToDestinationCurrency(
"Singapore Dollar", "Swiss Franc", 332);
Assert.assertEquals(expected, actual,.01 );
}
@Test
public void testSwissFrancToMalaysianRinggit() {
double expected = 5421.53;
double actual = converter.convertCurrentToDestinationCurrency(
"Swiss Franc", "Malaysian Ringgit", 1225);
Assert.assertEquals(expected, actual, .01);
}
@Test
public void testMalaysianRinggitToJapaneseYen() {
double expected = 8292.79;
double actual = converter.convertCurrentToDestinationCurrency(
"Malaysian Ringgit", "Japanese Yen", 320);
Assert.assertEquals(expected, actual,.01 );
}
@Test
public void testJapaneseYenToChineseYuanRenminbi() {
double expected = 7320.84;
double actual = converter.convertCurrentToDestinationCurrency(
"Japanese Yen", "Chinese Yuan Renminbi", 122550);
Assert.assertEquals(expected, actual,.01 );
}
}