aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/edu/brown/cs/student/ProfitCalculationTest.java
diff options
context:
space:
mode:
authorJulia McCauley <skurvyj@gmail.com>2021-04-16 13:14:36 -0400
committerJulia McCauley <skurvyj@gmail.com>2021-04-16 13:14:36 -0400
commitb8279f5498ac7189690b4b85d1d68edb63df3185 (patch)
tree14d57eccf7fa09d3cb88e1720cda4c7710252605 /src/test/java/edu/brown/cs/student/ProfitCalculationTest.java
parent033eba394d9df4fb0ac6d76f2660dc8f2251b2b8 (diff)
parent12ebe0f16988daf87391f99f681a3e89b985d8c2 (diff)
Merge branch 'master' of github.com:cs0320-2021/term-project-cohwille-jmccaul3-mfoiani-rhunt2 into fronend-dev
# Conflicts: # src/main/java/edu/brown/cs/student/term/Main.java
Diffstat (limited to 'src/test/java/edu/brown/cs/student/ProfitCalculationTest.java')
-rw-r--r--src/test/java/edu/brown/cs/student/ProfitCalculationTest.java56
1 files changed, 56 insertions, 0 deletions
diff --git a/src/test/java/edu/brown/cs/student/ProfitCalculationTest.java b/src/test/java/edu/brown/cs/student/ProfitCalculationTest.java
new file mode 100644
index 0000000..99500d0
--- /dev/null
+++ b/src/test/java/edu/brown/cs/student/ProfitCalculationTest.java
@@ -0,0 +1,56 @@
+package edu.brown.cs.student;
+
+import edu.brown.cs.student.term.DatabaseQuerier;
+import edu.brown.cs.student.term.hub.Holder;
+import edu.brown.cs.student.term.hub.HubSearch;
+import edu.brown.cs.student.term.hub.LinkMapper;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.time.Instant;
+import java.util.Map;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+public class ProfitCalculationTest {
+
+ /** these should span the entire mock dataset */
+ //12 am on 3/11 in UTC
+ private Instant start = Instant.parse("2021-03-11T05:00:00.00Z");
+ //12 am on 3/28 in UTC
+ private Instant end = Instant.parse("2021-03-28T05:00:00.00Z");
+
+ private DatabaseQuerier db;
+
+ @Before
+ public void setUp() {
+ try{
+ db = new DatabaseQuerier("data/lil_mock.sqlite3");
+ } catch(Exception e){
+ System.out.println("DBQuerier Test, couldn't connect to db???");
+ }
+ }
+
+ @After
+ public void tearDown() {
+ db = null;
+ }
+
+ @Test
+ public void testEmptyDB(){
+ try{
+ db = new DatabaseQuerier("data/empty.sqlite3");
+ } catch(Exception e){
+ System.out.println("DBQuerier Test, couldn't connect to db???");
+ }
+ LinkMapper lm = new LinkMapper(db);
+ HubSearch hub = new HubSearch(lm);
+ Map<Holder, Double> hubRanks = hub.runHubSearch(start, end);
+ assertTrue(hubRanks.isEmpty());
+ tearDown();
+ }
+
+
+} \ No newline at end of file