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")