1 /**
2 * Copyright 2010 The Kuali Foundation Licensed under the
3 * Educational Community License, Version 2.0 (the "License"); you may
4 * not use this file except in compliance with the License. You may
5 * obtain a copy of the License at
6 *
7 * http://www.osedu.org/licenses/ECL-2.0
8 *
9 * Unless required by applicable law or agreed to in writing,
10 * software distributed under the License is distributed on an "AS IS"
11 * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12 * or implied. See the License for the specific language governing
13 * permissions and limitations under the License.
14 */
15
16 package org.kuali.student.common.test.mock;
17
18 import java.util.HashMap;
19 import java.util.Map;
20
21 /**
22 * Use this mapper to set method return for mock proxy to return values you
23 * based on predefined arguments.
24 *
25 * NOTE: Currently only supports single argument methods.
26 */
27 @Deprecated
28 public class MockArgumentMapper {
29 private Map<Object,Object> argumentMapper;
30
31 public MockArgumentMapper() {
32 super();
33 argumentMapper = new HashMap<Object, Object>();
34 }
35
36 /**
37 *
38 * This method returns the return value for the specified arguments
39 *
40 * @param arguments
41 * @return return value for arguments.
42 */
43 public Object getReturnValue(Object[] arguments){
44 if (arguments!=null ){
45 return argumentMapper.get(arguments[0]);
46 }
47 return null;
48 }
49
50 /**
51 * @return the methodReturnMap
52 */
53 public Map<Object, Object> getArgumentMapper() {
54 return argumentMapper;
55 }
56
57 /**
58 * @param methodReturnMap the methodReturnMap to set
59 */
60 public void setArgumentMapper(Map<Object, Object> argumentMapper) {
61 this.argumentMapper = argumentMapper;
62 }
63
64 }