import org.junit.Test; import org.junit.Assert; public class CurrencyConverterTest { CurrencyConverter cc = new CurrencyConverter(); @Test public void dollarToEuroTest(){ //When double dollar = 10; //Expected double expected = 9.40; //Actual double actual = cc.dollarToEuro(dollar); Assert.assertEquals(expected, actual, 0.01); } @Test public void euroToDollarTest(){ //When double euro = 4.7; //Expected double expected = 4.1; //Actual double actual = cc.euroToDollar(euro); Assert.assertEquals(expected, actual, 1); } @Test public void euroToBritishPoundTest(){ //When double euro = 4.7; //Expected double expected = 4.1; //Actual double actual = cc.euroToBritishPound(euro); Assert.assertEquals(expected, actual, 1); } @Test public void britishPoundToIndianRupeeTest(){ //When double britishPound = .82; //Expected double expected = 56.02; //Actual double actual = cc.britishPoundToIndianRupee(britishPound); Assert.assertEquals(expected, actual, 0.01); } @Test public void rupeeToCanadianDollarTest(){ //When double rupee = 68.32; //Expected double expected = 90.18; //Actual double actual = cc.rupeeToCanadianDollar(rupee); Assert.assertEquals(expected, actual, 0.01); } @Test public void canadianDollarToSingaporeDollarTest(){ //When double canadianDollar = 1.32; //Expected double expected = 1.88; //Actual double actual = cc.canadianDollarToSingaporeDollar(canadianDollar); Assert.assertEquals(expected, actual, 0.01); } @Test public void singaporeDollarToSwissFrancTest(){ //When double singaporeDollar = 1.32; //Expected double expected = 1.44; //Actual double actual = cc.singaporeDollarToSwissFranc(singaporeDollar); Assert.assertEquals(expected, actual, 1); } @Test public void swissFrancToMalaysianRinggitTest(){ //When double swissFranc = 1.01; //Expected double expected = 4.51; //Actual double actual = cc.swissFrancToMalaysianRinggit(swissFranc); Assert.assertEquals(expected, actual, 1); } @Test public void malaysianRinggitToJapaneseYenTest(){ //When double malaysianRinggit = 4.47; //Expected double expected = 517.80; //Actual double actual = cc.malaysianRinggitToJapaneseYen(malaysianRinggit); Assert.assertEquals(expected, actual, 1); } @Test public void japaneseYenToChineseYuanRenminbiTest(){ //When double japaneseYen = 115.84; //Expected double expected = 1078.41; //Actual double actual = cc.japaneseYenToChineseYuanRenminbi(japaneseYen); Assert.assertEquals(expected, actual, 300); } }