KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > springframework > webflow > test > MockParameterMap


1 /*
2  * Copyright 2002-2006 the original author or authors.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.springframework.webflow.test;
17
18 import java.util.HashMap JavaDoc;
19
20 import org.springframework.webflow.core.collection.LocalParameterMap;
21 import org.springframework.webflow.core.collection.ParameterMap;
22
23 /**
24  * A extension of parameter map that allows for mutation of parameters. Useful
25  * as a stub for testing.
26  *
27  * @see ParameterMap
28  *
29  * @author Keith Donald
30  */

31 public class MockParameterMap extends LocalParameterMap {
32
33     /**
34      * Creates a new parameter map, initially empty.
35      */

36     public MockParameterMap() {
37         super(new HashMap JavaDoc());
38     }
39
40     /**
41      * Add a new parameter to this map.
42      * @param parameterName the parameter name
43      * @param parameterValue the parameter value
44      * @return this, to support call chaining
45      */

46     public MockParameterMap put(String JavaDoc parameterName, String JavaDoc parameterValue) {
47         getMapInternal().put(parameterName, parameterValue);
48         return this;
49     }
50
51     /**
52      * Add a new multi-valued parameter to this map.
53      * @param parameterName the parameter name
54      * @param parameterValues the parameter values
55      * @return this, to support call chaining
56      */

57     public MockParameterMap put(String JavaDoc parameterName, String JavaDoc[] parameterValues) {
58         getMapInternal().put(parameterName, parameterValues);
59         return this;
60     }
61 }
Popular Tags