Added (non-integrated yet) StockType

deliverable_5
asdfasdf 6 years ago
parent e6eef8899f
commit 1810409047

@ -0,0 +1,11 @@
package data;
import java.util.*;
import data.StockType;
public class Nasdaq extends StockType {
public Nasdaq() {
super();
name = "NASDAQ";
}
}

@ -3,7 +3,7 @@ package data;
import java.util.*;
public abstract class StockType {
protected static String name;
protected String name;
protected HashSet sources;
// Sources is empty

@ -6,7 +6,7 @@ import java.util.HashMap;
import java.util.Iterator;
import data.StockType;
import data.Nyse;
//import data.Nasdaq;
import data.Nasdaq;
//import data.Jpx;
//import data.Sse;
//import data.Hkse;
@ -21,7 +21,7 @@ public class StypeMap {
public StypeMap() {
smap = new HashMap<String, StockType>();
smap.put("Nyse", new Nyse());
//smap.put("Nasdaq", new Nasdaq());
smap.put("Nasdaq", new Nasdaq());
//smap.put("Jpx", new Jpx());
//smap.put("Sse", new Sse());
//smap.put("Hkse", new Hkse());

@ -0,0 +1,24 @@
import data.StypeMap;
import data.StockType;
import data.Nasdaq;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
public class NasdaqTest {
private StypeMap smap;
private StockType naasdaq;
@BeforeEach
public void runBefore() {
smap = new StypeMap();
naasdaq = smap.getStype("Nasdaq");
}
@Test
public void testName() {
assertTrue(naasdaq.getName().equals("NASDAQ"));
}
}

@ -0,0 +1,24 @@
import data.StypeMap;
import data.StockType;
import data.Nyse;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
public class NyseTest {
private StypeMap smap;
private StockType nyyyse;
@BeforeEach
public void runBefore() {
smap = new StypeMap();
nyyyse = smap.getStype("Nyse");
}
@Test
public void testName() {
assertTrue(nyyyse.getName().equals("NYSE"));
}
}
Loading…
Cancel
Save