public void drawAll() { drawAll(null, null); }
public void drawAll() { drawAll(null, null); }
@Test public void testDrawAll() { displayerCoordinator.drawAll(); verify(listener, times(6)).onDraw(any(Displayer.class)); }
@Test public void testDrawAll() { displayerCoordinator.drawAll(); verify(listener, times(6)).onDraw(any(Displayer.class)); }
@Test public void testDrawAll() { displayerCoordinator.drawAll(); verify(listener, times(5)).onDataLookup(any(Displayer.class)); verify(listener, times(5)).onDraw(any(Displayer.class)); }
@Test public void testDrawAll() { displayerCoordinator.drawAll(); verify(listener, times(5)).onDataLookup(any(Displayer.class)); verify(listener, times(5)).onDraw(any(Displayer.class)); }
@Test public void testSelectedDropDownItems() { displayerCoordinator.drawAll(); // Select the first item on both drop down selectors when(dropDownItem.getId()).thenReturn(0); cityDropDownDisplayer.onItemSelected(dropDownItem); reset(dropDownItem); deptDropDownDisplayer.onItemSelected(dropDownItem); verify(dropDownItem).select(); } }
@Test public void testSelectedDropDownItems() { displayerCoordinator.drawAll(); // Select the first item on both drop down selectors when(dropDownItem.getId()).thenReturn(0); cityDropDownDisplayer.onItemSelected(dropDownItem); reset(dropDownItem); deptDropDownDisplayer.onItemSelected(dropDownItem); verify(dropDownItem).select(); } }
@Test public void testFilterPropagations() { displayerCoordinator.drawAll(); // Select the first year label (2009) reset(listener); when(labelItem.getId()).thenReturn(0); yearLabelDisplayer.onItemSelected(labelItem); // Check the allRowsDisplayer receives the filter request DataSet dataSet = allRowsDisplayer.getDataSetHandler().getLastDataSet(); assertEquals(dataSet.getRowCount(), 13); verify(listener).onDataLookup(allRowsDisplayer); verify(listener).onRedraw(allRowsDisplayer); } @Test
@Test public void testFilterPropagations() { displayerCoordinator.drawAll(); // Select the first year label (2009) reset(listener); when(labelItem.getId()).thenReturn(0); yearLabelDisplayer.onItemSelected(labelItem); // Check the allRowsDisplayer receives the filter request DataSet dataSet = allRowsDisplayer.getDataSetHandler().getLastDataSet(); assertEquals(dataSet.getRowCount(), 13); verify(listener).onDataLookup(allRowsDisplayer); verify(listener).onRedraw(allRowsDisplayer); } @Test
@Test public void testFilterPropagations() { displayerCoordinator.drawAll(); // Click on the "Engineering" slice reset(listener); deptPieChart.filterUpdate(COLUMN_DEPARTMENT, 0); // Check the allRowsTable receives the filter request DataSet dataSet = allRowsTable.getDataSetHandler().getLastDataSet(); assertEquals(dataSet.getRowCount(), 19); verify(listener).onDataLookup(allRowsTable); verify(listener).onRedraw(allRowsTable); }
@Test public void testFilterPropagations() { displayerCoordinator.drawAll(); // Click on the "Engineering" slice reset(listener); deptPieChart.filterUpdate(COLUMN_DEPARTMENT, 0); // Check the allRowsTable receives the filter request DataSet dataSet = allRowsTable.getDataSetHandler().getLastDataSet(); assertEquals(dataSet.getRowCount(), 19); verify(listener).onDataLookup(allRowsTable); verify(listener).onRedraw(allRowsTable); }
@Test public void testQuarterFilter() { displayerCoordinator.drawAll(); // Click on the "Q4" slice reset(listener); quarterPieChart.filterUpdate(COLUMN_DATE, 0); // Check the allRowsTable receives the filter request DataSet dataSet = allRowsTable.getDataSetHandler().getLastDataSet(); assertEquals(dataSet.getRowCount(), 10); for (int i = 0; i < dataSet.getRowCount(); i++) { Date d = (Date) dataSet.getValueAt(i, COLUMN_DATE); assertTrue(d.getMonth() > 8); } verify(listener).onDataLookup(allRowsTable); verify(listener).onRedraw(allRowsTable); }
@Test public void testYearFilter() { displayerCoordinator.drawAll(); // Click on the "2014" slice reset(listener); yearBarChart.filterUpdate(COLUMN_DATE, 2); // Check the allRowsTable receives the filter request DataSet dataSet = allRowsTable.getDataSetHandler().getLastDataSet(); assertEquals(dataSet.getRowCount(), 11); for (int i = 0; i < dataSet.getRowCount(); i++) { Date d = (Date) dataSet.getValueAt(i, COLUMN_DATE); assertEquals(d.getYear(), 114); } verify(listener).onDataLookup(allRowsTable); verify(listener).onRedraw(allRowsTable); }
@Test public void testQuarterFilter() { displayerCoordinator.drawAll(); // Click on the "Q4" slice reset(listener); quarterPieChart.filterUpdate(COLUMN_DATE, 0); // Check the allRowsTable receives the filter request DataSet dataSet = allRowsTable.getDataSetHandler().getLastDataSet(); assertEquals(dataSet.getRowCount(), 10); for (int i = 0; i < dataSet.getRowCount(); i++) { Date d = (Date) dataSet.getValueAt(i, COLUMN_DATE); assertTrue(d.getMonth() > 8); } verify(listener).onDataLookup(allRowsTable); verify(listener).onRedraw(allRowsTable); }
@Test public void testYearFilter() { displayerCoordinator.drawAll(); // Click on the "2014" slice reset(listener); yearBarChart.filterUpdate(COLUMN_DATE, 2); // Check the allRowsTable receives the filter request DataSet dataSet = allRowsTable.getDataSetHandler().getLastDataSet(); assertEquals(dataSet.getRowCount(), 11); for (int i = 0; i < dataSet.getRowCount(); i++) { Date d = (Date) dataSet.getValueAt(i, COLUMN_DATE); assertEquals(d.getYear(), 114); } verify(listener).onDataLookup(allRowsTable); verify(listener).onRedraw(allRowsTable); }
@Test public void testMinMaxNumberSliderEquals() { displayerCoordinator.drawAll(); // Filter by a range numberSliderDisplayer.onSliderChange(11, 100); DataSet dataSet = allRowsDisplayer.getDataSetHandler().getLastDataSet(); assertEquals(dataSet.getRowCount(), 3); // Select the same min/max amount reset(listener); numberSliderDisplayer.onSliderChange(100, 100); // Check the allRowsDisplayer receives all the filter requests and no data is found dataSet = allRowsDisplayer.getDataSetHandler().getLastDataSet(); assertEquals(dataSet.getRowCount(), 1); verify(listener).onDataLookup(allRowsDisplayer); verify(listener).onRedraw(allRowsDisplayer); }
@Test public void testMinMaxNumberSliderEquals() { displayerCoordinator.drawAll(); // Filter by a range numberSliderDisplayer.onSliderChange(11, 100); DataSet dataSet = allRowsDisplayer.getDataSetHandler().getLastDataSet(); assertEquals(dataSet.getRowCount(), 3); // Select the same min/max amount reset(listener); numberSliderDisplayer.onSliderChange(100, 100); // Check the allRowsDisplayer receives all the filter requests and no data is found dataSet = allRowsDisplayer.getDataSetHandler().getLastDataSet(); assertEquals(dataSet.getRowCount(), 1); verify(listener).onDataLookup(allRowsDisplayer); verify(listener).onRedraw(allRowsDisplayer); }
@Test public void testMultipleFilter() { displayerCoordinator.drawAll(); // Click on the "2014" slice yearBarChart.filterUpdate(COLUMN_DATE, 2); // Click on the "Sales" slice deptPieChart.filterUpdate(COLUMN_DEPARTMENT, 1); // Check the allRowsTable receives all the filter requests DataSet dataSet = allRowsTable.getDataSetHandler().getLastDataSet(); assertEquals(dataSet.getRowCount(), 2); }
@Test public void testMultipleFilter() { displayerCoordinator.drawAll(); // Click on the "2014" slice yearBarChart.filterUpdate(COLUMN_DATE, 2); // Click on the "Sales" slice deptPieChart.filterUpdate(COLUMN_DEPARTMENT, 1); // Check the allRowsTable receives all the filter requests DataSet dataSet = allRowsTable.getDataSetHandler().getLastDataSet(); assertEquals(dataSet.getRowCount(), 2); }