DataSetGroupDateEditor implements IsWidget { public void init(ColumnGroup columnGroup) { this.columnGroup = columnGroup; if (columnGroup != null) { if (isFixedStrategy()) { gotoFixedMode(); } else { gotoDynamicMode(); } } } @Inject  DataSetGroupDateEditor(View view, Event<DataSetGroupDateChanged> changeEvent); @Override Widget asWidget(); ColumnGroup getColumnGroup(); void init(ColumnGroup columnGroup); boolean isFixedStrategy(); List<DateIntervalType> getListOfIntervalTypes(); void gotoDynamicMode(); void gotoFixedMode(); void onFixedStrategyChanged();  }
@Test public void testFixedModeInit() { presenter.init(new ColumnGroup("col", "col", FIXED, 15, HOUR.toString())); verify(view).setFixedModeValue(true); verify(view).clearIntervalTypeSelector(); verify(view, times(FIXED_INTERVALS_SUPPORTED.size())).addIntervalTypeItem(any(DateIntervalType.class)); verify(view).setSelectedIntervalTypeIndex(anyInt()); verify(view, never()).setMaxIntervalsVisibility(true); verify(view, never()).setFirstDayVisibility(true); verify(view, never()).setFirstMonthVisibility(true); }
@Test public void testDynamicModeInit() { ColumnGroup columnGroup = new ColumnGroup("col", "col", DYNAMIC, 15, HOUR.toString()); presenter.init(columnGroup); verify(view).setFixedModeValue(false); verify(view).clearIntervalTypeSelector(); verify(view, times(DateIntervalType.values().length)).addIntervalTypeItem(any(DateIntervalType.class)); verify(view).setSelectedIntervalTypeIndex(anyInt()); verify(view).setMaxIntervalsVisibility(true); verify(view).setMaxIntervalsValue("15"); verify(view, never()).setFirstDayVisibility(true); verify(view, never()).setFirstMonthVisibility(true); }
@Test public void testFirstMonthDayVisibility() { presenter.init(new ColumnGroup("col", "col", FIXED, 15, QUARTER.toString())); verify(view).setFirstMonthVisibility(false); verify(view).setFirstDayVisibility(false); verify(view, never()).setFirstDayVisibility(true); verify(view, never()).setFirstMonthVisibility(true); reset(view); presenter.init(new ColumnGroup("col", "col", FIXED, 15, MONTH.toString())); verify(view).setFirstMonthVisibility(true); verify(view).setFirstDayVisibility(false); verify(view, never()).setFirstDayVisibility(true); reset(view); presenter.init(new ColumnGroup("col", "col", FIXED, 15, DAY_OF_WEEK.toString())); verify(view).setFirstDayVisibility(true); verify(view).setFirstMonthVisibility(false); verify(view, never()).setFirstMonthVisibility(true); reset(view); presenter.init(new ColumnGroup("col", "col", FIXED, 15, HOUR.toString())); verify(view).setFirstMonthVisibility(false); verify(view).setFirstDayVisibility(false); verify(view, never()).setFirstDayVisibility(true); verify(view, never()).setFirstMonthVisibility(true); reset(view); presenter.init(new ColumnGroup("col", "col", FIXED, 15, MINUTE.toString())); verify(view).setFirstMonthVisibility(false); verify(view).setFirstDayVisibility(false); verify(view, never()).setFirstDayVisibility(true); verify(view, never()).setFirstMonthVisibility(true); reset(view); presenter.init(new ColumnGroup("col", "col", FIXED, 15, SECOND.toString())); verify(view).setFirstMonthVisibility(false); verify(view).setFirstDayVisibility(false); verify(view, never()).setFirstDayVisibility(true); verify(view, never()).setFirstMonthVisibility(true); }