-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
62 additions
and
0 deletions.
There are no files selected for viewing
62 changes: 62 additions & 0 deletions
62
projects/Mockito/11/org/mockito/internal/creation/DelegatingMethod.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* | ||
* Copyright (c) 2007 Mockito contributors | ||
* This program is made available under the terms of the MIT License. | ||
*/ | ||
package org.mockito.internal.creation; | ||
|
||
import org.mockito.internal.invocation.MockitoMethod; | ||
|
||
import java.lang.reflect.Method; | ||
import java.lang.reflect.Modifier; | ||
|
||
public class DelegatingMethod implements MockitoMethod { | ||
|
||
private final Method method; | ||
|
||
public DelegatingMethod(Method method) { | ||
assert method != null : "Method cannot be null"; | ||
this.method = method; | ||
} | ||
|
||
public Class<?>[] getExceptionTypes() { | ||
return method.getExceptionTypes(); | ||
} | ||
|
||
public Method getJavaMethod() { | ||
return method; | ||
} | ||
|
||
public String getName() { | ||
return method.getName(); | ||
} | ||
|
||
public Class<?>[] getParameterTypes() { | ||
return method.getParameterTypes(); | ||
} | ||
|
||
public Class<?> getReturnType() { | ||
return method.getReturnType(); | ||
} | ||
|
||
public boolean isVarArgs() { | ||
return method.isVarArgs(); | ||
} | ||
|
||
public boolean isAbstract() { | ||
return (method.getModifiers() & Modifier.ABSTRACT) != 0; | ||
} | ||
|
||
/** | ||
* @return True if the input object is a DelegatingMethod which has an internal Method which is equal to the internal Method of this DelegatingMethod, | ||
* or if the input object is a Method which is equal to the internal Method of this DelegatingMethod. | ||
*/ | ||
@Override | ||
public boolean equals(Object o) { | ||
return method.equals(o); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return 1; | ||
} | ||
} |