File pageDirectory = addPageDirectory("TestPage");
addTestResult(pageDirectory, "20090503110451_6_5_3_1");
addTestResult(pageDirectory, "20090418123103_1_2_3_4");
history.readHistoryDirectory(resultsDirectory);
PageHistory pageHistory = history.getPageHistory("TestPage");
assertEquals(2, pageHistory.size());
assertEquals(12, pageHistory.maxAssertions());
SortedSet<Date> dates = pageHistory.datesInChronologicalOrder();
assertEquals(2, dates.size());
Date date1 = dateFormat.parse("20090418123103");
Date date2 = dateFormat.parse("20090503110451");
Date[] dateArray = dates.toArray(new Date[dates.size()]);
assertEquals(date1, dateArray[1]);
assertEquals(date2, dateArray[0]);
PageHistory.PassFailBar passFailBar = pageHistory.getPassFailBar(date1, 50);
assertEquals(1, passFailBar.getPass());
assertEquals(6, passFailBar.getFail());
assertEquals(4, passFailBar.getPassUnits());
assertEquals(25, passFailBar.getFailUnits());
passFailBar = pageHistory.getPassFailBar(date2, 50);
assertEquals(6, passFailBar.getPass());
assertEquals(6, passFailBar.getFail());
assertEquals(25, passFailBar.getPassUnits());
assertEquals(25, passFailBar.getFailUnits());
}