Clover Coverage Report - Kuali Student 1.2.1-SNAPSHOT (Aggregated)
Coverage timestamp: Wed Nov 2 2011 04:03:58 EST
../../../../../../img/srcFileCovDistChart0.png 42% of files have more coverage
7   63   5   1.75
2   22   0.71   4
4     1.25  
1    
 
  MockArgumentMapper       Line # 27 7 0% 5 13 0% 0.0
 
No Tests
 
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    public class MockArgumentMapper {
28    private Map<Object,Object> argumentMapper;
29   
 
30  0 toggle public MockArgumentMapper() {
31  0 super();
32  0 argumentMapper = new HashMap<Object, Object>();
33    }
34   
35    /**
36    *
37    * This method returns the return value for the specified arguments
38    *
39    * @param arguments
40    * @return return value for arguments.
41    */
 
42  0 toggle public Object getReturnValue(Object[] arguments){
43  0 if (arguments!=null ){
44  0 return argumentMapper.get(arguments[0]);
45    }
46  0 return null;
47    }
48   
49    /**
50    * @return the methodReturnMap
51    */
 
52  0 toggle public Map<Object, Object> getArgumentMapper() {
53  0 return argumentMapper;
54    }
55   
56    /**
57    * @param methodReturnMap the methodReturnMap to set
58    */
 
59  0 toggle public void setArgumentMapper(Map<Object, Object> argumentMapper) {
60  0 this.argumentMapper = argumentMapper;
61    }
62   
63    }