我正在设置模拟类的静态方法。我必须在@Before注释的JUnit设置方法中执行此操作。我的目标是设置类来调用真正的方法,除了那些我明确模拟的方法。基本上:@BeforepublicvoidsetupStaticUtil(){PowerMockito.mockStatic(StaticUtilClass.class);//mockoutcertainmethods...when(StaticUtilClass.someStaticMethod(anyString())).thenReturn(5);//NowhaveallOTHERmethodscalltherealimplement
我正在设置模拟类的静态方法。我必须在@Before注释的JUnit设置方法中执行此操作。我的目标是设置类来调用真正的方法,除了那些我明确模拟的方法。基本上:@BeforepublicvoidsetupStaticUtil(){PowerMockito.mockStatic(StaticUtilClass.class);//mockoutcertainmethods...when(StaticUtilClass.someStaticMethod(anyString())).thenReturn(5);//NowhaveallOTHERmethodscalltherealimplement