aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/test/java/com/vaadin/tests/applicationservlet/NoApplicationClassTest.java
blob: 7beb0607b1abc539ce491c1b6220a0f7e3ede8f5 (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
33
package com.vaadin.tests.applicationservlet;

import static org.junit.Assert.assertTrue;

import org.junit.Test;
import org.openqa.selenium.By;

import com.vaadin.tests.tb3.SingleBrowserTest;

public class NoApplicationClassTest extends SingleBrowserTest {

    @Test
    public void testInvalidApplicationClass() {
        openTestURL();
        String exceptionMessage = getDriver().findElement(By.xpath("//pre[1]"))
                .getText();
        String expected = "ServletException: java.lang.ClassNotFoundException: ClassThatIsNotPresent";
        assertTrue(String.format(
                "Unexpected error message.\n expected to contain: '%s'\n was: %s",
                expected, exceptionMessage),
                exceptionMessage.contains(expected));
    }

    @Override
    protected String getDeploymentPath() {
        return "/run/ClassThatIsNotPresent";
    }

    @Override
    protected void openTestURL(String... parameters) {
        driver.get(getTestUrl());
    }
}