View Javadoc

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.Map;
19  
20  import org.springframework.beans.factory.FactoryBean;
21  
22  public class MockProxyFactoryBean implements FactoryBean {
23  	private Class<?> interfaceClass;
24  	private Map<String,Object> methodReturnMap;
25  
26  	@Override
27  	public Object getObject() throws Exception {
28  		return MockProxy.newInstance(methodReturnMap, interfaceClass);
29  	}
30  
31  	@Override
32  	public Class<?> getObjectType() {
33  		return interfaceClass;
34  	}
35  
36  	@Override
37  	public boolean isSingleton() {
38  		return false;
39  	}
40  
41  	/**
42  	 * @return the interfaceClass
43  	 */
44  	public Class<?> getInterfaceClass() {
45  		return interfaceClass;
46  	}
47  
48  	/**
49  	 * @param interfaceClass the interfaceClass to set
50  	 */
51  	public void setInterfaceClass(Class<?> interfaceClass) {
52  		this.interfaceClass = interfaceClass;
53  	}
54  
55  	/**
56  	 * @return the methodReturnMap
57  	 */
58  	public Map<String, Object> getMethodReturnMap() {
59  		return methodReturnMap;
60  	}
61  
62  	/**
63  	 * @param methodReturnMap the methodReturnMap to set
64  	 */
65  	public void setMethodReturnMap(Map<String, Object> methodReturnMap) {
66  		this.methodReturnMap = methodReturnMap;
67  	}
68  
69  }