Closed xiongshanliang closed 5 years ago
怎么mock,Thread.sleep方法,让他不用等待,我看例子里有mock native方法的,但是有个 @BeforeClass // 加载AnOrdinaryClass类的native方法的native实现 public static void loadNative() throws Throwable { JNITools.loadNative(); }
不知道加载Thread类的native方法实现怎么写
已找到解决方法: @BeforeClass public static void loadNative() throws Throwable { Class c = Thread.class; Method registerNatives = c.getDeclaredMethod("registerNatives"); registerNatives.setAccessible(true); registerNatives.invoke(c); }
怎么mock,Thread.sleep方法,让他不用等待,我看例子里有mock native方法的,但是有个 @BeforeClass
// 加载AnOrdinaryClass类的native方法的native实现
public static void loadNative() throws Throwable {
JNITools.loadNative();
}
不知道加载Thread类的native方法实现怎么写