From 9776ea2e85468256c70b8618c0e1a2a7ccb8199b Mon Sep 17 00:00:00 2001 From: JenoDK Date: Tue, 26 Sep 2017 10:20:33 +0200 Subject: Fix DataCommunicator parameter not used in Grid constructor (#10075) Fixes #9944 --- server/src/main/java/com/vaadin/ui/Grid.java | 2 +- .../vaadin/tests/server/component/grid/GridTest.java | 10 ++++++++++ .../vaadin/tests/server/component/grid/TestGrid.java | 17 +++++++++++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 server/src/test/java/com/vaadin/tests/server/component/grid/TestGrid.java (limited to 'server') diff --git a/server/src/main/java/com/vaadin/ui/Grid.java b/server/src/main/java/com/vaadin/ui/Grid.java index ba23c92d8a..83e0a32d30 100644 --- a/server/src/main/java/com/vaadin/ui/Grid.java +++ b/server/src/main/java/com/vaadin/ui/Grid.java @@ -2277,7 +2277,7 @@ public class Grid extends AbstractListing implements HasComponents, * @since 8.0.7 */ protected Grid(Class beanType, DataCommunicator dataCommunicator) { - this(BeanPropertySet.get(beanType)); + this(BeanPropertySet.get(beanType), dataCommunicator); this.beanType = beanType; } diff --git a/server/src/test/java/com/vaadin/tests/server/component/grid/GridTest.java b/server/src/test/java/com/vaadin/tests/server/component/grid/GridTest.java index cf43ed8339..5f8327bb8d 100644 --- a/server/src/test/java/com/vaadin/tests/server/component/grid/GridTest.java +++ b/server/src/test/java/com/vaadin/tests/server/component/grid/GridTest.java @@ -23,6 +23,7 @@ import java.util.concurrent.atomic.AtomicReference; import java.util.stream.Collectors; import java.util.stream.Stream; +import com.vaadin.data.provider.DataCommunicator; import org.easymock.Capture; import org.junit.Assert; import org.junit.Before; @@ -70,6 +71,15 @@ public class GridTest { .setId("randomColumnId"); } + @Test + public void testCreateGridWithDataCommunicator() { + DataCommunicator specificDataCommunicator = new DataCommunicator<>(); + + TestGrid grid = new TestGrid(String.class, specificDataCommunicator); + + assertEquals(specificDataCommunicator, grid.getDataCommunicator()); + } + @Test public void testGridHeightModeChange() { assertEquals("Initial height mode was not CSS", HeightMode.CSS, diff --git a/server/src/test/java/com/vaadin/tests/server/component/grid/TestGrid.java b/server/src/test/java/com/vaadin/tests/server/component/grid/TestGrid.java new file mode 100644 index 0000000000..b6a6ab548f --- /dev/null +++ b/server/src/test/java/com/vaadin/tests/server/component/grid/TestGrid.java @@ -0,0 +1,17 @@ +package com.vaadin.tests.server.component.grid; + +import com.vaadin.data.provider.DataCommunicator; +import com.vaadin.ui.Grid; + +/** + * {@link Grid} class for testing purposes + * @param + * the grid bean type + */ +public class TestGrid extends Grid { + + public TestGrid(Class beanType, DataCommunicator dataCommunicator) { + super(beanType, dataCommunicator); + } + +} -- cgit v1.2.3