123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
-
- import org.junit.Assert;
- import org.junit.Test;
-
- public class CurrencyConverterTest {
- @Test
- public void firstCurrTest(){
- CurrencyConverter conv = new CurrencyConverter();
- double actual = conv.firstCurr("jy");
- double expected = 115.84;
- Assert.assertEquals(expected, actual,.0001);
- }
-
- @Test
- public void getCurrency2test(){
- CurrencyConverter conv = new CurrencyConverter();
- double actual = conv.secCurr("sd");
- double expected = 1.43;
- Assert.assertEquals(expected, actual,.0001);
- }
-
- @Test
- public void convertTest1(){
- CurrencyConverter conv = new CurrencyConverter();
- double actual = conv.convert("us","jy",1);
- double expected = 115.84;
- Assert.assertEquals(expected, actual,.0001);
- }
-
- @Test
- public void convertDollarToEuro(){
- CurrencyConverter conv = new CurrencyConverter();
- double actual = conv.convert("us","eu",1);
- double expected = .94;
- Assert.assertEquals(expected, actual,.0001);
- }
-
- @Test
- public void convertEuroToDollar(){
- CurrencyConverter conv = new CurrencyConverter();
- double actual = conv.convert("eu","us",1);
- double expected = 1.063829;
- Assert.assertEquals(expected, actual,.0001);
- }
-
- @Test
- public void convertEuroToBritishPound(){
- CurrencyConverter conv = new CurrencyConverter();
- double actual = conv.convert("eu","bp",1);
- double expected = .8723404;
- Assert.assertEquals(expected, actual,.0001);
- }
-
- @Test
- public void convertBritishPoundToIndianRupee(){
- CurrencyConverter conv = new CurrencyConverter();
- double actual = conv.convert("bp","ir",1);
- double expected = 83.31707;
- Assert.assertEquals(expected, actual,.0001);
- }
-
- @Test
- public void convertRupeetoCanadian(){
- CurrencyConverter conv = new CurrencyConverter();
- double actual = conv.convert("ir","cd",1);
- double expected = .01932084;
- Assert.assertEquals(expected, actual,.0001);
- }
-
- @Test
- public void convertCanadianToSingapore(){
- CurrencyConverter conv = new CurrencyConverter();
- double actual = conv.convert("cd","sd",1);
- double expected = 1.0833333333;
- Assert.assertEquals(expected, actual,.0001);
- }
-
- @Test
- public void convertSingaporeToSwiss(){
- CurrencyConverter conv = new CurrencyConverter();
- double actual = conv.convert("sd","sf",1);
- double expected = .70629370;
- Assert.assertEquals(expected, actual,.0001);
- }
-
- @Test
- public void convertSwissToMalaysian(){
- CurrencyConverter conv = new CurrencyConverter();
- double actual = conv.convert("sf","mr",1);
- double expected = 4.4257425;
- Assert.assertEquals(expected, actual,.0001);
- }
-
- @Test
- public void convertMalaysianToYen(){
- CurrencyConverter conv = new CurrencyConverter();
- double actual = conv.convert("mr","jy",1);
- double expected = 25.9149888;
- Assert.assertEquals(expected, actual,.0001);
- }
-
- @Test
- public void convertYenToYuan(){
- CurrencyConverter conv = new CurrencyConverter();
- double actual = conv.convert("jy","cy",1);
- double expected = .05973756;
- Assert.assertEquals(expected, actual,.0001);
- }
- }
|