对接口类的函数打桩

//需要测试的类
RemoteNoticeEmailDSServiceImpl impl = new RemoteNoticeEmailDSServiceImpl();

EmailServerManager 是测试类中需要调用的接口

//对接口类的函数打桩
EmailServerManager emailAsService = [
setEmailServer:{arg->
}] as EmailServerManager;

//将mocket的对象注入到你需要调用该mocket对象函数的(setEmailServer) 的实体类对象中。
RemoteNoticeEmailDSServiceImpl impl = new RemoteNoticeEmailDSServiceImpl();
impl.setInternalRmNtSService emailAsService

你可能感兴趣的:(接口)