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 1.9KB

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