方法1:
@Before
public void before(){
PowerMockito.mockStatic(类名.class); //必须要有
}
@Test
public void testBeforeDate() {
PowerMockito.when(类名.方法名(属性1, 属性2)).thenReturn(true); //thenReturn:返回的值
boolean result = 类名.方法名(属性1, 属性2);
Assert.assertTrue(result);//断言
}
如果是多个外部类的静态方法,需要在注解中加,如下
@PrepareForTest({测试类名.class,外部类1.class,外部类2.class})