aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/edu/brown/cs
diff options
context:
space:
mode:
authorclarkohw <clark_oh-willeke@brown.edu>2021-04-20 01:09:22 -0400
committerclarkohw <clark_oh-willeke@brown.edu>2021-04-20 01:09:22 -0400
commit0e49b69064b724b9b6bd1d7da08ab3b23fef720c (patch)
treedf3de18dc3748f8f1baf024aa4d1d6056b8b0ef0 /src/test/java/edu/brown/cs
parentbd050926124a6eceaf17ab8426ee734c6148352f (diff)
search by holder id
Diffstat (limited to 'src/test/java/edu/brown/cs')
-rw-r--r--src/test/java/edu/brown/cs/student/ProfitCalculationTest.java16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/test/java/edu/brown/cs/student/ProfitCalculationTest.java b/src/test/java/edu/brown/cs/student/ProfitCalculationTest.java
index 0d22109..fcb0de4 100644
--- a/src/test/java/edu/brown/cs/student/ProfitCalculationTest.java
+++ b/src/test/java/edu/brown/cs/student/ProfitCalculationTest.java
@@ -56,7 +56,7 @@ public class ProfitCalculationTest {
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();
+ List<StockHolding> trade = profitCalculation.getHoldingsList(-1);
//buy with no sell
assertEquals(trade.get(0).getUnrealizedGain(), 3842.25, .25);
assertEquals(trade.get(0).getRealizedGain(), 0, .01);
@@ -65,9 +65,9 @@ public class ProfitCalculationTest {
profitCalculation =
new ProfitCalculation(DatabaseQuerier.getConn(), "SELL", new Date(1518010558000l),
new Date(1618698807000l));
- trade = profitCalculation.getHoldingsList();
+ trade = profitCalculation.getHoldingsList(-1);
assertTrue(trade.isEmpty());
- assertEquals(profitCalculation.calculateGainsSingle(), 0, 0.001);
+ assertEquals(profitCalculation.calculateGainsSingle(-1), 0, 0.001);
tearDown();
}
@@ -90,7 +90,7 @@ public class ProfitCalculationTest {
new Date(1518010558000l),
new Date(1715629591000l));
- assertEquals(profitCalculation.getHoldingsList().get(0).getRealizedGain(), 3750, 0.01);
+ assertEquals(profitCalculation.getHoldingsList(-1).get(0).getRealizedGain(), 3750, 0.01);
assertEquals(profitCalculation.getMoneyInput(), 3750, .01);
//left over holdings
@@ -99,7 +99,7 @@ public class ProfitCalculationTest {
new Date(1518010558000l),
new Date(1715629591000l));
- assertEquals(profitCalculation.getHoldingsList().get(0).getShares(), 25, .01);
+ assertEquals(profitCalculation.getHoldingsList(-1).get(0).getShares(), 25, .01);
tearDown();
}
@@ -124,21 +124,21 @@ public class ProfitCalculationTest {
new Date(1618698807000l));
assertEquals(profitCalculation.getProfitMap(), new HashMap<>());
- assertEquals(profitCalculation.getHoldingsList(), new LinkedList<>());
+ assertEquals(profitCalculation.getHoldingsList(-1), new LinkedList<>());
setUp();
//invalid person
profitCalculation =
new ProfitCalculation(DatabaseQuerier.getConn(), "1234", new Date(1518010558000l),
new Date(1618698807000l));
- assertEquals(profitCalculation.getHoldingsList(), new LinkedList<>());
+ assertEquals(profitCalculation.getHoldingsList(-1), new LinkedList<>());
//invalid stock ticker
profitCalculation =
new ProfitCalculation(DatabaseQuerier.getConn(), "invalidTicker", new Date(1518010558000l),
new Date(1618698807000l));
- assertTrue(profitCalculation.getHoldingsList().isEmpty());
+ assertTrue(profitCalculation.getHoldingsList(-1).isEmpty());
}
} \ No newline at end of file