CurrencyConverterTest.java 2.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. import static org.junit.Assert.assertEquals;
  2. import org.junit.Test;
  3. public class CurrencyConverterTest {
  4. @Test
  5. public void TestDollarToEuro(){
  6. CurrencyConverter currencyConverter = new CurrencyConverter();
  7. double dollars = 5;
  8. String expected = "4.70";
  9. String actual = currencyConverter.dollarToEuro(5);
  10. assertEquals(expected, actual);
  11. }
  12. @Test
  13. public void TestEuroToDollar(){
  14. CurrencyConverter currencyConverter = new CurrencyConverter();
  15. double euros = 5;
  16. String expected = "5.32";
  17. String actual = currencyConverter.euroToDollar(5);
  18. assertEquals(expected, actual);
  19. }
  20. @Test
  21. public void TestEuroToPound(){
  22. CurrencyConverter currencyConverter = new CurrencyConverter();
  23. double euros = 5;
  24. String expected = "4.10";
  25. String actual = currencyConverter.euroToPound(5);
  26. assertEquals(expected, actual);
  27. }
  28. @Test
  29. public void TestPoundToRupee(){
  30. CurrencyConverter currencyConverter = new CurrencyConverter();
  31. double pounds = 5;
  32. String expected = "341.60";
  33. String actual = currencyConverter.poundToRupee(5);
  34. assertEquals(expected, actual);
  35. }
  36. @Test
  37. public void TestRupeeToCanadian(){
  38. CurrencyConverter currencyConverter = new CurrencyConverter();
  39. double rupess = 500;
  40. String expected = "9.75";
  41. String actual = currencyConverter.rupeeToCanadian(500);
  42. assertEquals(expected, actual);
  43. }
  44. @Test
  45. public void TestCanadianToSingapore(){
  46. CurrencyConverter currencyConverter = new CurrencyConverter();
  47. double cds = 5;
  48. String expected = "7.15";
  49. String actual = currencyConverter.canadianToSingapore(5);
  50. assertEquals(expected, actual);
  51. }
  52. @Test
  53. public void TestSingaporeToSwiss(){
  54. CurrencyConverter currencyConverter = new CurrencyConverter();
  55. double singapore = 5;
  56. String expected = "5.05";
  57. String actual = currencyConverter.singaporeToSwiss(5);
  58. assertEquals(expected, actual);
  59. }
  60. @Test
  61. public void TestSwissToRinggit(){
  62. CurrencyConverter currencyConverter = new CurrencyConverter();
  63. double swiss = 5;
  64. String expected = "22.35";
  65. String actual = currencyConverter.swissToRinggit(5);
  66. assertEquals(expected, actual);
  67. }
  68. @Test
  69. public void TestRinggitToYen(){
  70. CurrencyConverter currencyConverter = new CurrencyConverter();
  71. double ringgit = 5;
  72. String expected = "579.20";
  73. String actual = currencyConverter.ringgitToYen(5);
  74. assertEquals(expected, actual);
  75. }
  76. @Test
  77. public void TestYenToYuan(){
  78. CurrencyConverter currencyConverter = new CurrencyConverter();
  79. double yen = 500;
  80. String expected = "29.50";
  81. String actual = currencyConverter.yenToYuan(500);
  82. assertEquals(expected, actual);
  83. }
  84. }