summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--uitest/pom.xml6
-rw-r--r--uitest/src/main/java/com/vaadin/tests/widgetset/client/AssertionFailureWidget.java18
-rw-r--r--uitest/src/main/java/com/vaadin/tests/widgetset/server/AssertionsEnabled.java16
-rw-r--r--uitest/src/test/java/com/vaadin/tests/widgetset/server/AssertionsEnabledTest.java30
4 files changed, 68 insertions, 2 deletions
diff --git a/uitest/pom.xml b/uitest/pom.xml
index 63e1f92a42..6a6c94a627 100644
--- a/uitest/pom.xml
+++ b/uitest/pom.xml
@@ -50,7 +50,8 @@
</dependency>
<!-- jetty-servlets needed by ProxyTest, but not by jetty-runner -->
- <!-- Jetty before vaadin-* on the classpath to make Eclipse use the right version -->
+ <!-- Jetty before vaadin-* on the classpath to make Eclipse use the right
+ version -->
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
@@ -169,7 +170,7 @@
<!-- Servlet API -->
<dependency>
- <!-- Jetty requires 3.1.0 -->
+ <!-- Jetty requires 3.1.0 -->
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
@@ -244,6 +245,7 @@
<warSourceDirectory>src/main/themes</warSourceDirectory>
<webappDirectory>${project.build.outputDirectory}/VAADIN/widgetsets</webappDirectory>
<persistentunitcachedir>${project.build.directory}/gwt-unitCache</persistentunitcachedir>
+ <checkAssertions>true</checkAssertions>
</configuration>
<executions>
<execution>
diff --git a/uitest/src/main/java/com/vaadin/tests/widgetset/client/AssertionFailureWidget.java b/uitest/src/main/java/com/vaadin/tests/widgetset/client/AssertionFailureWidget.java
new file mode 100644
index 0000000000..91e50fdf06
--- /dev/null
+++ b/uitest/src/main/java/com/vaadin/tests/widgetset/client/AssertionFailureWidget.java
@@ -0,0 +1,18 @@
+package com.vaadin.tests.widgetset.client;
+
+import com.google.gwt.core.client.Scheduler;
+import com.google.gwt.user.client.ui.SimplePanel;
+import com.vaadin.client.ui.VLabel;
+
+public class AssertionFailureWidget extends SimplePanel {
+
+ public AssertionFailureWidget() {
+ Scheduler.get().scheduleDeferred(() -> {
+ assert 1 == 2 : "This should fail.";
+ VLabel w = new VLabel();
+ add(w);
+ w.setText("This should not be here.");
+ w.addStyleName("non-existent-widget");
+ });
+ }
+}
diff --git a/uitest/src/main/java/com/vaadin/tests/widgetset/server/AssertionsEnabled.java b/uitest/src/main/java/com/vaadin/tests/widgetset/server/AssertionsEnabled.java
new file mode 100644
index 0000000000..a844a68e23
--- /dev/null
+++ b/uitest/src/main/java/com/vaadin/tests/widgetset/server/AssertionsEnabled.java
@@ -0,0 +1,16 @@
+package com.vaadin.tests.widgetset.server;
+
+import com.vaadin.annotations.Widgetset;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.tests.widgetset.TestingWidgetSet;
+import com.vaadin.tests.widgetset.client.AssertionFailureWidget;
+
+@Widgetset(TestingWidgetSet.NAME)
+public class AssertionsEnabled extends AbstractTestUI {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ addComponent(new TestWidgetComponent(AssertionFailureWidget.class));
+ }
+}
diff --git a/uitest/src/test/java/com/vaadin/tests/widgetset/server/AssertionsEnabledTest.java b/uitest/src/test/java/com/vaadin/tests/widgetset/server/AssertionsEnabledTest.java
new file mode 100644
index 0000000000..f6bbe2dc0a
--- /dev/null
+++ b/uitest/src/test/java/com/vaadin/tests/widgetset/server/AssertionsEnabledTest.java
@@ -0,0 +1,30 @@
+package com.vaadin.tests.widgetset.server;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import com.vaadin.testbench.By;
+import com.vaadin.testbench.elements.NotificationElement;
+import com.vaadin.tests.tb3.SingleBrowserTest;
+
+public class AssertionsEnabledTest extends SingleBrowserTest {
+
+ private static final String FAILING_CLASSNAME = "non-existent-widget";
+
+ @Test
+ public void testAssertionsAreEnabled() {
+ setDebug(true);
+ openTestURL();
+
+ // If assertions are disabled, the AssertionFailureWidget will add a
+ // label to the UI.
+ Assert.assertFalse(
+ "Label with classname " + FAILING_CLASSNAME
+ + " should not exist",
+ isElementPresent(By.className(FAILING_CLASSNAME)));
+
+ Assert.assertTrue("Assertion error Notification is not present",
+ isElementPresent(NotificationElement.class));
+ }
+
+}