@Test(groups = "fast") public void testAddParameter() throws Exception { MockRoundtrip trip = new MockRoundtrip(getMockServletContext(), TestMockRoundtrip.class); trip.addParameter("param", "a"); trip.addParameter("param", "b"); trip.execute(); TestMockRoundtrip bean = trip.getActionBean(TestMockRoundtrip.class); String[] params = bean.getContext().getRequest().getParameterValues("param"); Assert.assertEquals(2, params.length); Assert.assertEquals(new String[]{"a", "b"}, params); }
public void addParameter(String name, String... value) { if (this.request.getParameterValues(name) == null) { setParameter(name, value); } else { String[] oldValues = this.request.getParameterMap().get(name); String[] combined = new String[oldValues.length + value.length]; System.arraycopy(oldValues, 0, combined, 0, oldValues.length); System.arraycopy(value, 0, combined, oldValues.length, value.length); setParameter(name, combined); } }
MockRoundtrip { public void addParameter(String name, String... value) { if (this.request.getParameterValues(name) == null) { setParameter(name, value); } else { String[] oldValues = this.request.getParameterMap().get(name); String[] combined = new String[oldValues.length + value.length]; System.arraycopy(oldValues, 0, combined, 0, oldValues.length); System.arraycopy(value, 0, combined, oldValues.length, value.length); setParameter(name, combined); } } }
MockRoundtrip { public void addParameter(String name, String... value) { if (this.request.getParameterValues(name) == null) { setParameter(name, value); } else { String[] oldValues = this.request.getParameterMap().get(name); String[] combined = new String[oldValues.length + value.length]; System.arraycopy(oldValues, 0, combined, 0, oldValues.length); System.arraycopy(value, 0, combined, oldValues.length, value.length); setParameter(name, combined); } } MockRoundtrip(MockServletContext context, Class<? extends ActionBean> beanType);  MockRoundtrip(MockServletContext context,
            Class<? extends ActionBean> beanType,
            MockHttpSession session);  MockRoundtrip(MockServletContext context, String actionBeanUrl);  MockRoundtrip(MockServletContext context, String actionBeanUrl, MockHttpSession session); }
MockRoundtrip { public void addParameter(String name, String... value) { if (this.request.getParameterValues(name) == null) { setParameter(name, value); } else { String[] oldValues = this.request.getParameterMap().get(name); String[] combined = new String[oldValues.length + value.length]; System.arraycopy(oldValues, 0, combined, 0, oldValues.length); System.arraycopy(value, 0, combined, oldValues.length, value.length); setParameter(name, combined); } } MockRoundtrip(MockServletContext context, Class<? extends ActionBean> beanType);  MockRoundtrip(MockServletContext context,
            Class<? extends ActionBean> beanType,
            MockHttpSession session);  MockRoundtrip(MockServletContext context, String actionBeanUrl);  MockRoundtrip(MockServletContext context, String actionBeanUrl, MockHttpSession session); MockHttpServletRequest getRequest(); MockHttpServletResponse getResponse(); MockServletContext getContext(); void setParameter(String name, String... value); void addParameter(String name, String... value); void setSourcePage(String url); void execute(); void execute(String event); @SuppressWarnings("unchecked") A getActionBean(Class<A> type); ValidationErrors getValidationErrors(); List<Message> getMessages(); byte[] getOutputBytes(); String getOutputString(); String getDestination(); String getForwardUrl(); String getRedirectUrl(); }
MockRoundtrip { public void addParameter(String name, String... value) { if (this.request.getParameterValues(name) == null) { setParameter(name, value); } else { String[] oldValues = this.request.getParameterMap().get(name); String[] combined = new String[oldValues.length + value.length]; System.arraycopy(oldValues, 0, combined, 0, oldValues.length); System.arraycopy(value, 0, combined, oldValues.length, value.length); setParameter(name, combined); } } MockRoundtrip(MockServletContext context, Class<? extends ActionBean> beanType);  MockRoundtrip(MockServletContext context,
            Class<? extends ActionBean> beanType,
            MockHttpSession session);  MockRoundtrip(MockServletContext context, String actionBeanUrl);  MockRoundtrip(MockServletContext context, String actionBeanUrl, MockHttpSession session); MockHttpServletRequest getRequest(); MockHttpServletResponse getResponse(); MockServletContext getContext(); void setParameter(String name, String... value); void addParameter(String name, String... value); void setSourcePage(String url); void execute(); void execute(String event); @SuppressWarnings("unchecked") A getActionBean(Class<A> type); ValidationErrors getValidationErrors(); List<Message> getMessages(); byte[] getOutputBytes(); String getOutputString(); String getDestination(); String getForwardUrl(); String getRedirectUrl(); static final String DEFAULT_SOURCE_PAGE; }