From 67480098f35f5a0eb7f38c6aa0d8a2a4e4607420 Mon Sep 17 00:00:00 2001 From: weicw1996 Date: Thu, 22 Oct 2026 14:11:18 +0800 Subject: [PATCH] =?UTF-8?q?:white=5Fcheck=5Fmark:=20=E5=BE=85=E5=9B=9E?= =?UTF-8?q?=E5=8D=95=E7=A1=AE=E8=AE=A4=EF=BC=9A=E5=88=97=E8=A1=A8=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E6=96=AD=E8=A8=80=E6=94=B9=E4=B8=BA=20Answer=20?= =?UTF-8?q?=E6=8D=95=E8=8E=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/DriverWaybillTabStatusTest.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/blade-service/blade-transport/src/test/java/org/springblade/transport/service/impl/DriverWaybillTabStatusTest.java b/blade-service/blade-transport/src/test/java/org/springblade/transport/service/impl/DriverWaybillTabStatusTest.java index 802564b0..c556a398 100644 --- a/blade-service/blade-transport/src/test/java/org/springblade/transport/service/impl/DriverWaybillTabStatusTest.java +++ b/blade-service/blade-transport/src/test/java/org/springblade/transport/service/impl/DriverWaybillTabStatusTest.java @@ -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> 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 queriedStatuses() { - ArgumentCaptor> captor = ArgumentCaptor.forClass(Wrapper.class); - verify(waybillService).list(captor.capture()); - return ((LambdaQueryWrapper) captor.getValue()).getParamNameValuePairs().values(); + assertEquals(1, queried.size(), "一次列表查询"); + return ((LambdaQueryWrapper) queried.get(0)).getParamNameValuePairs().values(); } @SuppressWarnings("unchecked")