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.

GridNullSafeNestedPropertyColumnTest.java 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. package com.vaadin.tests.components.grid;
  2. import com.vaadin.testbench.By;
  3. import com.vaadin.testbench.elements.ButtonElement;
  4. import com.vaadin.testbench.parallel.TestCategory;
  5. import com.vaadin.tests.tb3.MultiBrowserTest;
  6. import org.junit.Test;
  7. import org.openqa.selenium.WebElement;
  8. import java.util.List;
  9. import static junit.framework.TestCase.assertTrue;
  10. import static org.junit.Assert.assertFalse;
  11. /**
  12. * Tests that using a nested property name with a null bean child property won't
  13. * cause an exception.
  14. */
  15. @TestCategory("grid")
  16. public class GridNullSafeNestedPropertyColumnTest extends MultiBrowserTest {
  17. @Test
  18. public void testNullNestedPropertyInSafeGridColumn() {
  19. openTestURL();
  20. waitForElementPresent(org.openqa.selenium.By.className("v-grid"));
  21. $(ButtonElement.class).id("safe").click();
  22. $(ButtonElement.class).id("add").click();
  23. List<WebElement> errorIndicator = findElements(
  24. By.className("v-errorindicator"));
  25. assertTrue(errorIndicator.isEmpty());
  26. }
  27. @Test
  28. public void testNullNestedPropertyInUnsafeGridColumn() {
  29. openTestURL();
  30. waitForElementPresent(org.openqa.selenium.By.className("v-grid"));
  31. $(ButtonElement.class).id("unsafe").click();
  32. $(ButtonElement.class).id("add").click();
  33. List<WebElement> errorIndicator = findElements(
  34. By.className("v-errorindicator"));
  35. assertFalse(
  36. "There should be an error indicator when adding nested null values to Grid",
  37. errorIndicator.isEmpty());
  38. }
  39. }