BasicFiltersViewImpl implements BasicFiltersView,
                                             IsElement { protected void onDateRangeValueChange(final String label, final String selectedLabel, final Moment fromDate, final Moment toDate, final Consumer<ActiveFilterItem<DateRange>> callback) { final DateRange dateRange = new DateRange(fromDate.milliseconds(0).asDate(), toDate.milliseconds(0).asDate()); final String hint = constants.From() + ": " + fromDate.format("lll") + "<br>" + constants.To() + ": " + toDate.format("lll"); addActiveFilter(label, selectedLabel, hint, dateRange, callback); }  @PostConstruct void init(); @Override HTMLElement getElement(); @Override void addTextFilter(final String label,
                              final String placeholder,
                              final Consumer<ActiveFilterItem<String>> callback); @Override void addTextFilter(String label, String placeholder, boolean disableFiltersInputHelp, Consumer<ActiveFilterItem<String>> callback); @Override void addNumericFilter(final String label,
                                 final String placeholder,
                                 final Consumer<ActiveFilterItem<Integer>> callback); @Override void addDataSetSelectFilter(final String label,
                                       final DataSetLookup lookup,
                                       final String textColumnId,
                                       final String valueColumnId,
                                       final Consumer<ActiveFilterItem<String>> callback); @Override void addDateRangeFilter(final String label,
                                   final String placeholder,
                                   final Boolean useMaxDate,
                                   final Consumer<ActiveFilterItem<DateRange>> callback); @Override void addSelectFilter(final String label,
                                final Map<String, String> options,
                                final Consumer<ActiveFilterItem<String>> callback); @Override void clearAllSelectFilter(); @Override void checkSelectFilter(final String label,
                                  final String value); @Override void clearSelectFilter(final String label); @Override void addMultiSelectFilter(final String label,
                                     final Map<String, String> options,
                                     final Consumer<ActiveFilterItem<List<String>>> callback); @Override void hideFilterBySection(); @EventHandler("refine-apply") void onApplyClick(@ForEvent("click") Event e);  }
@Test public void testDateRangeChange() { final Consumer<ActiveFilterItem<DateRange>> callback = mock(Consumer.class); final String label = "label"; final String selectedLabel = "selectedLabel"; final Moment startMoment = mock(Moment.class); when(startMoment.milliseconds(anyInt())).thenReturn(startMoment); final Date startDate = new Date(); when(startMoment.asDate()).thenReturn(startDate); final Moment endMoment = mock(Moment.class); when(endMoment.milliseconds(anyInt())).thenReturn(endMoment); final Date endDate = new Date(); when(endMoment.asDate()).thenReturn(endDate); view.onDateRangeValueChange(label, selectedLabel, startMoment, endMoment, callback); ArgumentCaptor<ActiveFilterItem> captor = ArgumentCaptor.forClass(ActiveFilterItem.class); verify(callback).accept(captor.capture()); assertEquals(1, captor.getAllValues().size()); assertEquals(label, captor.getValue().getKey()); assertEquals(label + ": " + selectedLabel, captor.getValue().getLabelValue()); assertEquals(startDate, ((DateRange) captor.getValue().getValue()).getStartDate()); assertEquals(endDate, ((DateRange) captor.getValue().getValue()).getEndDate()); }