diff --git a/uitest/src/main/java/com/vaadin/tests/components/AbstractComponentTest.java b/uitest/src/main/java/com/vaadin/tests/components/AbstractComponentTest.java index 7089a2e8105..8a4499b1010 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/AbstractComponentTest.java +++ b/uitest/src/main/java/com/vaadin/tests/components/AbstractComponentTest.java @@ -754,6 +754,7 @@ protected LinkedHashMap createIconOptions( return options; } + @Override protected void log(String msg) { log.log(msg); } diff --git a/uitest/src/main/java/com/vaadin/tests/components/AbstractTestUI.java b/uitest/src/main/java/com/vaadin/tests/components/AbstractTestUI.java index b030382ca6b..8255a21546a 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/AbstractTestUI.java +++ b/uitest/src/main/java/com/vaadin/tests/components/AbstractTestUI.java @@ -3,6 +3,8 @@ import java.io.File; import com.vaadin.annotations.Widgetset; +import com.vaadin.server.DefaultErrorHandler; +import com.vaadin.server.ErrorHandler; import com.vaadin.server.VaadinRequest; import com.vaadin.server.VaadinServlet; import com.vaadin.server.WebBrowser; @@ -19,12 +21,14 @@ import com.vaadin.ui.UI; import com.vaadin.ui.VerticalLayout; -public abstract class AbstractTestUI extends UI { +public abstract class AbstractTestUI extends UI implements ErrorHandler { @Override public void init(VaadinRequest request) { getPage().setTitle(getClass().getName()); + setErrorHandler(this); + Label label = new Label(getTestDescription(), ContentMode.HTML); label.setWidth("100%"); @@ -227,4 +231,18 @@ public void run() { } }.start(); } + + @Override + public void error(com.vaadin.server.ErrorEvent event) { + final Throwable throwable = DefaultErrorHandler + .findRelevantThrowable(event.getThrowable()); + + log("Exception occurred, " + throwable.getClass().getName() + ": " + + throwable.getMessage()); + throwable.printStackTrace(); + } + + protected void log(String message) { + // NOP + } } diff --git a/uitest/src/main/java/com/vaadin/tests/components/AbstractTestUIWithLog.java b/uitest/src/main/java/com/vaadin/tests/components/AbstractTestUIWithLog.java index 3905ea0ed5a..2e2be536f9b 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/AbstractTestUIWithLog.java +++ b/uitest/src/main/java/com/vaadin/tests/components/AbstractTestUIWithLog.java @@ -14,6 +14,7 @@ public void init(VaadinRequest request) { ((VerticalLayout) getContent()).addComponent(log, 0); } + @Override protected void log(String message) { log.log(message); } diff --git a/uitest/src/main/java/com/vaadin/tests/components/grid/GridNullSafeNestedPropertyColumn.java b/uitest/src/main/java/com/vaadin/tests/components/grid/GridNullSafeNestedPropertyColumn.java index 888296d5f8b..845a23ea481 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/grid/GridNullSafeNestedPropertyColumn.java +++ b/uitest/src/main/java/com/vaadin/tests/components/grid/GridNullSafeNestedPropertyColumn.java @@ -1,5 +1,8 @@ package com.vaadin.tests.components.grid; +import java.util.ArrayList; +import java.util.List; + import com.vaadin.annotations.Widgetset; import com.vaadin.data.provider.ListDataProvider; import com.vaadin.server.VaadinRequest; @@ -10,12 +13,8 @@ import com.vaadin.tests.data.bean.Sex; import com.vaadin.ui.Button; import com.vaadin.ui.Grid; -import com.vaadin.ui.TextField; import com.vaadin.ui.renderers.TextRenderer; -import java.util.ArrayList; -import java.util.List; - @Widgetset("com.vaadin.DefaultWidgetSet") public class GridNullSafeNestedPropertyColumn extends AbstractTestUI { @@ -26,6 +25,8 @@ public class GridNullSafeNestedPropertyColumn extends AbstractTestUI { @Override protected void setup(VaadinRequest request) { + setErrorHandler(null); + Grid grid = new Grid<>(Person.class); grid.setSizeFull(); diff --git a/uitest/src/main/java/com/vaadin/v7/tests/components/grid/basicfeatures/GridBasicFeatures.java b/uitest/src/main/java/com/vaadin/v7/tests/components/grid/basicfeatures/GridBasicFeatures.java index cb9d4a25bdb..41a2d7b57ef 100644 --- a/uitest/src/main/java/com/vaadin/v7/tests/components/grid/basicfeatures/GridBasicFeatures.java +++ b/uitest/src/main/java/com/vaadin/v7/tests/components/grid/basicfeatures/GridBasicFeatures.java @@ -14,8 +14,6 @@ import java.util.Random; import com.vaadin.annotations.Theme; -import com.vaadin.server.DefaultErrorHandler; -import com.vaadin.server.ErrorHandler; import com.vaadin.shared.data.sort.SortDirection; import com.vaadin.shared.ui.ContentMode; import com.vaadin.tests.components.AbstractComponentTest; @@ -78,8 +76,7 @@ * @author Vaadin Ltd */ @Theme("valo") -public class GridBasicFeatures extends AbstractComponentTest - implements ErrorHandler { +public class GridBasicFeatures extends AbstractComponentTest { public static final String ROW_STYLE_GENERATOR_ROW_NUMBERS_FOR_3_OF_4 = "Row numbers for 3/4"; public static final String ROW_STYLE_GENERATOR_NONE = "None"; @@ -237,11 +234,6 @@ public Component getDetails(RowReference rowReference) { } }; - public GridBasicFeatures() { - super(); - setErrorHandler(this); - } - @Override protected void createActions() { super.createActions(); @@ -1711,14 +1703,4 @@ protected Class getTestClass() { return Grid.class; } - @Override - public void error(com.vaadin.server.ErrorEvent event) { - final Throwable throwable = DefaultErrorHandler - .findRelevantThrowable(event.getThrowable()); - - log("Exception occurred, " + throwable.getClass().getName() + ": " - + throwable.getMessage()); - throwable.printStackTrace(); - } - } diff --git a/uitest/src/test/java/com/vaadin/tests/components/ui/UIAccessTest.java b/uitest/src/test/java/com/vaadin/tests/components/ui/UIAccessTest.java index f1ac5a58414..3202d95e646 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/ui/UIAccessTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/ui/UIAccessTest.java @@ -60,9 +60,11 @@ public void exceptionCanBeThrown() { $(ButtonElement.class).get(2).click(); assertTrue(logContainsText("0. Throwing exception in access")); - assertTrue(logContainsText("1. firstFuture is done? true")); assertTrue(logContainsText( - "2. Got exception from firstFuture: java.lang.RuntimeException: Catch me if you can")); + "1. Exception occurred, java.lang.RuntimeException: Catch me if you can")); + assertTrue(logContainsText("2. firstFuture is done? true")); + assertTrue(logContainsText( + "3. Got exception from firstFuture: java.lang.RuntimeException: Catch me if you can")); } @Test diff --git a/uitest/src/test/java/com/vaadin/tests/components/upload/UploadChangeListenerTest.java b/uitest/src/test/java/com/vaadin/tests/components/upload/UploadChangeListenerTest.java index a7e8a4e3cea..a55029c249c 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/upload/UploadChangeListenerTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/upload/UploadChangeListenerTest.java @@ -30,12 +30,15 @@ public void changeListenerWorksAfterFirstUpload() throws IOException { upload.click(); - assertEquals("2. finished", getLogRow(0)); + assertEquals("2. finished", getLogRow(1)); + assertEquals( + "3. Exception occurred, com.vaadin.server.UploadException: Upload failed", + getLogRow(0)); tempFile = createTempFile(); fillPathToUploadInput(tempFile.getPath()); - assertEquals("3. change", getLogRow(0)); + assertEquals("4. change", getLogRow(0)); } /**