### Question:
TimePicker { void refreshDateInPopup() { if (isDateSetInInput()) { final Moment moment = getDateInInput(); if (moment.isValid()) { view.setDate(moment); } } else { setDefaultData(); } } @Inject  TimePicker(final View view); void bind(final HTMLInputElement input); void setOnDateChanged(final Consumer<Moment> onDateChanged); String getValue(); void setValue(final String value);  }### Answer:
@Test public void testRefreshDateInPopup() { final Moment moment = mock(Moment.class); final String inputValue = "22:30:51"; int expectedHours = 22; int expectedMinutes = 30; int expectedSeconds = 51; when(moment.isValid()).thenReturn(true); when(moment.hours()).thenReturn(expectedHours); when(moment.minutes()).thenReturn(expectedMinutes); when(moment.seconds()).thenReturn(expectedSeconds); doReturn(moment).when(picker).getDateInInput(); input.value = inputValue; picker.refreshDateInPopup(); verify(view).setDate(momentArgumentCaptor.capture()); final Moment actual = momentArgumentCaptor.getValue(); assertEquals(expectedHours, actual.hours()); assertEquals(expectedMinutes, actual.minutes()); assertEquals(expectedSeconds, actual.seconds()); }