From 8e76bf15c53c540a72a273ec560a624dfb7e11df Mon Sep 17 00:00:00 2001 From: clarkohw Date: Mon, 19 Apr 2021 02:59:57 -0400 Subject: efficiency for profit calc + tests --- src/test/java/edu/brown/cs/student/ProfitCalculationTest.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/test/java') diff --git a/src/test/java/edu/brown/cs/student/ProfitCalculationTest.java b/src/test/java/edu/brown/cs/student/ProfitCalculationTest.java index d1fc9be..f435c7c 100644 --- a/src/test/java/edu/brown/cs/student/ProfitCalculationTest.java +++ b/src/test/java/edu/brown/cs/student/ProfitCalculationTest.java @@ -12,6 +12,7 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; +import java.time.LocalDate; import java.util.List; import java.sql.Date; import java.time.Instant; @@ -55,7 +56,14 @@ public class ProfitCalculationTest { //price of GME at end time is 154.69 List trade = profitCalculation.getHoldingsList(); //buy with no sell - assertEquals(3842.25, trade.get(0).getUnrealizedGain(),6); + assertEquals(trade.get(0).getUnrealizedGain(), 3842.25,.25); + assertEquals(trade.get(0).getRealizedGain(), 0, .01); + + + profitCalculation = new ProfitCalculation(DatabaseQuerier.getConn(), "Don", new Date(1618234200000l), + new Date(1618814264000l)); + + assertEquals(profitCalculation.compareToSP500(), .01464, .001); } -- cgit v1.2.3-70-g09d2