aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/test/java/com/vaadin/tests/widgetset/server/AssertionsEnabledTest.java
blob: 73e35877159f14a041d83b198636608f547181bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package com.vaadin.tests.widgetset.server;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

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.
        assertFalse(
                "Label with classname " + FAILING_CLASSNAME
                        + " should not exist",
                isElementPresent(By.className(FAILING_CLASSNAME)));

        assertTrue("Assertion error Notification is not present",
                isElementPresent(NotificationElement.class));
    }

}