1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
-
-
- import org.junit.Test;
- import static org.junit.Assert.*;
-
- import java.util.HashMap;
-
- public class CurrencyConverterTest {
- CurrencyConverter cc = new CurrencyConverter();
-
- @Test
- public void dollarToEuro() {
- double result = cc.convertTo("USD", "EUR", 2);
- assertEquals(result, 1.88, 0.02);
- }
-
- @Test
- public void euroToDollar() {
- double result = cc.convertTo("EUR", "USD", 2);
- assertEquals(result, 2.12, 0.02);
- }
-
- @Test
- public void euroToPound() {
- double result = cc.convertTo("EUR", "GBP", 2);
- assertEquals(result, 1.74, 0.02);
- }
-
- @Test
- public void poundToRupee() {
- double result = cc.convertTo("GBP", "INR", 2);
- assertEquals(result, 166.63, 0.02);
- }
-
- @Test
- public void rupeeToKanadia() {
- double result = cc.convertTo("INR", "CAN", 2);
- assertEquals(result, 180.36, 0.02);
- }
-
- @Test
- public void kanadiaToSingapore() {
- double result = cc.convertTo("CAN", "SGD", 2);
- assertEquals(result, 3.77, 0.02);
- }
-
- @Test
- public void singaporeToFranc() {
- double result = cc.convertTo("SGD", "CHF", 2);
- assertEquals(result, 2.88, 0.02);
- }
-
- @Test
- public void francToMeley() {
- double result = cc.convertTo("CHF", "MYR", 2);
- assertEquals(result, 2.04, 0.02);
- }
-
- @Test
- public void meleyToYen() {
- double result = cc.convertTo("MYR", "YEN", 2);
- assertEquals(result, 2.04, 0.02);
- }
-
- @Test
- public void yenToChina() {
- double result = cc.convertTo("YEN", "CNY", 2);
- assertEquals(result, 13.97, 0.02);
- }
- }
|