Search in sources :

Example 6 with HtmlSpan

use of com.gargoylesoftware.htmlunit.html.HtmlSpan in project javaee7-samples by javaee-samples.

the class MyBeanTest method testAgeHighBoundary.

@Test
public void testAgeHighBoundary() throws IOException {
    nameInputText.setText("abc");
    ageInputText.setText("25");
    zipInputText.setText("12345");
    HtmlPage result = button.click();
    HtmlSpan span = (HtmlSpan) result.getElementById("ageMessage");
    assertEquals("", span.asText());
}
Also used : HtmlSpan(com.gargoylesoftware.htmlunit.html.HtmlSpan) HtmlPage(com.gargoylesoftware.htmlunit.html.HtmlPage) Test(org.junit.Test)

Example 7 with HtmlSpan

use of com.gargoylesoftware.htmlunit.html.HtmlSpan in project javaee7-samples by javaee-samples.

the class MyBeanTest method testZipLessNumbers.

@Test
public void testZipLessNumbers() throws IOException {
    nameInputText.setText("abc");
    ageInputText.setText("20");
    zipInputText.setText("1234");
    HtmlPage result = button.click();
    HtmlSpan span = (HtmlSpan) result.getElementById("zipMessage");
    assertEquals("must match \"[0-9]{5}\"", span.asText());
}
Also used : HtmlSpan(com.gargoylesoftware.htmlunit.html.HtmlSpan) HtmlPage(com.gargoylesoftware.htmlunit.html.HtmlPage) Test(org.junit.Test)

Example 8 with HtmlSpan

use of com.gargoylesoftware.htmlunit.html.HtmlSpan in project javaee7-samples by javaee-samples.

the class MyBeanTest method testZipMoreNumbers.

@Test
public void testZipMoreNumbers() throws IOException {
    nameInputText.setText("abc");
    ageInputText.setText("20");
    zipInputText.setText("123456");
    HtmlPage result = button.click();
    HtmlSpan span = (HtmlSpan) result.getElementById("zipMessage");
    assertEquals("must match \"[0-9]{5}\"", span.asText());
}
Also used : HtmlSpan(com.gargoylesoftware.htmlunit.html.HtmlSpan) HtmlPage(com.gargoylesoftware.htmlunit.html.HtmlPage) Test(org.junit.Test)

Example 9 with HtmlSpan

use of com.gargoylesoftware.htmlunit.html.HtmlSpan in project javaee7-samples by javaee-samples.

the class MyBeanTest method testNameLessCharacters.

@Test
public void testNameLessCharacters() throws IOException {
    nameInputText.setText("ab");
    ageInputText.setText("20");
    zipInputText.setText("12345");
    HtmlPage result = button.click();
    HtmlSpan span = (HtmlSpan) result.getElementById("nameMessage");
    assertEquals("At least 3 characters", span.asText());
}
Also used : HtmlSpan(com.gargoylesoftware.htmlunit.html.HtmlSpan) HtmlPage(com.gargoylesoftware.htmlunit.html.HtmlPage) Test(org.junit.Test)

Example 10 with HtmlSpan

use of com.gargoylesoftware.htmlunit.html.HtmlSpan in project javaee7-samples by javaee-samples.

the class MyBeanTest method testNameBoundary.

@Test
public void testNameBoundary() throws IOException {
    nameInputText.setText("abc");
    ageInputText.setText("20");
    zipInputText.setText("12345");
    HtmlPage result = button.click();
    HtmlSpan span = (HtmlSpan) result.getElementById("nameMessage");
    assertEquals("", span.asText());
}
Also used : HtmlSpan(com.gargoylesoftware.htmlunit.html.HtmlSpan) HtmlPage(com.gargoylesoftware.htmlunit.html.HtmlPage) Test(org.junit.Test)

Aggregations

HtmlPage (com.gargoylesoftware.htmlunit.html.HtmlPage)12 HtmlSpan (com.gargoylesoftware.htmlunit.html.HtmlSpan)12 Test (org.junit.Test)12 WebClient (com.gargoylesoftware.htmlunit.WebClient)1 URL (java.net.URL)1