diff options
author | Julia McCauley <skurvyj@gmail.com> | 2021-04-16 12:30:18 -0400 |
---|---|---|
committer | Julia McCauley <skurvyj@gmail.com> | 2021-04-16 12:30:18 -0400 |
commit | 7cec7d66f19f8da453c330fe92e8ce9bef5b6753 (patch) | |
tree | f196507f446ab39512f861db97f136228854733d /src/test/java/edu/brown/cs/student/ProfitCalculationTest.java | |
parent | 6feeaca9f4c12ee90bbf86fe21a45b64cfc4983d (diff) | |
parent | da1475f7e264fcd5902eb7bfd8482e64c1327fde (diff) |
need to pull changes from master Merge branch 'master' of github.com:cs0320-2021/term-project-cohwille-jmccaul3-mfoiani-rhunt2
Diffstat (limited to 'src/test/java/edu/brown/cs/student/ProfitCalculationTest.java')
-rw-r--r-- | src/test/java/edu/brown/cs/student/ProfitCalculationTest.java | 56 |
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 |