I have the following test that works for testing a GET method on a servlet:
@ArquillianResource
URL deploymentUrl;
@Test
@RunAsClient
public void testLoginServlet() throws IOException {
URL url = new URL(deploymentUrl, "login");
StringBuilder builder = new StringBuilder();
BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
String line;
while ((line = reader.readLine()) != null) {
builder.append(line);
}
reader.close();
assertNotNull(builder.toString());
}
What's the best way to test a POST call to the same servlet, passing 1 parameter?
Should I be creating a WebTarget and using that or is there a trick with Arquillian that makes it easier. I thought there were annotations but can't find anything.
Aucun commentaire:
Enregistrer un commentaire