1   /*
2    * Copyright 2004-2008 the Seasar Foundation and the Others.
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, 
13   * either express or implied. See the License for the specific language
14   * governing permissions and limitations under the License.
15   */
16  package org.seasar.uruma.binding.method.impl;
17  
18  import java.lang.reflect.Method;
19  
20  import org.seasar.eclipse.common.util.AbstractShellTest;
21  import org.seasar.framework.beans.BeanDesc;
22  import org.seasar.framework.beans.factory.BeanDescFactory;
23  import org.seasar.uruma.binding.method.ArgumentsFilter;
24  import org.seasar.uruma.util.ClassUtil;
25  
26  /**
27   * {@link ArgumentsFilter} のテストを行うための基底クラスです。<br />
28   * 
29   * @author y-komori
30   */
31  public abstract class AbstractArgumentFilterTest<T> extends AbstractShellTest {
32      protected BeanDesc desc = BeanDescFactory.getBeanDesc(getClass());
33  
34      protected T createFilter(final String methodName) {
35          Method method = desc.getMethod(methodName);
36          return ClassUtil.<T> newInstance(getFilterType(), method);
37      }
38  
39      protected T createFilter(final String methodName, final Class<?>... types) {
40          Method method = desc.getMethod(methodName, types);
41          return ClassUtil.<T> newInstance(getFilterType(), method);
42      }
43  
44      protected abstract Class<T> getFilterType();
45  }