- 新增 OrderMessageLabelResolver 用于解析订单场景标签 - 修改微信公众号下单通知,根据下单类型(随机单/指定单/打赏/礼物)显示对应标签 - 更新 WxCustomMpService 接口,传递 placeType 和 rewardType 参数 - 完善相关单元测试和 Mock 配置
32 lines
1.1 KiB
Java
32 lines
1.1 KiB
Java
package com.starry.admin.api;
|
|
|
|
import static org.mockito.Mockito.mock;
|
|
import static org.mockito.Mockito.when;
|
|
|
|
import me.chanjar.weixin.mp.api.WxMpService;
|
|
import me.chanjar.weixin.mp.api.WxMpTemplateMsgService;
|
|
import org.mockito.Mockito;
|
|
import org.springframework.boot.test.context.TestConfiguration;
|
|
import org.springframework.context.annotation.Bean;
|
|
import org.springframework.context.annotation.Primary;
|
|
import org.springframework.context.annotation.Profile;
|
|
|
|
/**
|
|
* Provides stubbed WeChat MP services in the apitest profile so integration tests never hit external APIs.
|
|
*/
|
|
@TestConfiguration
|
|
@Profile("apitest")
|
|
public class MockWxMpServiceConfig {
|
|
|
|
@Bean
|
|
@Primary
|
|
public WxMpService wxMpService() {
|
|
WxMpService service = mock(WxMpService.class, Mockito.RETURNS_DEEP_STUBS);
|
|
WxMpTemplateMsgService templateMsgService = mock(WxMpTemplateMsgService.class);
|
|
when(service.getTemplateMsgService()).thenReturn(templateMsgService);
|
|
when(service.switchoverTo(Mockito.anyString())).thenReturn(service);
|
|
when(service.switchover(Mockito.anyString())).thenReturn(true);
|
|
return service;
|
|
}
|
|
}
|