我正试图从Activity
的父类中抑制onSaveInstanceState
,但PowerMock
正在FragmentActivity
类中匹配两个具有相同签名的方法,这似乎是不可能的。
我做错了什么?
这是我的设置
@Before
public void setup() {
suppress(method(FragmentActivity.class, "onSaveInstanceState", Bundle.class));
}
这是我得到的例外
org.powermock.reflect.exceptions.TooManyMethodsFoundException: Several matching methods found, please specify the argument parameter types so that PowerMock can determine which method you're referring to.
Matching methods in class android.support.v4.app.FragmentActivity were:
void onSaveInstanceState( android.os.Bundle.class )
void onSaveInstanceState( android.os.Bundle.class )
尝试methods
而不是method
:
suppress(methods(FragmentActivity.class, "onSaveInstanceState"));