Home | History | Annotate | Download | only in creation
      1 /*
      2  * Copyright (c) 2007 Mockito contributors
      3  * This program is made available under the terms of the MIT License.
      4  */
      5 package org.mockito.internal.creation;
      6 
      7 import java.lang.reflect.Method;
      8 
      9 import org.mockito.internal.invocation.MockitoMethod;
     10 
     11 public class DelegatingMethod implements MockitoMethod {
     12 
     13     private final Method method;
     14 
     15     public DelegatingMethod(Method method) {
     16         assert method != null : "Method cannot be null";
     17         this.method = method;
     18     }
     19 
     20     public Class<?>[] getExceptionTypes() {
     21         return method.getExceptionTypes();
     22     }
     23 
     24     public Method getJavaMethod() {
     25         return method;
     26     }
     27 
     28     public String getName() {
     29         return method.getName();
     30     }
     31 
     32     public Class<?>[] getParameterTypes() {
     33         return method.getParameterTypes();
     34     }
     35 
     36     public Class<?> getReturnType() {
     37         return method.getReturnType();
     38     }
     39 
     40     public boolean isVarArgs() {
     41         return method.isVarArgs();
     42     }
     43 
     44     @Override
     45     public int hashCode() {
     46         return 1;
     47     }
     48 
     49     @Override
     50     public boolean equals(Object obj) {
     51         return method.equals(obj);
     52     }
     53 }