New*_*bie 97 java junit4 powermock
我知道如何使用PowerMock从类中模拟静态方法.
但我想使用JUnit和PowerMock从测试类中的多个类中模拟静态方法.
任何人都可以告诉我是否可以这样做以及如何做到这一点?
art*_*tol 240
只@PrepareForTest({Class1.class,Class2.class})
为多个班级做.
aru*_*436 10
@Test
@PrepareForTest({Class1.class, Class2.class})
public final void handleScript() throws Exception {
PowerMockito.mockStatic(Class1.class);
PowerMockito.mockStatic(Class2.class);
Run Code Online (Sandbox Code Playgroud)
等等...
归档时间: |
|
查看次数: |
62609 次 |
最近记录: |