Skip to content

Commit 7974d43

Browse files
committed
Using HtmlUnit instead of HttpUnit
1 parent 7fc2627 commit 7974d43

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed
Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
package org.javaee7.servlet.metadata.complete;
22

3-
import com.meterware.httpunit.GetMethodWebRequest;
4-
import com.meterware.httpunit.WebConversation;
5-
import com.meterware.httpunit.WebResponse;
3+
import com.gargoylesoftware.htmlunit.WebClient;
4+
import com.gargoylesoftware.htmlunit.html.HtmlPage;
65
import java.io.File;
76
import java.io.IOException;
87
import java.net.URL;
@@ -11,7 +10,7 @@
1110
import org.jboss.arquillian.test.api.ArquillianResource;
1211
import org.jboss.shrinkwrap.api.ShrinkWrap;
1312
import org.jboss.shrinkwrap.api.spec.WebArchive;
14-
import static org.junit.Assert.assertTrue;
13+
import static org.junit.Assert.*;
1514
import org.junit.Test;
1615
import org.junit.runner.RunWith;
1716
import org.xml.sax.SAXException;
@@ -27,12 +26,6 @@ public class TestServletTest {
2726
@ArquillianResource
2827
private URL base;
2928

30-
/**
31-
* Arquillian specific method for creating a file which can be deployed
32-
* while executing the test.
33-
*
34-
* @return a war file
35-
*/
3629
@Deployment(testable = false)
3730
public static WebArchive createDeployment() {
3831
WebArchive war = ShrinkWrap.create(WebArchive.class).
@@ -45,10 +38,9 @@ public static WebArchive createDeployment() {
4538
* Test of processRequest method, of class TestServlet.
4639
*/
4740
@Test
48-
public void testProcessRequest() throws IOException, SAXException {
49-
WebConversation conv = new WebConversation();
50-
GetMethodWebRequest getRequest = new GetMethodWebRequest(base + "/TestServlet");
51-
WebResponse getResponse = conv.getResponse(getRequest);
52-
assertTrue(getResponse.getText().contains("<title>Servlet url-pattern in web.xml</title>"));
41+
public void testGet() throws IOException, SAXException {
42+
WebClient webClient = new WebClient();
43+
HtmlPage page = webClient.getPage(base + "/TestServlet");
44+
assertEquals("Servlet url-pattern in web.xml", page.getTitleText());
5345
}
5446
}

0 commit comments

Comments
 (0)