Added a bit more test

workbranch
asdfasdf 6 years ago
parent 6b4cd4ebc9
commit 88e46f3b41

@ -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.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.assertTrue;
import network.AlphaVantage; import network.AlphaVantage;
import java.io.IOException;
public class DataSourceTest { public class DataSourceTest {
private StockType testStype; private StockType testStype;
@ -21,14 +22,24 @@ public class DataSourceTest {
public void testAddDel() { public void testAddDel() {
testStype.addSource(testSource); testStype.addSource(testSource);
testSource.delStype(testStype); testSource.delStype(testStype);
testSource.delStype(testStype);
} }
@Test @Test
public void testEqualsHash() { public void testEqualsHash() {
DataSource testSource2 = new AlphaVantage(); 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"; String asdf = "asdf";
assertEquals(testSource, testSource);
assertEquals(testSource, testSource2); assertEquals(testSource, testSource2);
assertFalse(testSource.equals(asdf)); assertFalse(testSource.equals(asdf));
assertFalse(testSource.equals(testSource3));
assertEquals(testSource.hashCode(), testSource2.hashCode()); assertEquals(testSource.hashCode(), testSource2.hashCode());
} }
} }

Loading…
Cancel
Save