Skip to content

Commit

Permalink
buggy files form Mockito #11
Browse files Browse the repository at this point in the history
  • Loading branch information
tdurieux committed Mar 7, 2017
1 parent 888b8d3 commit 7c1eef1
Showing 1 changed file with 62 additions and 0 deletions.
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;
}
}

0 comments on commit 7c1eef1

Please sign in to comment.