summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAhmed Ashour <asashour@yahoo.com>2017-10-26 21:19:41 +0200
committerPekka Maanpää <pekkamaa@vaadin.com>2017-10-26 22:19:41 +0300
commit01c93a6aef27ef562267d7966c6386ecaa6c1f6b (patch)
tree438810691e69e7751710917c251c2ba677c969d4 /test
parent10bd7544fd22dccd7e8e32cb236eb50f102892d3 (diff)
downloadvaadin-framework-01c93a6aef27ef562267d7966c6386ecaa6c1f6b.tar.gz
vaadin-framework-01c93a6aef27ef562267d7966c6386ecaa6c1f6b.zip
Use lambda with Listeners (#10222)
Also use "event" as the name for events
Diffstat (limited to 'test')
-rw-r--r--test/cdi/src/main/java/com/vaadin/test/cdi/MyVaadinUI.java2
-rw-r--r--test/servlet-containers/generic-tests/src/main/java/com/vaadin/tests/integration/push/LongPollingProxyServerIT.java1
-rw-r--r--test/servlet-containers/generic-ui/src/main/java/com/vaadin/tests/integration/push/BasicPush.java28
-rw-r--r--test/servlet-containers/karaf/vaadin-karaf-bundle1/src/main/java/com/vaadin/test/osgi/myapplication1/MyUI.java2
-rw-r--r--test/servlet-containers/karaf/vaadin-karaf-bundle2/src/main/java/com/vaadin/test/osgi/myapplication/MyUI.java2
-rw-r--r--test/spring-boot-subcontext/src/main/java/com/example/view/DefaultView.java2
-rw-r--r--test/spring-boot/src/main/java/com/example/view/DefaultView.java2
-rw-r--r--test/widget-set-testutil/src/main/java/com/vaadin/test/widgetset/AbstractTestWidgetSetUI.java11
8 files changed, 19 insertions, 31 deletions
diff --git a/test/cdi/src/main/java/com/vaadin/test/cdi/MyVaadinUI.java b/test/cdi/src/main/java/com/vaadin/test/cdi/MyVaadinUI.java
index 58b479b2b1..ba0398845c 100644
--- a/test/cdi/src/main/java/com/vaadin/test/cdi/MyVaadinUI.java
+++ b/test/cdi/src/main/java/com/vaadin/test/cdi/MyVaadinUI.java
@@ -20,7 +20,7 @@ public class MyVaadinUI extends UI {
@Override
protected void init(VaadinRequest request) {
setContent(new Button("Click Me",
- e -> Notification.show(service.getText())));
+ event -> Notification.show(service.getText())));
}
}
diff --git a/test/servlet-containers/generic-tests/src/main/java/com/vaadin/tests/integration/push/LongPollingProxyServerIT.java b/test/servlet-containers/generic-tests/src/main/java/com/vaadin/tests/integration/push/LongPollingProxyServerIT.java
index 5188583166..3daea2ac9b 100644
--- a/test/servlet-containers/generic-tests/src/main/java/com/vaadin/tests/integration/push/LongPollingProxyServerIT.java
+++ b/test/servlet-containers/generic-tests/src/main/java/com/vaadin/tests/integration/push/LongPollingProxyServerIT.java
@@ -57,6 +57,7 @@ public class LongPollingProxyServerIT extends AbstractIntegrationTest {
@Parameter(1)
public String path;
+ @Override
@Before
public void setup() throws Exception {
Assume.assumeTrue(
diff --git a/test/servlet-containers/generic-ui/src/main/java/com/vaadin/tests/integration/push/BasicPush.java b/test/servlet-containers/generic-ui/src/main/java/com/vaadin/tests/integration/push/BasicPush.java
index a3f2dd1c47..058028a2e7 100644
--- a/test/servlet-containers/generic-ui/src/main/java/com/vaadin/tests/integration/push/BasicPush.java
+++ b/test/servlet-containers/generic-ui/src/main/java/com/vaadin/tests/integration/push/BasicPush.java
@@ -15,17 +15,16 @@
*/
package com.vaadin.tests.integration.push;
+import java.util.Timer;
+import java.util.TimerTask;
+
import com.vaadin.annotations.Push;
import com.vaadin.server.VaadinRequest;
import com.vaadin.shared.ui.ContentMode;
import com.vaadin.ui.Button;
-import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Button.ClickListener;
import com.vaadin.ui.Label;
-import java.util.Timer;
-import java.util.TimerTask;
-
@Push
public class BasicPush extends AbstractTestUI {
@@ -59,13 +58,9 @@ public class BasicPush extends AbstractTestUI {
addComponent(lbl);
Button incrementButton = new Button("Increment",
- new ClickListener() {
-
- @Override
- public void buttonClick(ClickEvent event) {
- clientCounter++;
- lbl.setValue(String.valueOf(clientCounter));
- }
+ event -> {
+ clientCounter++;
+ lbl.setValue(String.valueOf(clientCounter));
});
incrementButton.setId(INCREMENT_BUTTON_ID);
addComponent(incrementButton);
@@ -103,13 +98,10 @@ public class BasicPush extends AbstractTestUI {
startTimer.setId(START_TIMER_ID);
addComponent(startTimer);
- Button stopTimer = new Button("Stop timer", new ClickListener() {
- @Override
- public void buttonClick(ClickEvent event) {
- if (task != null) {
- task.cancel();
- task = null;
- }
+ Button stopTimer = new Button("Stop timer", event -> {
+ if (task != null) {
+ task.cancel();
+ task = null;
}
});
stopTimer.setId(STOP_TIMER_ID);
diff --git a/test/servlet-containers/karaf/vaadin-karaf-bundle1/src/main/java/com/vaadin/test/osgi/myapplication1/MyUI.java b/test/servlet-containers/karaf/vaadin-karaf-bundle1/src/main/java/com/vaadin/test/osgi/myapplication1/MyUI.java
index 26cf31628a..7997cb835e 100644
--- a/test/servlet-containers/karaf/vaadin-karaf-bundle1/src/main/java/com/vaadin/test/osgi/myapplication1/MyUI.java
+++ b/test/servlet-containers/karaf/vaadin-karaf-bundle1/src/main/java/com/vaadin/test/osgi/myapplication1/MyUI.java
@@ -27,7 +27,7 @@ public class MyUI extends UI {
name.setCaption("Type your name here:");
Button button = new Button("Click Me");
- button.addClickListener(e -> layout.addComponent(
+ button.addClickListener(event -> layout.addComponent(
new Label("Thanks " + name.getValue() + ", it works!")));
layout.addComponents(name, button);
diff --git a/test/servlet-containers/karaf/vaadin-karaf-bundle2/src/main/java/com/vaadin/test/osgi/myapplication/MyUI.java b/test/servlet-containers/karaf/vaadin-karaf-bundle2/src/main/java/com/vaadin/test/osgi/myapplication/MyUI.java
index 6a83b7b611..c5bf8d6c9b 100644
--- a/test/servlet-containers/karaf/vaadin-karaf-bundle2/src/main/java/com/vaadin/test/osgi/myapplication/MyUI.java
+++ b/test/servlet-containers/karaf/vaadin-karaf-bundle2/src/main/java/com/vaadin/test/osgi/myapplication/MyUI.java
@@ -23,7 +23,7 @@ public class MyUI extends UI {
name.setCaption("Type your name here:");
Button button = new Button("Click Me");
- button.addClickListener(e -> layout.addComponent(
+ button.addClickListener(event -> layout.addComponent(
new Label("Thanks " + name.getValue() + ", it works!")));
layout.addComponents(name, button);
diff --git a/test/spring-boot-subcontext/src/main/java/com/example/view/DefaultView.java b/test/spring-boot-subcontext/src/main/java/com/example/view/DefaultView.java
index 7fe9572e3e..26bb843854 100644
--- a/test/spring-boot-subcontext/src/main/java/com/example/view/DefaultView.java
+++ b/test/spring-boot-subcontext/src/main/java/com/example/view/DefaultView.java
@@ -23,7 +23,7 @@ public class DefaultView extends VerticalLayout implements View {
void init() {
setId("default-view");
Button button = new Button("Click Me!",
- e -> Notification.show(service.getText()));
+ event -> Notification.show(service.getText()));
addComponent(button);
}
diff --git a/test/spring-boot/src/main/java/com/example/view/DefaultView.java b/test/spring-boot/src/main/java/com/example/view/DefaultView.java
index 7fe9572e3e..26bb843854 100644
--- a/test/spring-boot/src/main/java/com/example/view/DefaultView.java
+++ b/test/spring-boot/src/main/java/com/example/view/DefaultView.java
@@ -23,7 +23,7 @@ public class DefaultView extends VerticalLayout implements View {
void init() {
setId("default-view");
Button button = new Button("Click Me!",
- e -> Notification.show(service.getText()));
+ event -> Notification.show(service.getText()));
addComponent(button);
}
diff --git a/test/widget-set-testutil/src/main/java/com/vaadin/test/widgetset/AbstractTestWidgetSetUI.java b/test/widget-set-testutil/src/main/java/com/vaadin/test/widgetset/AbstractTestWidgetSetUI.java
index c03645517a..b11125cfcc 100644
--- a/test/widget-set-testutil/src/main/java/com/vaadin/test/widgetset/AbstractTestWidgetSetUI.java
+++ b/test/widget-set-testutil/src/main/java/com/vaadin/test/widgetset/AbstractTestWidgetSetUI.java
@@ -2,7 +2,6 @@ package com.vaadin.test.widgetset;
import com.vaadin.server.VaadinRequest;
import com.vaadin.ui.Button;
-import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Label;
import com.vaadin.ui.TextField;
import com.vaadin.ui.UI;
@@ -19,13 +18,9 @@ public abstract class AbstractTestWidgetSetUI extends UI {
name.setCaption("Type your name here:");
Button button = new Button("Click Me");
- button.addClickListener(new Button.ClickListener() {
- @Override
- public void buttonClick(ClickEvent clickEvent) {
- layout.addComponent(
- new Label("Thanks " + name.getValue() + ", it works!"));
- }
- });
+ button.addClickListener(
+ event -> new Label(
+ "Thanks " + name.getValue() + ", it works!"));
getPage().getJavaScript().execute(
"widgetsetinfo.innerText=document.querySelector('iframe').id;");