Junit powermock@PrepareForTest无法使用通配符值

Junit powermock@PrepareForTest无法使用通配符值,junit,annotations,powermock,Junit,Annotations,Powermock,版本:powermock core 1.4.12 问题: 根据,@PrepareForTest应该能够使用通配符,如: @PrepareForTest(“com.smin.*”) 但在我的例子中,它只是没有编译,编译错误: 类型不匹配:无法从字符串转换为类[] 我看了PrepareForTest的源代码,我只是不知道这个注释如何将通配符作为它的值。有什么想法吗 @Target( { ElementType.TYPE, ElementType.METHOD }) @Retention(Retent

版本:powermock core 1.4.12

问题: 根据,@PrepareForTest应该能够使用通配符,如:

@PrepareForTest(“com.smin.*”)

但在我的例子中,它只是没有编译,编译错误:

类型不匹配:无法从字符串转换为类[]

我看了PrepareForTest的源代码,我只是不知道这个注释如何将通配符作为它的值。有什么想法吗

@Target( { ElementType.TYPE, ElementType.METHOD })
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Inherited
public @interface PrepareForTest {
    Class<?>[] value() default IndicateReloadClass.class;

    String[] fullyQualifiedNames() default "";
}
@Target({ElementType.TYPE,ElementType.METHOD})
@保留(RetentionPolicy.RUNTIME)
@记录
@继承的
public@interface PrepareForTest{
类[]值()默认指示符LoadClass.Class;
字符串[]fullyQualifiedNames()默认为“”;
}

是的-文档似乎与现实不符。尝试:

@PrepareForTest(fullyQualifiedNames={"com.smin.*"})
我认为通配符名称的解析将发生在
MockClassLoader
或者它的超类
DeferSupportingClassLoader
,如果您想深入挖掘的话