提交
This commit is contained in:
+25
-3
@@ -86,6 +86,28 @@ class DispatchServiceTest {
|
||||
verify(candidates, never()).available(any(), any(), any(), any());
|
||||
}
|
||||
|
||||
@Test
|
||||
void resolvesOnlyCustomerScopeAndRejectsMultipleCustomers() {
|
||||
when(candidates.findCustomerScopes()).thenReturn(List.of("100"));
|
||||
assertEquals("100", service.resolveSingleCustomerScope());
|
||||
|
||||
when(candidates.findCustomerScopes()).thenReturn(List.of("100", "200"));
|
||||
ResponseStatusException exception = assertThrows(ResponseStatusException.class,
|
||||
() -> service.resolveSingleCustomerScope());
|
||||
assertEquals(409, exception.getStatusCode().value());
|
||||
}
|
||||
|
||||
@Test
|
||||
void emptyCustomerScopeProducesEmptyCandidatesAndRejectsPreArrange() {
|
||||
assertEquals(List.of(), service.candidates(null, null, null, null));
|
||||
verify(candidates, never()).available(any(), any(), any(), any());
|
||||
|
||||
ResponseStatusException exception = assertThrows(ResponseStatusException.class,
|
||||
() -> service.preArrange(null, "7",
|
||||
new DispatchRequests.PreArrange(List.of(10L), null, null, null, null)));
|
||||
assertEquals(409, exception.getStatusCode().value());
|
||||
}
|
||||
|
||||
@Test
|
||||
void editCannotBypassPdaManagedDispatchStatus() {
|
||||
DispatchOrder dispatch = new DispatchOrder();
|
||||
@@ -105,14 +127,14 @@ class DispatchServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void platformDetailFindsDispatchGloballyAndLoadsItemsWithRecordCustomer() {
|
||||
void detailUsesResolvedCustomerScopeAndLoadsItems() {
|
||||
DispatchOrder dispatch = new DispatchOrder();
|
||||
dispatch.setId(1L);
|
||||
dispatch.setCustomerId("200");
|
||||
dispatch.setDispatchNo("PC1");
|
||||
when(orders.findAnyByDispatchNo("PC1")).thenReturn(dispatch);
|
||||
when(orders.findByDispatchNo("200", "PC1")).thenReturn(dispatch);
|
||||
|
||||
service.detail(null, "PC1");
|
||||
service.detail("200", "PC1");
|
||||
|
||||
verify(items).findByDispatchOrder("200", 1L);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user