コード例 #1
0
 @Test
 public void removeAllParameters() {
   request.setParameter("key1", "value1");
   Map<String, Object> params = new HashMap<String, Object>(2);
   params.put("key2", "value2");
   params.put("key3", new String[] {"value3A", "value3B"});
   request.addParameters(params);
   assertEquals(3, request.getParameterMap().size());
   request.removeAllParameters();
   assertEquals(0, request.getParameterMap().size());
 }
コード例 #2
0
 @Test
 public void addMultipleParameters() {
   request.setParameter("key1", "value1");
   request.setParameter("key2", "value2");
   Map<String, Object> params = new HashMap<String, Object>(2);
   params.put("key1", "newValue1");
   params.put("key3", new String[] {"value3A", "value3B"});
   request.addParameters(params);
   String[] values1 = request.getParameterValues("key1");
   assertEquals(2, values1.length);
   assertEquals("value1", values1[0]);
   assertEquals("newValue1", values1[1]);
   assertEquals("value2", request.getParameter("key2"));
   String[] values3 = request.getParameterValues("key3");
   assertEquals(2, values3.length);
   assertEquals("value3A", values3[0]);
   assertEquals("value3B", values3[1]);
 }