123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151 |
-
-
- import static org.junit.Assert.*;
- import org.junit.After;
- import org.junit.Before;
- import org.junit.Test;
-
- /**
- * The test class CurrencyConverterTest.
- *
- * @author (your name)
- * @version (a version number or a date)
- */
- public class CurrencyConverterTest
- {
- CurrencyConverter curr;
-
- /**
- * Default constructor for test class CurrencyConverterTest
- */
- public CurrencyConverterTest()
- {
- }
-
- /**
- * Sets up the test fixture.
- *
- * Called before every test case method.
- */
- @Before
- public void setUp()
- {curr = new CurrencyConverter();
- }
-
- /**
- * Tears down the test fixture.
- *
- * Called after every test case method.
- */
- @After
- public void tearDown()
- {
- }
- @Test
- public void convertTestUSDtoEURO(){
-
- float expected = (float)94.00;
-
- float actual = curr.convert((float)100,(float)(0.94),(float)1);
-
- assertEquals(expected,actual,0.1);
-
-
-
- }
- @Test
- public void convertTestEUROtoUSD(){
-
- float expected = (float)106.38;
-
- float actual = curr.convert((float)100,(float)1,(float)0.94);
-
- assertEquals(expected,actual,0.1);
-
-
-
- }
- @Test
- public void convertTestEUROtoGBP(){
-
- float expected = (float)114.63;
-
- float actual = curr.convert((float)100,(float)0.94,(float)0.82);
-
- assertEquals(expected,actual,0.1);
-
- }
- @Test
- public void convertTestGBPtoINR(){
-
- float expected = (float)8331.70;
-
- float actual = curr.convert((float)100,(float)68.32,(float)0.82);
-
- assertEquals(expected,actual,0.1);
-
- }
- @Test
- public void convertTestINRtoCAD(){
-
- float expected = (float)1.93;
-
- float actual = curr.convert((float)100,(float)1.32,(float)68.32);
-
- assertEquals(expected,actual,0.1);
-
- }
- @Test
- public void convertTestCADtoSWISS(){
-
- float expected = (float)76.51;
-
- float actual = curr.convert((float)100,(float)1.01,(float)1.32);
-
- assertEquals(expected,actual,0.1);
-
- }
-
-
- @Test
- public void convertTestSINGtoSWISS(){
-
- float expected = (float)141.58;
-
- float actual = curr.convert((float)100,(float)1.43,(float)1.01);
-
- assertEquals(expected,actual,0.1);
-
- }
- @Test
- public void convertTestSWIStoMALAY(){
-
- float expected = (float)442.57;
-
- float actual = curr.convert((float)100,(float)4.47,(float)1.01);
-
- assertEquals(expected,actual,0.1);
-
- }
- @Test
- public void convertTestMALAYtoJPY(){
-
- float expected = (float)2591.49;
-
- float actual = curr.convert((float)100,(float)115.84,(float)4.47);
-
- assertEquals(expected,actual,0.1);
-
- }
- @Test
- public void convertTestJPYtoCNY(){
-
- float expected = (float)5.97;
-
- float actual = curr.convert((float)100,(float)6.92,(float)115.84);
-
- assertEquals(expected,actual,0.1);
-
- }
- }
|