parent
30ea1ec59c
commit
202ee6e220
@ -0,0 +1,39 @@
|
||||
package data;
|
||||
|
||||
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 DataSourceTest {
|
||||
private StockType testStype;
|
||||
private DataSource testSource;
|
||||
|
||||
@BeforeEach
|
||||
public void runBefore() {
|
||||
testStype = StypeMap.getStype("NYSE");
|
||||
testSource = new DataSource("Test Source", "asdf://asdfasdf",
|
||||
"asdfasdfasdf", "asdfasdf");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAddDel() {
|
||||
testStype.addSource(testSource);
|
||||
testSource.delStype(testStype);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEqualsHash() {
|
||||
DataSource testSource2 = new DataSource("Test Source", "asdf://asdfasdf",
|
||||
"asdfasdfasdf", "asdfasdf");
|
||||
DataSource testSource3 = new DataSource("Test asdf", "asdf://asdfasdf",
|
||||
"asdfasdfasdf", "asdfasdf");
|
||||
String asdf = "asdf";
|
||||
assertEquals(testSource, testSource2);
|
||||
assertFalse(testSource.equals(testSource3));
|
||||
assertFalse(testSource.equals(asdf));
|
||||
assertEquals(testSource.hashCode(), testSource2.hashCode());
|
||||
assertFalse(testSource.hashCode() == testSource3.hashCode());
|
||||
}
|
||||
}
|
||||
Loading…
Reference in new issue