liujie
2026-09-17 825a575deb96cce822468bb9d9ac3e4eea0f91d1
backend/src/test/java/com/tourguide/modules/user/service/GuideAutoDisableServiceTest.java
@@ -58,6 +58,21 @@
    }
    @Test
    void shouldRestoreAutomaticallyDisabledGuideNoLongerMatchingRule() {
        GuideAutoDisableConfig config = validConfig();
        when(configMapper.selectById(1)).thenReturn(config);
        when(guideUserMapper.restoreAutoDisabledGuidesNoLongerEligible(10, new BigDecimal("4.50")))
                .thenReturn(1);
        when(guideUserMapper.selectList(any())).thenReturn(Collections.emptyList());
        service.synchronizeGuideStatuses();
        verify(guideUserMapper).restoreAutoDisabledGuidesNoLongerEligible(10, new BigDecimal("4.50"));
        verify(guideUserMapper, never()).autoDisableIfEligible(any(), any(), any());
        verifyNoInteractions(orderMapper, realtimeStatusMapper, receivingSessionMapper);
    }
    @Test
    void shouldNotDisableGuideWithoutAnEffectiveRating() {
        GuideUser guide = eligibleGuide(0);
        guide.setRating(BigDecimal.ZERO);
@@ -128,6 +143,7 @@
        service.disableEligibleGuides();
        verify(guideUserMapper, never()).selectList(any());
        verify(guideUserMapper, never()).restoreAutoDisabledGuidesNoLongerEligible(any(), any());
        verifyNoInteractions(orderMapper, realtimeStatusMapper, receivingSessionMapper);
    }