aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/edu/brown/cs/student/ProfitCalculationTest.java
diff options
context:
space:
mode:
authorMichael Foiani <sotech117@michaels-mbp-3.lan>2021-04-20 01:16:13 -0400
committerMichael Foiani <sotech117@michaels-mbp-3.lan>2021-04-20 01:16:13 -0400
commita27719a709dd3082850f00f25e1275233807209d (patch)
treea8c8bfb6e3b70c504c536b2039bb7b624afb69c3 /src/test/java/edu/brown/cs/student/ProfitCalculationTest.java
parentea432d2c59a1ef65343f2085bf4b02bd1937abcf (diff)
parent8995968596c3a5c3ffd7b5d245d669f4efe2f491 (diff)
Merge branch 'master' of https://github.com/cs0320-2021/term-project-cohwille-jmccaul3-mfoiani-rhunt2
Merging new id backend with the frontned that has a search feature.
Diffstat (limited to 'src/test/java/edu/brown/cs/student/ProfitCalculationTest.java')
-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