org.powermock.reflect.internal.WhiteboxImpl.filterPowerMockConstructor()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(2.1k)|赞(0)|评价(0)|浏览(87)

本文整理了Java中org.powermock.reflect.internal.WhiteboxImpl.filterPowerMockConstructor()方法的一些代码示例,展示了WhiteboxImpl.filterPowerMockConstructor()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WhiteboxImpl.filterPowerMockConstructor()方法的具体详情如下:
包路径:org.powermock.reflect.internal.WhiteboxImpl
类名称:WhiteboxImpl
方法名:filterPowerMockConstructor

WhiteboxImpl.filterPowerMockConstructor介绍

[英]Filter power mock constructor.
[中]滤波器功率模拟构造函数。

代码示例

代码示例来源:origin: org.powermock/powermock-reflect

/**
 * Finds and returns any constructor. If the constructor couldn't be
 * found this method delegates to {@link #throwExceptionWhenMultipleConstructorMatchesFound(java.lang.reflect.Constructor[])}.
 *
 * @param type The type where the constructor should be located.
 * @return The found constructor.
 * @throws TooManyConstructorsFoundException if too many constructors was found.
 */
public static Constructor<?> findConstructorOrThrowException(Class<?> type) {
  final Constructor<?>[] declaredConstructors = filterPowerMockConstructor(type.getDeclaredConstructors());
  if (declaredConstructors.length > 1) {
    throwExceptionWhenMultipleConstructorMatchesFound(declaredConstructors);
  }
  return declaredConstructors[0];
}

代码示例来源:origin: org.powermock.reflect/powermock-reflect

/**
 * Finds and returns a certain constructor. If the constructor couldn't be
 * found this method delegates to
 * 
 * @param type
 *            The type where the constructor should be located.
 * @return The found constructor.
 *         {@link Whitebox#throwExceptionIfConstructorWasNotFound(Class, Object...)
 *         .
 */
public static Constructor<?> findConstructorOrThrowException(Class<?> type) {
  final Constructor<?>[] declaredConstructors = filterPowerMockConstructor(type.getDeclaredConstructors());
  if (declaredConstructors.length > 1) {
    throwExceptionWhenMultipleConstructorMatchesFound(declaredConstructors);
  }
  return declaredConstructors[0];
}

代码示例来源:origin: org.powermock.reflect/powermock-reflect

Constructor<?>[] constructors = filterPowerMockConstructor(unmockedType.getDeclaredConstructors());
Constructor<?> potentialConstructor = null;
for (Constructor<?> constructor : constructors) {

相关文章

WhiteboxImpl类方法