Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Submitted by Dima Yankovoy 311868442 & Snir Yacoby 201561933
- package il.ac.hit.project.model;
- import junit.framework.TestCase;
- import org.junit.After;
- import org.junit.Before;
- import org.junit.Test;
- import java.text.DecimalFormat;
- /**
- * The JUnit tests for methods of class Currencies.
- */
- public class CurrenciesTest extends TestCase {
- Currencies ob;
- @Before
- public void setUp() throws Exception {
- ob = new Currencies();
- ob.importXML();
- ob.readFromFile();
- }
- @After
- public void tearDown() throws Exception {
- }
- @Test
- public void testGetLastUpdate() throws Exception {
- assertNotNull(ob.getLastUpdate());
- }
- @Test
- public void testGetData() throws Exception {
- assertNotNull(ob.getData());
- assertTrue(ob.getData().length == 14);
- }
- @Test
- public void testConvert() throws Exception {
- Double USD = Double.parseDouble(ob.getData()[0][3]);
- Double GBP = Double.parseDouble(ob.getData()[1][3]);
- Double result = Double.parseDouble(ob.convert("100",0,1));
- assertEquals("100", new DecimalFormat("##.##").format(result * GBP / USD) );
- }
- @Test
- public void testGetStatus() throws Exception {
- assertNotNull(ob.getStatus());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement