|
|
@@ -851,7 +851,9 @@ class HealthPlanReviewGuardTest {
|
|
|
|
|
|
@Test
|
|
|
void getPlanForFamily_匹配返回方案() {
|
|
|
- when(mapper.selectById(99L)).thenReturn(planWithStatus("pending_review"));
|
|
|
+ HealthPlan plan = planWithStatus("pending_review");
|
|
|
+ plan.setId(99L);
|
|
|
+ when(mapper.selectById(99L)).thenReturn(plan);
|
|
|
HealthPlan p = service.getPlanForFamily(99L, 10L);
|
|
|
assertNotNull(p);
|
|
|
assertEquals(Long.valueOf(99L), p.getId());
|
|
|
@@ -2673,4 +2675,5 @@ cd /sc-data/cfc && git diff --name-only HEAD~14 HEAD | grep -E "chat\.vue|schema
|
|
|
16. `generateDailyTasksFromPlan` 返回 `void` 且有 2 处提前 return、被 3 处调用,初版「改成返回 int」风险过高 → 改为生成后查库统计。
|
|
|
17. `src/test/resources` 为空,`@SpringBootTest` 连真实 DB,`mvn test` 全量不可能稳定 `BUILD SUCCESS` → 改用分层验证口径。
|
|
|
18. guard 返回 `Result<Void>`,而各端点返回 `Result<Map<String,Object>>` / `Result<Page<Task>>` / `Result<List<Task>>` / `Result<Boolean>`;**Java 泛型不变**,初版写法 `if (denied != null) return denied;` 编译失败(7 处)→ 改为 `return Result.error(denied.getCode(), denied.getMessage());`,既通过编译又原样保留 403 与文案。
|
|
|
-19. 改 6 个方法签名会破坏**两个**测试文件:除修订 14 已列的 `GuideFamilyTaskControllerTest`(15 处调用)外,还有 `GuideRolePermissionTest`(4 处调用),修订 14 仍遗漏 → 两个文件都需补 `@MockBean GuideFamilyAccessGuard`(Mockito 默认返回 `null` 等价放行,既有用例断言不受影响)。
|
|
|
+19. 改 6 个方法签名会破坏**两个**测试文件:除修订 14 已列的 `GuideFamilyTaskControllerTest`(15 处调用)外,还有 `GuideRolePermissionTest`(4 处调用),修订 14 仍遗漏 → 两个文件都需补 `@MockBean GuideFamilyAccessGuard`(Mockito 默认返回 `null` 等价放行,既有用例断言不受影响)。
|
|
|
+20. 任务 4 测试辅助方法 `planWithStatus` 固定 `setId(5L)`,而 `getPlanForFamily_匹配返回方案` 用 `selectById(99L)` 打桩却断言 `getId()==99` → 必然失败(实测 `expected: <99> but was: <5>`)→ 该用例需显式 `plan.setId(99L)` 后再打桩。注意同一辅助方法在 `不属于该家庭返回null` 用例中无害(只断言 null)。
|