public void checkQuarterly(PropertyBook propertyBook, List<Annotation> annotationsExpectedToBeUsedInQuarterly) {
QuarterlyReportViewModel quarterlyReportViewModel = new QuarterlyReportViewModel();
quarterlyReportViewModel.updateBookSelection(BookSelection
.fromBook(propertyBook));
quarterlyReportViewModel.setQuarterlyReportYear(2012);
AnnotationDateQuarterlyGroupingModel quarterlyGroupingModel = quarterlyReportViewModel
.getAnnotationsDateQuarterlyGroupingModel();
Integer numberOfGroups = quarterlyGroupingModel.getGroupCount();
// we expect 1 quarter (all the annotations are in the first quarter)
Assert.assertEquals(new Integer(1), numberOfGroups);
for (Integer currentQuarter = 0; currentQuarter < numberOfGroups; currentQuarter++) {
List<Annotation> annotationsForQuarter = new LinkedList<Annotation>();
for (Integer annotationIndex = 0; annotationIndex < quarterlyGroupingModel
.getChildCount(currentQuarter); annotationIndex++) {
Annotation currentAnnotation = quarterlyGroupingModel.getChild(currentQuarter, annotationIndex);
annotationsForQuarter.add(currentAnnotation);
}
Assert.assertEquals(new Integer(annotationsExpectedToBeUsedInQuarterly.size()), new Integer(annotationsForQuarter.size()));
Assert.assertTrue(annotationsForQuarter.containsAll(annotationsExpectedToBeUsedInQuarterly));
QuarterlyHaciendaResults haciendaResults = QuarterlyHaciendaResults.compute(annotationsForQuarter.toArray(new Annotation[0]));