use of com.gargoylesoftware.htmlunit.TextPage in project javaee7-samples by javaee-samples.
the class SecureServletTest method testPostWithCorrectCredentials.
@Test
public void testPostWithCorrectCredentials() 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());
}
use of com.gargoylesoftware.htmlunit.TextPage in project javaee7-samples by javaee-samples.
the class SecureServletTest method testGetWithCorrectCredentials.
@Test
public void testGetWithCorrectCredentials() throws Exception {
webClient.setCredentialsProvider(correctCreds);
TextPage page = webClient.getPage(base + "/SecureServlet");
assertEquals("my GET", page.getContent());
}
use of com.gargoylesoftware.htmlunit.TextPage in project javaee7-samples by javaee-samples.
the class SecureServletTest method testGetMethod.
@Test
public void testGetMethod() throws Exception {
webClient.setCredentialsProvider(correctCreds);
TextPage page = webClient.getPage(base + "/SecureServlet");
assertEquals("my GET", page.getContent());
}
use of com.gargoylesoftware.htmlunit.TextPage in project javaee7-samples by javaee-samples.
the class SecureServletTest method testPutMethod.
@Test
public void testPutMethod() throws Exception {
webClient.setCredentialsProvider(correctCreds);
WebRequest request = new WebRequest(new URL(base + "SecureServlet"), HttpMethod.PUT);
try {
TextPage p = webClient.getPage(request);
System.out.println(p.getContent());
} catch (FailingHttpStatusCodeException e) {
assertNotNull(e);
assertEquals(403, e.getStatusCode());
return;
}
fail("PUT method could be called even with deny-unocvered-http-methods");
}
use of com.gargoylesoftware.htmlunit.TextPage in project javaee7-samples by javaee-samples.
the class DynamicServletTest method testChildServlet.
@Test
public void testChildServlet() throws IOException, SAXException {
TextPage page = webClient.getPage(base + "dynamic");
assertEquals("dynamic GET", page.getContent());
}
Aggregations