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); } }