This commit is contained in:
@@ -4,11 +4,13 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.ActiveProfiles;
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
import org.springframework.test.web.servlet.MockMvc;
|
||||
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
||||
@AutoConfigureMockMvc
|
||||
@ActiveProfiles("apitest")
|
||||
@TestPropertySource(properties = "spring.task.scheduling.enabled=false")
|
||||
public abstract class AbstractApiTest {
|
||||
|
||||
protected static final String TENANT_HEADER = "X-Tenant";
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.starry.admin.api;
|
||||
|
||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
||||
|
||||
import com.starry.admin.common.apitest.ApiTestDataSeeder;
|
||||
import com.starry.admin.modules.blindbox.module.entity.BlindBoxConfigEntity;
|
||||
import com.starry.admin.modules.blindbox.service.BlindBoxConfigService;
|
||||
import com.starry.admin.modules.order.module.constant.OrderConstant;
|
||||
import com.starry.admin.modules.order.module.entity.PlayOrderInfoEntity;
|
||||
import com.starry.admin.utils.SecurityUtils;
|
||||
import com.starry.common.constant.Constants;
|
||||
import com.starry.common.context.CustomSecurityContextHolder;
|
||||
import com.starry.common.utils.IdUtils;
|
||||
import java.math.BigDecimal;
|
||||
import org.assertj.core.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.MediaType;
|
||||
|
||||
class WxBlindBoxOrderApiTest extends WxCustomOrderApiTestSupport {
|
||||
|
||||
@Autowired
|
||||
private BlindBoxConfigService blindBoxConfigService;
|
||||
|
||||
@Test
|
||||
void blindBoxPurchaseFailsWhenBalanceInsufficient() throws Exception {
|
||||
SecurityUtils.setTenantId(ApiTestDataSeeder.DEFAULT_TENANT_ID);
|
||||
String configId = "blind-" + IdUtils.getUuid();
|
||||
try {
|
||||
BlindBoxConfigEntity config = new BlindBoxConfigEntity();
|
||||
config.setId(configId);
|
||||
config.setTenantId(ApiTestDataSeeder.DEFAULT_TENANT_ID);
|
||||
config.setName("API盲盒-" + IdUtils.getUuid().substring(0, 6));
|
||||
config.setPrice(new BigDecimal("66.00"));
|
||||
config.setStatus(1);
|
||||
blindBoxConfigService.save(config);
|
||||
|
||||
setCustomerBalance(BigDecimal.ZERO);
|
||||
String customerToken = wxTokenService.createWxUserToken(ApiTestDataSeeder.DEFAULT_CUSTOMER_ID);
|
||||
customUserInfoService.updateTokenById(ApiTestDataSeeder.DEFAULT_CUSTOMER_ID, customerToken);
|
||||
|
||||
ensureTenantContext();
|
||||
long beforeCount = playOrderInfoService.lambdaQuery()
|
||||
.eq(PlayOrderInfoEntity::getPurchaserBy, ApiTestDataSeeder.DEFAULT_CUSTOMER_ID)
|
||||
.eq(PlayOrderInfoEntity::getOrderType, OrderConstant.OrderType.BLIND_BOX_PURCHASE.getCode())
|
||||
.count();
|
||||
|
||||
String payload = "{" +
|
||||
"\"blindBoxId\":\"" + configId + "\"," +
|
||||
"\"clerkId\":\"" + ApiTestDataSeeder.DEFAULT_CLERK_ID + "\"," +
|
||||
"\"weiChatCode\":\"apitest-customer-wx\"" +
|
||||
"}";
|
||||
|
||||
mockMvc.perform(post("/wx/blind-box/order/purchase")
|
||||
.header(USER_HEADER, DEFAULT_USER)
|
||||
.header(TENANT_HEADER, DEFAULT_TENANT)
|
||||
.header(Constants.CUSTOM_USER_LOGIN_TOKEN, Constants.TOKEN_PREFIX + customerToken)
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.content(payload))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.code").value(998));
|
||||
|
||||
ensureTenantContext();
|
||||
long afterCount = playOrderInfoService.lambdaQuery()
|
||||
.eq(PlayOrderInfoEntity::getPurchaserBy, ApiTestDataSeeder.DEFAULT_CUSTOMER_ID)
|
||||
.eq(PlayOrderInfoEntity::getOrderType, OrderConstant.OrderType.BLIND_BOX_PURCHASE.getCode())
|
||||
.count();
|
||||
Assertions.assertThat(afterCount).isEqualTo(beforeCount);
|
||||
} finally {
|
||||
blindBoxConfigService.removeById(configId);
|
||||
CustomSecurityContextHolder.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -39,6 +39,43 @@ class WxCustomGiftOrderApiTest extends WxCustomOrderApiTestSupport {
|
||||
|
||||
private final ObjectMapper objectMapper = new ObjectMapper();
|
||||
|
||||
@Test
|
||||
void giftOrderFailsWhenBalanceInsufficient() throws Exception {
|
||||
SecurityUtils.setTenantId(ApiTestDataSeeder.DEFAULT_TENANT_ID);
|
||||
String remark = "API gift insufficient " + IdUtils.getUuid();
|
||||
try {
|
||||
setCustomerBalance(BigDecimal.ZERO);
|
||||
String customerToken = wxTokenService.createWxUserToken(ApiTestDataSeeder.DEFAULT_CUSTOMER_ID);
|
||||
customUserInfoService.updateTokenById(ApiTestDataSeeder.DEFAULT_CUSTOMER_ID, customerToken);
|
||||
|
||||
String payload = "{" +
|
||||
"\"clerkId\":\"" + ApiTestDataSeeder.DEFAULT_CLERK_ID + "\"," +
|
||||
"\"giftId\":\"" + ApiTestDataSeeder.DEFAULT_GIFT_ID + "\"," +
|
||||
"\"giftQuantity\":1," +
|
||||
"\"weiChatCode\":\"apitest-customer-wx\"," +
|
||||
"\"remark\":\"" + remark + "\"" +
|
||||
"}";
|
||||
|
||||
mockMvc.perform(post("/wx/custom/order/gift")
|
||||
.header(USER_HEADER, DEFAULT_USER)
|
||||
.header(TENANT_HEADER, DEFAULT_TENANT)
|
||||
.header(Constants.CUSTOM_USER_LOGIN_TOKEN, Constants.TOKEN_PREFIX + customerToken)
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.content(payload))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.code").value(998));
|
||||
|
||||
ensureTenantContext();
|
||||
long count = playOrderInfoService.lambdaQuery()
|
||||
.eq(PlayOrderInfoEntity::getPurchaserBy, ApiTestDataSeeder.DEFAULT_CUSTOMER_ID)
|
||||
.eq(PlayOrderInfoEntity::getRemark, remark)
|
||||
.count();
|
||||
Assertions.assertThat(count).isZero();
|
||||
} finally {
|
||||
CustomSecurityContextHolder.remove();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
// 测试用例:用户余额充足且携带有效登录态时,请求 /wx/custom/order/gift 下单指定礼物,
|
||||
// 期望生成已完成的礼物奖励订单、产生对应收益记录,同时校验用户/陪玩师礼物计数与账户余额随订单金额同步更新。
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.starry.admin.common.apitest.ApiTestDataSeeder;
|
||||
import com.starry.admin.modules.clerk.module.entity.PlayClerkLevelInfoEntity;
|
||||
import com.starry.admin.modules.clerk.module.entity.PlayClerkUserInfoEntity;
|
||||
import com.starry.admin.modules.clerk.service.IPlayClerkLevelInfoService;
|
||||
import com.starry.admin.modules.clerk.service.IPlayClerkUserInfoService;
|
||||
import com.starry.admin.modules.custom.module.entity.PlayCustomUserInfoEntity;
|
||||
@@ -12,12 +13,14 @@ import com.starry.admin.modules.order.module.constant.OrderConstant;
|
||||
import com.starry.admin.modules.order.module.constant.OrderConstant.PlaceType;
|
||||
import com.starry.admin.modules.order.service.IPlayOrderInfoService;
|
||||
import com.starry.admin.modules.shop.module.constant.CouponUseState;
|
||||
import com.starry.admin.modules.shop.module.entity.PlayCommodityAndLevelInfoEntity;
|
||||
import com.starry.admin.modules.shop.module.entity.PlayCouponDetailsEntity;
|
||||
import com.starry.admin.modules.shop.module.entity.PlayCouponInfoEntity;
|
||||
import com.starry.admin.modules.shop.module.enums.CouponClaimConditionType;
|
||||
import com.starry.admin.modules.shop.module.enums.CouponDiscountType;
|
||||
import com.starry.admin.modules.shop.module.enums.CouponOnlineState;
|
||||
import com.starry.admin.modules.shop.module.enums.CouponValidityPeriodType;
|
||||
import com.starry.admin.modules.shop.service.IPlayCommodityAndLevelInfoService;
|
||||
import com.starry.admin.modules.shop.service.IPlayCouponDetailsService;
|
||||
import com.starry.admin.modules.shop.service.IPlayCouponInfoService;
|
||||
import com.starry.admin.modules.weichat.service.WxTokenService;
|
||||
@@ -66,7 +69,11 @@ abstract class WxCustomOrderApiTestSupport extends AbstractApiTest {
|
||||
@Autowired
|
||||
protected IPlayCouponDetailsService couponDetailsService;
|
||||
|
||||
@Autowired
|
||||
protected IPlayCommodityAndLevelInfoService commodityAndLevelInfoService;
|
||||
|
||||
protected void resetCustomerBalance() {
|
||||
ensureDefaultClerkLevelBinding();
|
||||
BigDecimal balance = new BigDecimal("200.00");
|
||||
customUserInfoService.updateAccountBalanceById(ApiTestDataSeeder.DEFAULT_CUSTOMER_ID, balance);
|
||||
customUserInfoService.lambdaUpdate()
|
||||
@@ -80,6 +87,11 @@ abstract class WxCustomOrderApiTestSupport extends AbstractApiTest {
|
||||
.update();
|
||||
}
|
||||
|
||||
protected void setCustomerBalance(BigDecimal balance) {
|
||||
ensureDefaultClerkLevelBinding();
|
||||
customUserInfoService.updateAccountBalanceById(ApiTestDataSeeder.DEFAULT_CUSTOMER_ID, balance);
|
||||
}
|
||||
|
||||
protected void ensureTenantContext() {
|
||||
SecurityUtils.setTenantId(ApiTestDataSeeder.DEFAULT_TENANT_ID);
|
||||
}
|
||||
@@ -199,4 +211,43 @@ abstract class WxCustomOrderApiTestSupport extends AbstractApiTest {
|
||||
throw new AssertionError("优惠券未标记为已使用");
|
||||
}
|
||||
}
|
||||
|
||||
private void ensureDefaultClerkLevelBinding() {
|
||||
ensureTenantContext();
|
||||
PlayClerkUserInfoEntity clerk = clerkUserInfoService.selectById(ApiTestDataSeeder.DEFAULT_CLERK_ID);
|
||||
if (!StringUtils.hasText(clerk.getLevelId())
|
||||
|| !ApiTestDataSeeder.DEFAULT_CLERK_LEVEL_ID.equals(clerk.getLevelId())) {
|
||||
boolean updated = clerkUserInfoService.lambdaUpdate()
|
||||
.set(PlayClerkUserInfoEntity::getLevelId, ApiTestDataSeeder.DEFAULT_CLERK_LEVEL_ID)
|
||||
.eq(PlayClerkUserInfoEntity::getId, ApiTestDataSeeder.DEFAULT_CLERK_ID)
|
||||
.eq(PlayClerkUserInfoEntity::getTenantId, ApiTestDataSeeder.DEFAULT_TENANT_ID)
|
||||
.update();
|
||||
if (!updated) {
|
||||
throw new IllegalStateException("ApiTest fixtures failed to bind default level to test clerk");
|
||||
}
|
||||
clerk = clerkUserInfoService.selectById(ApiTestDataSeeder.DEFAULT_CLERK_ID);
|
||||
}
|
||||
|
||||
long pricingCount = commodityAndLevelInfoService.lambdaQuery()
|
||||
.eq(PlayCommodityAndLevelInfoEntity::getCommodityId, ApiTestDataSeeder.DEFAULT_COMMODITY_ID)
|
||||
.eq(PlayCommodityAndLevelInfoEntity::getLevelId, ApiTestDataSeeder.DEFAULT_CLERK_LEVEL_ID)
|
||||
.count();
|
||||
if (pricingCount == 0) {
|
||||
PlayCommodityAndLevelInfoEntity mapping = new PlayCommodityAndLevelInfoEntity();
|
||||
mapping.setId(com.starry.common.utils.IdUtils.getUuid());
|
||||
mapping.setTenantId(ApiTestDataSeeder.DEFAULT_TENANT_ID);
|
||||
mapping.setCommodityId(ApiTestDataSeeder.DEFAULT_COMMODITY_ID);
|
||||
mapping.setLevelId(ApiTestDataSeeder.DEFAULT_CLERK_LEVEL_ID);
|
||||
mapping.setPrice(ApiTestDataSeeder.DEFAULT_COMMODITY_PRICE);
|
||||
mapping.setSort(1L);
|
||||
commodityAndLevelInfoService.save(mapping);
|
||||
pricingCount = commodityAndLevelInfoService.lambdaQuery()
|
||||
.eq(PlayCommodityAndLevelInfoEntity::getCommodityId, ApiTestDataSeeder.DEFAULT_COMMODITY_ID)
|
||||
.eq(PlayCommodityAndLevelInfoEntity::getLevelId, ApiTestDataSeeder.DEFAULT_CLERK_LEVEL_ID)
|
||||
.count();
|
||||
}
|
||||
if (pricingCount == 0) {
|
||||
throw new IllegalStateException("ApiTest fixtures missing commodity pricing for default clerk level");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,6 +51,52 @@ class WxCustomRandomOrderApiTest extends WxCustomOrderApiTestSupport {
|
||||
@org.springframework.beans.factory.annotation.Autowired
|
||||
private com.starry.admin.modules.order.service.IPlayOrderInfoService orderInfoService;
|
||||
|
||||
@Test
|
||||
void randomOrderFailsWhenBalanceInsufficient() throws Exception {
|
||||
SecurityUtils.setTenantId(ApiTestDataSeeder.DEFAULT_TENANT_ID);
|
||||
String remark = "API random insufficient " + IdUtils.getUuid();
|
||||
try {
|
||||
setCustomerBalance(BigDecimal.ZERO);
|
||||
String customerToken = wxTokenService.createWxUserToken(ApiTestDataSeeder.DEFAULT_CUSTOMER_ID);
|
||||
customUserInfoService.updateTokenById(ApiTestDataSeeder.DEFAULT_CUSTOMER_ID, customerToken);
|
||||
|
||||
ensureTenantContext();
|
||||
long beforeCount = playOrderInfoService.lambdaQuery()
|
||||
.eq(PlayOrderInfoEntity::getPurchaserBy, ApiTestDataSeeder.DEFAULT_CUSTOMER_ID)
|
||||
.eq(PlayOrderInfoEntity::getPlaceType, OrderConstant.PlaceType.RANDOM.getCode())
|
||||
.count();
|
||||
|
||||
String payload = "{" +
|
||||
"\"sex\":\"2\"," +
|
||||
"\"levelId\":\"" + ApiTestDataSeeder.DEFAULT_CLERK_LEVEL_ID + "\"," +
|
||||
"\"commodityId\":\"" + ApiTestDataSeeder.DEFAULT_COMMODITY_ID + "\"," +
|
||||
"\"commodityQuantity\":1," +
|
||||
"\"weiChatCode\":\"apitest-customer-wx\"," +
|
||||
"\"excludeHistory\":\"0\"," +
|
||||
"\"couponIds\":[]," +
|
||||
"\"remark\":\"" + remark + "\"" +
|
||||
"}";
|
||||
|
||||
mockMvc.perform(post("/wx/custom/order/random")
|
||||
.header(USER_HEADER, DEFAULT_USER)
|
||||
.header(TENANT_HEADER, DEFAULT_TENANT)
|
||||
.header(Constants.CUSTOM_USER_LOGIN_TOKEN, Constants.TOKEN_PREFIX + customerToken)
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.content(payload))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.code").value(998));
|
||||
|
||||
ensureTenantContext();
|
||||
long afterCount = playOrderInfoService.lambdaQuery()
|
||||
.eq(PlayOrderInfoEntity::getPurchaserBy, ApiTestDataSeeder.DEFAULT_CUSTOMER_ID)
|
||||
.eq(PlayOrderInfoEntity::getPlaceType, OrderConstant.PlaceType.RANDOM.getCode())
|
||||
.count();
|
||||
Assertions.assertThat(afterCount).isEqualTo(beforeCount);
|
||||
} finally {
|
||||
CustomSecurityContextHolder.remove();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
// 测试用例:客户带随机下单请求命中默认等级与服务,接口应返回成功文案,
|
||||
// 并新增一条处于待接单状态的随机订单,金额、商品信息与 remark 与提交参数保持一致。
|
||||
|
||||
@@ -19,6 +19,48 @@ import org.springframework.http.MediaType;
|
||||
|
||||
class WxCustomRewardOrderApiTest extends WxCustomOrderApiTestSupport {
|
||||
|
||||
@Test
|
||||
void rewardOrderFailsWhenBalanceInsufficient() throws Exception {
|
||||
SecurityUtils.setTenantId(ApiTestDataSeeder.DEFAULT_TENANT_ID);
|
||||
String remark = "API reward insufficient " + IdUtils.getUuid();
|
||||
try {
|
||||
setCustomerBalance(BigDecimal.ZERO);
|
||||
String customerToken = wxTokenService.createWxUserToken(ApiTestDataSeeder.DEFAULT_CUSTOMER_ID);
|
||||
customUserInfoService.updateTokenById(ApiTestDataSeeder.DEFAULT_CUSTOMER_ID, customerToken);
|
||||
|
||||
ensureTenantContext();
|
||||
long beforeCount = playOrderInfoService.lambdaQuery()
|
||||
.eq(PlayOrderInfoEntity::getPurchaserBy, ApiTestDataSeeder.DEFAULT_CUSTOMER_ID)
|
||||
.eq(PlayOrderInfoEntity::getPlaceType, OrderConstant.PlaceType.REWARD.getCode())
|
||||
.count();
|
||||
|
||||
String payload = "{" +
|
||||
"\"clerkId\":\"" + ApiTestDataSeeder.DEFAULT_CLERK_ID + "\"," +
|
||||
"\"money\":\"18.00\"," +
|
||||
"\"weiChatCode\":\"apitest-customer-wx\"," +
|
||||
"\"remark\":\"" + remark + "\"" +
|
||||
"}";
|
||||
|
||||
mockMvc.perform(post("/wx/custom/order/reward")
|
||||
.header(USER_HEADER, DEFAULT_USER)
|
||||
.header(TENANT_HEADER, DEFAULT_TENANT)
|
||||
.header(Constants.CUSTOM_USER_LOGIN_TOKEN, Constants.TOKEN_PREFIX + customerToken)
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.content(payload))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.code").value(998));
|
||||
|
||||
ensureTenantContext();
|
||||
long afterCount = playOrderInfoService.lambdaQuery()
|
||||
.eq(PlayOrderInfoEntity::getPurchaserBy, ApiTestDataSeeder.DEFAULT_CUSTOMER_ID)
|
||||
.eq(PlayOrderInfoEntity::getPlaceType, OrderConstant.PlaceType.REWARD.getCode())
|
||||
.count();
|
||||
Assertions.assertThat(afterCount).isEqualTo(beforeCount);
|
||||
} finally {
|
||||
CustomSecurityContextHolder.remove();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
// 测试用例:客户指定打赏金额下单时,应即时扣减账户余额、生成已完成的打赏订单并同步收益记录,
|
||||
// 同时校验订单归属陪玩师正确且金额与输入一致,确保余额打赏流程闭环。
|
||||
|
||||
@@ -39,6 +39,55 @@ class WxCustomSpecifiedOrderApiTest extends WxCustomOrderApiTestSupport {
|
||||
@org.springframework.beans.factory.annotation.Autowired
|
||||
private com.starry.admin.modules.weichat.service.WxTokenService clerkWxTokenService;
|
||||
|
||||
@Test
|
||||
void specifiedOrderFailsWhenBalanceInsufficient() throws Exception {
|
||||
SecurityUtils.setTenantId(ApiTestDataSeeder.DEFAULT_TENANT_ID);
|
||||
String remark = "API specified insufficient " + IdUtils.getUuid();
|
||||
try {
|
||||
setCustomerBalance(BigDecimal.ZERO);
|
||||
String customerToken = wxTokenService.createWxUserToken(ApiTestDataSeeder.DEFAULT_CUSTOMER_ID);
|
||||
customUserInfoService.updateTokenById(ApiTestDataSeeder.DEFAULT_CUSTOMER_ID, customerToken);
|
||||
|
||||
ensureTenantContext();
|
||||
com.starry.admin.modules.clerk.module.entity.PlayClerkUserInfoEntity clerk =
|
||||
clerkUserInfoService.selectById(ApiTestDataSeeder.DEFAULT_CLERK_ID);
|
||||
Assertions.assertThat(clerk.getLevelId())
|
||||
.as("默认店员应绑定基础等级用于价格校验")
|
||||
.isEqualTo(ApiTestDataSeeder.DEFAULT_CLERK_LEVEL_ID);
|
||||
|
||||
ensureTenantContext();
|
||||
long beforeCount = playOrderInfoService.lambdaQuery()
|
||||
.eq(PlayOrderInfoEntity::getPurchaserBy, ApiTestDataSeeder.DEFAULT_CUSTOMER_ID)
|
||||
.count();
|
||||
|
||||
String payload = "{" +
|
||||
"\"clerkId\":\"" + ApiTestDataSeeder.DEFAULT_CLERK_ID + "\"," +
|
||||
"\"commodityId\":\"" + ApiTestDataSeeder.DEFAULT_COMMODITY_ID + "\"," +
|
||||
"\"commodityQuantity\":1," +
|
||||
"\"weiChatCode\":\"apitest-customer-wx\"," +
|
||||
"\"couponIds\":[]," +
|
||||
"\"remark\":\"" + remark + "\"" +
|
||||
"}";
|
||||
|
||||
mockMvc.perform(post("/wx/custom/order/commodity")
|
||||
.header(USER_HEADER, DEFAULT_USER)
|
||||
.header(TENANT_HEADER, DEFAULT_TENANT)
|
||||
.header(Constants.CUSTOM_USER_LOGIN_TOKEN, Constants.TOKEN_PREFIX + customerToken)
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.content(payload))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.code").value(998));
|
||||
|
||||
ensureTenantContext();
|
||||
long afterCount = playOrderInfoService.lambdaQuery()
|
||||
.eq(PlayOrderInfoEntity::getPurchaserBy, ApiTestDataSeeder.DEFAULT_CUSTOMER_ID)
|
||||
.count();
|
||||
Assertions.assertThat(afterCount).isEqualTo(beforeCount);
|
||||
} finally {
|
||||
CustomSecurityContextHolder.remove();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
// 测试用例:指定单取消后优惠券应恢复为未使用
|
||||
void specifiedOrderCancellationReleasesCoupon() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user