Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //CurrencyTreatmentTest.java - For JUnit test
- package il.ac.hit.currencies;
- import org.junit.*;
- import static org.junit.Assert.*;
- /**
- * Created by Yossi and Lior on 20/05/2015.
- */
- public class CurrencyTreatmentTest {
- private static CurrencyTreatment ct;
- private String[] curreciesNames = { "USD", "GBP", "JPY", "EUR", "AUD", "CAD", "DKK"
- , "NOK","ZAR", "SEK","CHF", "JOD", "LBP", "EGP" };
- private double[] curreciesRate = { 3.467, 5.7844, 3.38, 4.6363, 3.2329, 3.1813, 0.6219,
- 0.5631, 0.3288, 0.5057, 3.8266, 4.8989, 0.0230, 0.4848 };
- @Before
- public void setUp() throws Exception {
- }
- @After
- public void tearDown() throws Exception {
- }
- @BeforeClass
- public static void setUpBeforeClass() throws Exception {
- ct = new CurrencyTreatment();
- }
- @AfterClass
- public static void tearDownAfterClass() throws Exception {
- ct = null;
- }
- @Test
- public void testConvert() throws Exception {
- double expected = 2.400230769230769;
- double actual = ct.convert("2.34", 0, 2, curreciesRate);
- double delta = 0.05;
- assertEquals(expected, actual, delta); // first check
- expected = 11.168492796134931; // second check
- actual = ct.convert("15.32", 2, 3, curreciesRate);
- assertEquals(expected, actual, delta);
- }
- }
- //end of CurrencyTreatmentTest
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement