DatePickerSingletonDOMElementFactory extends SingleValueSingletonDOMElementFactory<Date, DatePicker, DatePickerDOMElement> { @Override protected Date getValue() { if (getWidget() != null) { return convertToServerTimeZone(getWidget().getValue()); } return null; } DatePickerSingletonDOMElementFactory(final GridLienzoPanel gridPanel,
                                                final GridLayer gridLayer,
                                                final GuidedDecisionTableView gridWidget); @Override DatePicker createWidget(); @Override String convert(final Date value); @Override Date convert(final String value); @Override void registerHandlers(final DatePicker widget, final DatePickerDOMElement widgetDomElement);  }
@Test public void testGetValue() { final DatePickerSingletonDOMElementFactory factory = spy(makeFactory()); final Date date = mock(Date.class); final Date convertedDate = mock(Date.class); doReturn(datePicker).when(factory).getWidget(); when(datePicker.getValue()).thenReturn(date); mockStatic(TimeZoneUtils.class); PowerMockito.when(TimeZoneUtils.convertToServerTimeZone(date)).thenReturn(convertedDate); final Date actualDate = factory.getValue(); assertEquals(convertedDate, actualDate); }