You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

DateFieldListenersTest.java 2.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. package com.vaadin.tests.server.component.datefield;
  2. import java.time.LocalDateTime;
  3. import java.time.temporal.TemporalAccessor;
  4. import java.util.Date;
  5. import java.util.Map;
  6. import org.junit.Test;
  7. import com.vaadin.data.validator.RangeValidator;
  8. import com.vaadin.event.FieldEvents.BlurEvent;
  9. import com.vaadin.event.FieldEvents.BlurListener;
  10. import com.vaadin.event.FieldEvents.FocusEvent;
  11. import com.vaadin.event.FieldEvents.FocusListener;
  12. import com.vaadin.shared.ui.datefield.DateTimeResolution;
  13. import com.vaadin.tests.server.component.AbstractListenerMethodsTestBase;
  14. import com.vaadin.ui.AbstractDateField;
  15. public class DateFieldListenersTest extends AbstractListenerMethodsTestBase {
  16. public static class TestDateField
  17. extends AbstractDateField<LocalDateTime, DateTimeResolution> {
  18. public TestDateField() {
  19. super(DateTimeResolution.DAY);
  20. }
  21. @Override
  22. protected int getDatePart(LocalDateTime date,
  23. DateTimeResolution resolution) {
  24. return 0;
  25. }
  26. @Override
  27. protected LocalDateTime buildDate(
  28. Map<DateTimeResolution, Integer> resolutionValues) {
  29. return null;
  30. }
  31. @Override
  32. protected RangeValidator<LocalDateTime> getRangeValidator() {
  33. return null;
  34. }
  35. @Override
  36. protected LocalDateTime convertFromDate(Date date) {
  37. return null;
  38. }
  39. @Override
  40. protected Date convertToDate(LocalDateTime date) {
  41. return null;
  42. }
  43. @Override
  44. protected String formatDate(LocalDateTime value) {
  45. return null;
  46. }
  47. @Override
  48. protected LocalDateTime toType(TemporalAccessor temporalAccessor) {
  49. return LocalDateTime.from(temporalAccessor);
  50. }
  51. }
  52. @Test
  53. public void testFocusListenerAddGetRemove() throws Exception {
  54. testListenerAddGetRemove(TestDateField.class, FocusEvent.class,
  55. FocusListener.class);
  56. }
  57. @Test
  58. public void testBlurListenerAddGetRemove() throws Exception {
  59. testListenerAddGetRemove(TestDateField.class, BlurEvent.class,
  60. BlurListener.class);
  61. }
  62. }