我需要使用moockito模拟静态方法,但我无法 这是我的代码
this is the class i want to mock
String buc = TrackerGenerator.getMetadataLocalThread().getIdUsuarioFinal();
这是测试
@Test
public void serviceTest() {
TrackerGenerator trackerGenerator = mock(TrackerGenerator.class);
when(TrackerGenerator.getMetadataLocalThread().getIdUsuarioFinal()).thenReturn("0");
TrackerGenerator.setMetadataLocalThread(new ThreadLocal<>());
}