aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/edu/brown/cs/student/ProfitCalculationTest.java
diff options
context:
space:
mode:
authorJulia McCauley <skurvyj@gmail.com>2021-04-20 11:29:24 -0400
committerJulia McCauley <skurvyj@gmail.com>2021-04-20 11:29:24 -0400
commit0f86bfc8182dd6b8559f352ebad7ff5ea8db8c73 (patch)
tree385c86356e7f95058c72aaa1f1fbbe6abe492c6d /src/test/java/edu/brown/cs/student/ProfitCalculationTest.java
parent8535db483bd2a153013976a0ad540d00707405ba (diff)
parent3910a31e5418343e427305bb0b77cf5ec3e2dfbf (diff)
Merge branch 'master' of github.com:cs0320-2021/term-project-cohwille-jmccaul3-mfoiani-rhunt2
# Conflicts: # react-frontend/src/components/Visualization.js
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