🐛 修正待回单确认单测的桩返回类型与夹具

This commit is contained in:
2026-10-22 15:30:26 +08:00
parent af7c39ebbf
commit b31b81bedf
3 changed files with 21 additions and 3 deletions
@@ -72,6 +72,13 @@ class DriverWaybillAutoCompleteTest {
{"key":"return","name":"回单","type":"confirm","enabled":true,"punch":true,"confirmMode":"yes"}]
""";
/** 装货 → 签收两个司机打卡节点,末位是签收,回单需确认完成 */
private static final String LOAD_SIGN_RETURN_CONFIRM_JSON = """
[{"key":"load","name":"装货","type":"cargo","enabled":true,"punch":true},
{"key":"sign","name":"签收","type":"cargo","enabled":true,"punch":true},
{"key":"return","name":"回单","type":"confirm","enabled":true,"punch":true,"confirmMode":"yes"}]
""";
/** 末位打卡节点是「发货」,不是到货/卸货/签收 */
private static final String DISPATCH_LAST_JSON = """
[{"key":"dispatch","name":"发货","type":"cargo","enabled":true,"punch":true}]
@@ -190,7 +197,7 @@ class DriverWaybillAutoCompleteTest {
@Test
@DisplayName("回单需确认但不是末位打卡:运单留在进行中")
void nonLastPunchDoesNotEnterReturnConfirmation() {
givenWaybill(SIGN_LAST_RETURN_CONFIRM_JSON, "running");
givenWaybill(LOAD_SIGN_RETURN_CONFIRM_JSON, "running");
DriverNodePunchVO vo = submit("load");
@@ -152,7 +152,18 @@ class DriverWaybillTabStatusTest {
@SuppressWarnings("unchecked")
private Collection<Object> queriedStatuses() {
assertEquals(1, queried.size(), "一次列表查询");
return ((LambdaQueryWrapper<Waybill>) queried.get(0)).getParamNameValuePairs().values();
LambdaQueryWrapper<Waybill> wrapper = (LambdaQueryWrapper<Waybill>) queried.get(0);
// 参数槽由 SQL 片段构建时填充:不先取一次片段,参数表是空的
wrapper.getSqlSegment();
Collection<Object> statuses = new ArrayList<>();
wrapper.getParamNameValuePairs().values().forEach(value -> {
if (value instanceof Collection<?> items) {
statuses.addAll(items);
} else {
statuses.add(value);
}
});
return statuses;
}
@SuppressWarnings("unchecked")
@@ -175,7 +175,7 @@ class WaybillEditSaveBusinessStatusTest {
when(waybillMapper.selectById(WAYBILL_ID)).thenReturn(oldRecord);
try (MockedStatic<AuthUtil> authUtil = mockStatic(AuthUtil.class)) {
authUtil.when(AuthUtil::getDeptId).thenReturn(DEPT_ID);
authUtil.when(AuthUtil::getDeptId).thenReturn(String.valueOf(DEPT_ID));
assertTrue(service.submit(request));
}
}