001 /**
002 * Copyright 2010 The Kuali Foundation Licensed under the
003 * Educational Community License, Version 2.0 (the "License"); you may
004 * not use this file except in compliance with the License. You may
005 * obtain a copy of the License at
006 *
007 * http://www.osedu.org/licenses/ECL-2.0
008 *
009 * Unless required by applicable law or agreed to in writing,
010 * software distributed under the License is distributed on an "AS IS"
011 * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
012 * or implied. See the License for the specific language governing
013 * permissions and limitations under the License.
014 */
015
016 package org.kuali.student.common.test.mock;
017
018 import java.util.Map;
019
020 import org.springframework.beans.factory.FactoryBean;
021
022 public class MockProxyFactoryBean implements FactoryBean {
023 private Class<?> interfaceClass;
024 private Map<String,Object> methodReturnMap;
025
026 @Override
027 public Object getObject() throws Exception {
028 return MockProxy.newInstance(methodReturnMap, interfaceClass);
029 }
030
031 @Override
032 public Class<?> getObjectType() {
033 return interfaceClass;
034 }
035
036 @Override
037 public boolean isSingleton() {
038 return false;
039 }
040
041 /**
042 * @return the interfaceClass
043 */
044 public Class<?> getInterfaceClass() {
045 return interfaceClass;
046 }
047
048 /**
049 * @param interfaceClass the interfaceClass to set
050 */
051 public void setInterfaceClass(Class<?> interfaceClass) {
052 this.interfaceClass = interfaceClass;
053 }
054
055 /**
056 * @return the methodReturnMap
057 */
058 public Map<String, Object> getMethodReturnMap() {
059 return methodReturnMap;
060 }
061
062 /**
063 * @param methodReturnMap the methodReturnMap to set
064 */
065 public void setMethodReturnMap(Map<String, Object> methodReturnMap) {
066 this.methodReturnMap = methodReturnMap;
067 }
068
069 }