</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>
<!-- 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>
<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>
--- /dev/null
+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");
+ });
+ }
+}
--- /dev/null
+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));
+ }
+}
--- /dev/null
+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));
+ }
+
+}