Search in sources :

Example 6 with TextPage

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

the class TestServletTest method testPost.

@Test
public void testPost() throws IOException, SAXException {
    WebRequest request = new WebRequest(new URL(base + "TestServlet"), HttpMethod.POST);
    TextPage page = webClient.getPage(request);
    assertEquals("my POST", page.getContent());
}
Also used : WebRequest(com.gargoylesoftware.htmlunit.WebRequest) TextPage(com.gargoylesoftware.htmlunit.TextPage) URL(java.net.URL) Test(org.junit.Test)

Example 7 with TextPage

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

the class TestServletTest method testGet.

@Test
public void testGet() throws IOException, SAXException {
    TextPage page = webClient.getPage(base + "TestServlet");
    assertEquals("my GET", page.getContent());
}
Also used : TextPage(com.gargoylesoftware.htmlunit.TextPage) Test(org.junit.Test)

Example 8 with TextPage

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

the class SimpleServletTest method testGet.

@Test
public void testGet() throws IOException, SAXException {
    TextPage page = webClient.getPage(base + "SimpleServlet");
    assertEquals("my GET", page.getContent());
}
Also used : TextPage(com.gargoylesoftware.htmlunit.TextPage) Test(org.junit.Test)

Example 9 with TextPage

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

the class SimpleServletTest method testPost.

@Test
public void testPost() throws IOException, SAXException {
    WebRequest request = new WebRequest(new URL(base + "SimpleServlet"), HttpMethod.POST);
    TextPage page = webClient.getPage(request);
    assertEquals("my POST", page.getContent());
}
Also used : WebRequest(com.gargoylesoftware.htmlunit.WebRequest) TextPage(com.gargoylesoftware.htmlunit.TextPage) URL(java.net.URL) Test(org.junit.Test)

Example 10 with TextPage

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

the class SecureServletTest method testPostWithNoCredentials.

@Test
public void testPostWithNoCredentials() throws Exception {
    //        webClient.setCredentialsProvider(correctCreds);
    WebRequest request = new WebRequest(new URL(base + "SecureServlet"), HttpMethod.POST);
    TextPage page = webClient.getPage(request);
    assertEquals("my POST", page.getContent());
}
Also used : WebRequest(com.gargoylesoftware.htmlunit.WebRequest) TextPage(com.gargoylesoftware.htmlunit.TextPage) URL(java.net.URL) Test(org.junit.Test)

Aggregations

TextPage (com.gargoylesoftware.htmlunit.TextPage)15 Test (org.junit.Test)14 WebRequest (com.gargoylesoftware.htmlunit.WebRequest)8 URL (java.net.URL)8 FailingHttpStatusCodeException (com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException)2 Matchers.containsString (org.hamcrest.Matchers.containsString)1