✅ 待回单确认:列表查询断言改为 Answer 捕获

This commit is contained in:
2026-10-22 14:11:18 +08:00
parent 714781d18c
commit 67480098f3
@@ -10,7 +10,6 @@ import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.mockito.ArgumentCaptor;
import org.mockito.MockedStatic;
import org.springblade.core.secure.utils.AuthUtil;
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.WaybillProcessSupport;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
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.Mockito.mock;
import static org.mockito.Mockito.mockStatic;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
/**
@@ -59,6 +58,7 @@ class DriverWaybillTabStatusTest {
private IDriverService driverService;
private WaybillNodePunchMapper nodePunchMapper;
private ExceptionDisposalMapper exceptionDisposalMapper;
private final List<Wrapper<Waybill>> queried = new ArrayList<>();
private DriverWaybillServiceImpl service;
@BeforeAll
@@ -92,7 +92,10 @@ class DriverWaybillTabStatusTest {
when(driverService.getOne(any())).thenReturn(driver());
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
@@ -143,9 +146,8 @@ class DriverWaybillTabStatusTest {
@SuppressWarnings("unchecked")
private Collection<Object> queriedStatuses() {
ArgumentCaptor<Wrapper<Waybill>> captor = ArgumentCaptor.forClass(Wrapper.class);
verify(waybillService).list(captor.capture());
return ((LambdaQueryWrapper<Waybill>) captor.getValue()).getParamNameValuePairs().values();
assertEquals(1, queried.size(), "一次列表查询");
return ((LambdaQueryWrapper<Waybill>) queried.get(0)).getParamNameValuePairs().values();
}
@SuppressWarnings("unchecked")