|
|
@@ -1,10 +1,12 @@
|
|
|
package com.ruoyi.app.mendian;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.ruoyi.app.user.MerchantTokenSessionService;
|
|
|
import com.ruoyi.common.utils.MessageUtils;
|
|
|
import com.ruoyi.system.domain.InfoUser;
|
|
|
import com.ruoyi.system.domain.PosFood;
|
|
|
import com.ruoyi.system.service.IInfoUserService;
|
|
|
+import com.ruoyi.system.service.IPosFenleiService;
|
|
|
import com.ruoyi.system.service.IPosFoodService;
|
|
|
import com.ruoyi.system.utils.JwtUtil;
|
|
|
import org.junit.jupiter.api.AfterEach;
|
|
|
@@ -32,6 +34,12 @@ class PosFoodControllerShelfFilterTest {
|
|
|
@Mock
|
|
|
private IInfoUserService infoUserService;
|
|
|
|
|
|
+ @Mock
|
|
|
+ private IPosFenleiService posFenleiService;
|
|
|
+
|
|
|
+ @Mock
|
|
|
+ private MerchantTokenSessionService merchantTokenSessionService;
|
|
|
+
|
|
|
@InjectMocks
|
|
|
private PosFoodController controller;
|
|
|
|
|
|
@@ -56,7 +64,8 @@ class PosFoodControllerShelfFilterTest {
|
|
|
void getidlistExcludesOffShelfFoodsWhenNoShelfFilterIsProvided() {
|
|
|
InfoUser user = new InfoUser();
|
|
|
user.setUserType("0");
|
|
|
- when(infoUserService.getById("101")).thenReturn(user);
|
|
|
+ when(merchantTokenSessionService.requireUserId(anyString())).thenReturn(101L);
|
|
|
+ when(infoUserService.getById(101L)).thenReturn(user);
|
|
|
when(posFoodService.list(any(QueryWrapper.class))).thenReturn(Collections.emptyList());
|
|
|
|
|
|
controller.getidlist(JwtUtil.token("101", "customer"), 9, "", null, null);
|