✅ 待回单确认:列表查询断言改为 Answer 捕获
This commit is contained in:
+8
-6
@@ -10,7 +10,6 @@ import org.junit.jupiter.api.BeforeAll;
|
|||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.DisplayName;
|
import org.junit.jupiter.api.DisplayName;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.mockito.ArgumentCaptor;
|
|
||||||
import org.mockito.MockedStatic;
|
import org.mockito.MockedStatic;
|
||||||
import org.springblade.core.secure.utils.AuthUtil;
|
import org.springblade.core.secure.utils.AuthUtil;
|
||||||
import org.springblade.system.feign.IMpUserClient;
|
import org.springblade.system.feign.IMpUserClient;
|
||||||
@@ -30,6 +29,7 @@ import org.springblade.transport.service.IWaybillService;
|
|||||||
import org.springblade.transport.support.CertificationGate;
|
import org.springblade.transport.support.CertificationGate;
|
||||||
import org.springblade.transport.support.WaybillProcessSupport;
|
import org.springblade.transport.support.WaybillProcessSupport;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
@@ -39,7 +39,6 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
|||||||
import static org.mockito.ArgumentMatchers.any;
|
import static org.mockito.ArgumentMatchers.any;
|
||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
import static org.mockito.Mockito.mockStatic;
|
import static org.mockito.Mockito.mockStatic;
|
||||||
import static org.mockito.Mockito.verify;
|
|
||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -59,6 +58,7 @@ class DriverWaybillTabStatusTest {
|
|||||||
private IDriverService driverService;
|
private IDriverService driverService;
|
||||||
private WaybillNodePunchMapper nodePunchMapper;
|
private WaybillNodePunchMapper nodePunchMapper;
|
||||||
private ExceptionDisposalMapper exceptionDisposalMapper;
|
private ExceptionDisposalMapper exceptionDisposalMapper;
|
||||||
|
private final List<Wrapper<Waybill>> queried = new ArrayList<>();
|
||||||
private DriverWaybillServiceImpl service;
|
private DriverWaybillServiceImpl service;
|
||||||
|
|
||||||
@BeforeAll
|
@BeforeAll
|
||||||
@@ -92,7 +92,10 @@ class DriverWaybillTabStatusTest {
|
|||||||
|
|
||||||
when(driverService.getOne(any())).thenReturn(driver());
|
when(driverService.getOne(any())).thenReturn(driver());
|
||||||
when(waybillService.syncDriverAcceptState(any())).thenAnswer(invocation -> invocation.getArgument(0));
|
when(waybillService.syncDriverAcceptState(any())).thenAnswer(invocation -> invocation.getArgument(0));
|
||||||
when(waybillService.list(anyWrapper())).thenReturn(List.of(pendingReturnConfirmWaybill()));
|
when(waybillService.list(anyWrapper())).thenAnswer(invocation -> {
|
||||||
|
queried.add(invocation.getArgument(0));
|
||||||
|
return List.of(pendingReturnConfirmWaybill());
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -143,9 +146,8 @@ class DriverWaybillTabStatusTest {
|
|||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
private Collection<Object> queriedStatuses() {
|
private Collection<Object> queriedStatuses() {
|
||||||
ArgumentCaptor<Wrapper<Waybill>> captor = ArgumentCaptor.forClass(Wrapper.class);
|
assertEquals(1, queried.size(), "一次列表查询");
|
||||||
verify(waybillService).list(captor.capture());
|
return ((LambdaQueryWrapper<Waybill>) queried.get(0)).getParamNameValuePairs().values();
|
||||||
return ((LambdaQueryWrapper<Waybill>) captor.getValue()).getParamNameValuePairs().values();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
|
|||||||
Reference in New Issue
Block a user