This commit is contained in:
2026-08-22 09:51:01 +08:00
parent 1a67b3404d
commit 988d1bee7c
2 changed files with 21 additions and 13 deletions
@@ -33,20 +33,21 @@ class SmartDispatchControllerTest {
@Test
void candidatesResolveCustomerScopeFromSelectedPlans() {
when(service.resolveCustomerScopeForPlans(List.of(1L, 2L))).thenReturn("100");
when(service.candidates("100", List.of(1L, 2L), "LMO-1", "ONT8", "PLAN")).thenReturn(List.of());
when(service.candidates("100", List.of(1L, 2L), "LMO-1", "ONT8", "PLAN", "draft-1"))
.thenReturn(List.of());
controller.candidates(platform(), List.of(1L, 2L), "LMO-1", "ONT8", "PLAN");
controller.candidates(platform(), List.of(1L, 2L), "LMO-1", "ONT8", "PLAN", "draft-1");
verify(service).candidates("100", List.of(1L, 2L), "LMO-1", "ONT8", "PLAN");
verify(service).candidates("100", List.of(1L, 2L), "LMO-1", "ONT8", "PLAN", "draft-1");
}
@Test
void candidatesWithoutSelectedPlansUsePlatformScope() {
when(service.platformCandidates(null, null, "RECEIVED")).thenReturn(List.of());
when(service.platformCandidates(null, null, "RECEIVED", "draft-2")).thenReturn(List.of());
controller.candidates(platform(), null, null, null, "RECEIVED");
controller.candidates(platform(), null, null, null, "RECEIVED", "draft-2");
verify(service).platformCandidates(null, null, "RECEIVED");
verify(service).platformCandidates(null, null, "RECEIVED", "draft-2");
}
@Test
@@ -63,7 +64,8 @@ class SmartDispatchControllerTest {
@Test
void endpointsUseInboundOrderListAndDedicatedSmartDispatchAuthorities() throws Exception {
PreAuthorize candidates = SmartDispatchController.class
.getMethod("candidates", AuthenticatedUser.class, List.class, String.class, String.class, String.class)
.getMethod("candidates", AuthenticatedUser.class, List.class, String.class, String.class, String.class,
String.class)
.getAnnotation(PreAuthorize.class);
PreAuthorize preArrange = SmartDispatchController.class
.getMethod("preArrange", AuthenticatedUser.class, DispatchRequests.PreArrange.class)