11package 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 ;
65import java .io .File ;
76import java .io .IOException ;
87import java .net .URL ;
1110import org .jboss .arquillian .test .api .ArquillianResource ;
1211import org .jboss .shrinkwrap .api .ShrinkWrap ;
1312import org .jboss .shrinkwrap .api .spec .WebArchive ;
14- import static org .junit .Assert .assertTrue ;
13+ import static org .junit .Assert .* ;
1514import org .junit .Test ;
1615import org .junit .runner .RunWith ;
1716import 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