aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/edu/brown/cs
diff options
context:
space:
mode:
authorclarkohw <clark_oh-willeke@brown.edu>2021-04-19 02:20:36 -0400
committerclarkohw <clark_oh-willeke@brown.edu>2021-04-19 02:20:36 -0400
commit26827e5631cc7c0d5d24fa5459a6abbe9e4c60a5 (patch)
tree26fa5ec9799e0b157c0bd58091e536aff16989db /src/test/java/edu/brown/cs
parent61ad5896d35c1d49a4a5d9c1d8d87f53907f7da7 (diff)
simple test
Diffstat (limited to 'src/test/java/edu/brown/cs')
-rw-r--r--src/test/java/edu/brown/cs/student/ProfitCalculationTest.java14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/test/java/edu/brown/cs/student/ProfitCalculationTest.java b/src/test/java/edu/brown/cs/student/ProfitCalculationTest.java
index 974fff0..d1fc9be 100644
--- a/src/test/java/edu/brown/cs/student/ProfitCalculationTest.java
+++ b/src/test/java/edu/brown/cs/student/ProfitCalculationTest.java
@@ -35,7 +35,7 @@ public class ProfitCalculationTest {
@Before
public void setUp() {
try {
- db = new DatabaseQuerier("data/trades.sqlite3");
+ db = new DatabaseQuerier("data/lil_mock.sqlite3");
} catch (Exception e) {
System.out.println("DBQuerier Test, couldn't connect to db???");
}
@@ -47,17 +47,17 @@ public class ProfitCalculationTest {
}
@Test
- public void testEmptyDB() {
+ public void testBasicTrades() {
setUp();
ProfitCalculation profitCalculation =
- new ProfitCalculation(DatabaseQuerier.getConn(), "CAKEBREAD STEVEN", new Date(1518010558000l),
- new Date(1718010556000l));
+ new ProfitCalculation(DatabaseQuerier.getConn(), "Don", new Date(1518010558000l),
+ new Date(1618698807000l));
+ //price of GME at end time is 154.69
List<StockHolding> trade = profitCalculation.getHoldingsList();
- double gain = trade.get(0).getUnrealizedGain();
- assertEquals(294800.0, gain, .01);
+ //buy with no sell
+ assertEquals(3842.25, trade.get(0).getUnrealizedGain(),6);
}
-
} \ No newline at end of file