|
|
|
|
@ -6,6 +6,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
|
|
|
|
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
|
|
|
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
|
|
|
|
import network.AlphaVantage;
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
|
|
|
|
|
public class DataSourceTest {
|
|
|
|
|
private StockType testStype;
|
|
|
|
|
@ -21,14 +22,24 @@ public class DataSourceTest {
|
|
|
|
|
public void testAddDel() {
|
|
|
|
|
testStype.addSource(testSource);
|
|
|
|
|
testSource.delStype(testStype);
|
|
|
|
|
testSource.delStype(testStype);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void testEqualsHash() {
|
|
|
|
|
DataSource testSource2 = new AlphaVantage();
|
|
|
|
|
DataSource testSource3 = new DataSource("test source", "asdf", "asdf") {
|
|
|
|
|
@Override
|
|
|
|
|
public double[] update(String asdf, String asdf2) throws IOException {
|
|
|
|
|
double[] asdfjkl = {0.0, 0.0};
|
|
|
|
|
return asdfjkl;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
String asdf = "asdf";
|
|
|
|
|
assertEquals(testSource, testSource);
|
|
|
|
|
assertEquals(testSource, testSource2);
|
|
|
|
|
assertFalse(testSource.equals(asdf));
|
|
|
|
|
assertFalse(testSource.equals(testSource3));
|
|
|
|
|
assertEquals(testSource.hashCode(), testSource2.hashCode());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|