提交
This commit is contained in:
+24
-4
@@ -82,8 +82,28 @@ class DispatchServiceTest {
|
||||
|
||||
@Test
|
||||
void invalidCandidateStageIsRejected() {
|
||||
assertThrows(ResponseStatusException.class, () -> service.candidates("100", null, null, "INVALID"));
|
||||
verify(candidates, never()).available(any(), any(), any(), any());
|
||||
assertThrows(ResponseStatusException.class,
|
||||
() -> service.candidates("100", List.of(1L), null, null, "INVALID"));
|
||||
verify(candidates, never()).available(any(), any(), any(), any(), any());
|
||||
}
|
||||
|
||||
@Test
|
||||
void resolvesCustomerFromSelectedPlansAndPalletsInMultiCustomerDeployment() {
|
||||
when(candidates.findCustomerScopesByPlanIds(List.of(1L, 2L))).thenReturn(List.of("100"));
|
||||
when(candidates.findCustomerScopesByPlanPalletIds(List.of(10L, 11L))).thenReturn(List.of("100"));
|
||||
|
||||
assertEquals("100", service.resolveCustomerScopeForPlans(List.of(2L, 1L, 1L)));
|
||||
assertEquals("100", service.resolveCustomerScopeForPallets(List.of(11L, 10L)));
|
||||
}
|
||||
|
||||
@Test
|
||||
void rejectsSelectedPlansThatSpanCustomers() {
|
||||
when(candidates.findCustomerScopesByPlanIds(List.of(1L, 2L))).thenReturn(List.of("100", "200"));
|
||||
|
||||
ResponseStatusException exception = assertThrows(ResponseStatusException.class,
|
||||
() -> service.resolveCustomerScopeForPlans(List.of(1L, 2L)));
|
||||
|
||||
assertEquals(409, exception.getStatusCode().value());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -99,8 +119,8 @@ class DispatchServiceTest {
|
||||
|
||||
@Test
|
||||
void emptyCustomerScopeProducesEmptyCandidatesAndRejectsPreArrange() {
|
||||
assertEquals(List.of(), service.candidates(null, null, null, null));
|
||||
verify(candidates, never()).available(any(), any(), any(), any());
|
||||
assertEquals(List.of(), service.candidates(null, null, null, null, null));
|
||||
verify(candidates, never()).available(any(), any(), any(), any(), any());
|
||||
|
||||
ResponseStatusException exception = assertThrows(ResponseStatusException.class,
|
||||
() -> service.preArrange(null, "7",
|
||||
|
||||
Reference in New Issue
Block a user