<dependency>
<groupId>org.jmockit</groupId>
<artifactId>jmockit</artifactId>
<version>1.9</version>
<scope>test</scope>
</dependency>
public class Log {
public static void debug(String level, String text) {
// Do something
}
}
import mockit.Mock;
import mockit.MockUp;
@Test
public void testXxx() {
new MockUp<Log>() {
@Mock
public void debug(String level, String text) {
// mock 代码
}
}
Log.debug("aaa", "bbb");
}