1:Mock带参数的静态方法
PowerMockito类
package org.powermock.api.mockito;

CityCodeBean cityCodeBean = CityCodeUtil.getCityCodeBeanByIata(split[4]);
/**********************************/
try {
      //PowerMockito.doReturn(cityCodeBean).when(CityCodeUtil.class, "getCityCodeBeanByIata");
      PowerMockito.when(CityCodeUtil.class, "getCityCodeBeanByIata", Mockito.anyString()).thenReturn(cityCodeBean);
 } catch (Exception e) {
      e.printStackTrace();
}

相关文章:

  • 2022-12-23
  • 2021-10-17
  • 2021-12-26
  • 2021-04-18
  • 2022-01-17
  • 2021-08-14
  • 2022-02-14
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-19
  • 2021-08-23
相关资源
相似解决方案