Package org.powermock.reflect.exceptions

Examples of org.powermock.reflect.exceptions.MethodNotFoundException


      }
      thisType = thisType.getSuperclass();
    }

    if (foundMethods.isEmpty()) {
      throw new MethodNotFoundException("No method was found with argument types: [ "
          + getArgumentsAsString((Object[]) parameterTypes) + " ] in class "
          + getUnmockedType(type).getName());
    } else {
      throwExceptionWhenMultipleMethodMatchesFound("method name", foundMethods.toArray(new Method[foundMethods
          .size()]));
View Full Code Here


    if (methodToMock == null) {
      String methodNameData = "";
      if (methodName != null) {
        methodNameData = "with name '" + methodName + "' ";
      }
      throw new MethodNotFoundException("No method found " + methodNameData + "with argument types: [ "
          + getArgumentsAsString(arguments) + " ] in class " + getUnmockedType(type).getName());
    }
  }
View Full Code Here

      }
    }

    final Method[] methodArray = methodsToMock.toArray(new Method[0]);
    if (methodArray.length == 0) {
      throw new MethodNotFoundException(String.format(
          "No methods matching the name(s) %s were found in the class hierarchy of %s.",
          concatenateStrings(methodNames), getType(clazz)));
    }
    return methodArray;
  }
View Full Code Here

    if (methodName == null || methodName.length() == 0) {
      throw new IllegalArgumentException("methodName cannot be empty");
    }
    Method[] methods = Whitebox.getMethods(declaringClass, methodName);
    if (methods.length == 0) {
      throw new MethodNotFoundException(String.format("Couldn't find a method with name %s in the class hierarchy of %s", methodName,
          declaringClass.getName()));
    } else if (methods.length > 1) {
      throw new TooManyMethodsFoundException(String.format("Found %d methods with name %s in the class hierarchy of %s.", methods.length,
          methodName, declaringClass.getName()));
    }
View Full Code Here

    if (methodName == null || methodName.length() == 0) {
      throw new IllegalArgumentException("methodName cannot be empty");
    }
    Method[] methods = Whitebox.getMethods(declaringClass, methodName);
    if (methods.length == 0) {
      throw new MethodNotFoundException(String.format("Couldn't find a method with name %s in the class hierarchy of %s", methodName,
          declaringClass.getName()));
    } else if (methods.length > 1) {
      throw new TooManyMethodsFoundException(String.format("Found %d methods with name %s in the class hierarchy of %s.", methods.length,
          methodName, declaringClass.getName()));
    }
View Full Code Here

TOP

Related Classes of org.powermock.reflect.exceptions.MethodNotFoundException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.