Body.Form form = Assert.assertInstanceOf(req.getBody(), Body.Form.class);
Map<String, String[]> formParameters = form.getParameters();
assertTrue(formParameters.isEmpty());
//
InvokePostResponse post = new InvokePostResponse(rewriteURL(testServlet, "?a=a_value_query"));
post.setBody(new HttpRequest.Form());
post.setContentType(InvokePostResponse.APPLICATION_X_WWW_FORM_URLENCODED);
return post;
}
else if (getRequestCount() == 1)
{
Map<String, String[]> queryParameters = Assert.assertNotNull(req.getQueryParameterMap());
assertEquals(1, queryParameters.size());
assertEquals(new String[]{"a_value_query"}, queryParameters.get("a"));
Body.Form form = Assert.assertInstanceOf(req.getBody(), Body.Form.class);
Map<String, String[]> formParameters = form.getParameters();
assertTrue(formParameters.isEmpty());
//
InvokePostResponse post = new InvokePostResponse(rewriteURL(testServlet, "/"));
HttpRequest.Form requestForm = new HttpRequest.Form();
requestForm.addParameter("a", new String[]{"a_value_body"});
post.setBody(requestForm);
post.setContentType(InvokePostResponse.APPLICATION_X_WWW_FORM_URLENCODED);
return post;
}
else if (getRequestCount() == 2)
{
Map<String, String[]> queryParameters = Assert.assertNotNull(req.getQueryParameterMap());
assertTrue(queryParameters.isEmpty());
Body.Form form = Assert.assertInstanceOf(req.getBody(), Body.Form.class);
Map<String, String[]> formParameters = form.getParameters();
assertEquals(1, formParameters.size());
assertEquals(new String[]{"a_value_body"}, formParameters.get("a"));
//
InvokePostResponse post = new InvokePostResponse(rewriteURL(testServlet, "?a=a_value_query"));
post.setBody(new HttpRequest.Form());
HttpRequest.Form requestForm = new HttpRequest.Form();
requestForm.addParameter("a", new String[]{"a_value_form"});
post.setBody(requestForm);
post.setContentType(InvokePostResponse.APPLICATION_X_WWW_FORM_URLENCODED);
return post;
}
else if (getRequestCount() == 3)
{
Map<String, String[]> queryParameters = Assert.assertNotNull(req.getQueryParameterMap());
assertEquals(1, queryParameters.size());
assertEquals(new String[]{"a_value_query"}, queryParameters.get("a"));
Body.Form form = Assert.assertInstanceOf(req.getBody(), Body.Form.class);
Map<String, String[]> formParameters = form.getParameters();
assertEquals(1, formParameters.size());
assertEquals(new String[]{"a_value_form"}, formParameters.get("a"));
//
InvokePostResponse post = new InvokePostResponse(rewriteURL(testServlet, "?a=" + encoder.encode(RANGE_0_255)));
post.setBody(new HttpRequest.Form());
HttpRequest.Form requestForm = new HttpRequest.Form();
requestForm.addParameter("a", new String[]{RANGE_256_512});
post.setBody(requestForm);
post.setContentType(InvokePostResponse.APPLICATION_X_WWW_FORM_URLENCODED + "; charset=UTF-8");
return post;
}
else if (getRequestCount() == 4)
{
Map<String, String[]> queryParameters = Assert.assertNotNull(req.getQueryParameterMap());
assertEquals(1, queryParameters.size());
assertNull(compareString(RANGE_0_255, queryParameters.get("a")[0]));
Body.Form form = Assert.assertInstanceOf(req.getBody(), Body.Form.class);
Map<String, String[]> formParameters = form.getParameters();
assertEquals(1, formParameters.size());
assertNull(compareString(RANGE_256_512, formParameters.get("a")[0]));
//
InvokePostResponse post = new InvokePostResponse(rewriteURL(testServlet, "?a=" + encoder.encode(RANGE_256_512)));
post.setBody(new HttpRequest.Form());
HttpRequest.Form requestForm = new HttpRequest.Form();
requestForm.addParameter("a", new String[]{RANGE_0_255});
post.setBody(requestForm);
post.setContentType(InvokePostResponse.APPLICATION_X_WWW_FORM_URLENCODED + "; charset=UTF-8");
return post;
}
else if (getRequestCount() == 5)
{
Map<String, String[]> queryParameters = Assert.assertNotNull(req.getQueryParameterMap());