提交
This commit is contained in:
+21
@@ -146,6 +146,27 @@ class InboundPlanServiceTest {
|
||||
verify(planMapper, never()).insert(any(InboundPlan.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
void convertsDropshipSourcePalletsWithoutRedistributingTheirPackages() {
|
||||
when(orderMapper.lockOrder("100", 2L)).thenReturn(List.of(order(2L, "RK-2", "1.0000", "WH-A")));
|
||||
when(orderMapper.markPlanned(any(), any(), any(), org.mockito.ArgumentMatchers.anyInt(), any()))
|
||||
.thenReturn(1);
|
||||
|
||||
service.convertDropship("100", 2L, List.of(
|
||||
new InboundPlanService.WholePalletInput("SOURCE-P-1", 3),
|
||||
new InboundPlanService.WholePalletInput("SOURCE-P-2", 7)));
|
||||
|
||||
ArgumentCaptor<InboundPlanPallet> pallets = ArgumentCaptor.forClass(InboundPlanPallet.class);
|
||||
verify(palletMapper, times(2)).insert(pallets.capture());
|
||||
assertEquals(List.of("SOURCE-P-1", "SOURCE-P-2"),
|
||||
pallets.getAllValues().stream().map(InboundPlanPallet::getPalletNo).toList());
|
||||
ArgumentCaptor<InboundPlanPalletAllocation> allocations =
|
||||
ArgumentCaptor.forClass(InboundPlanPalletAllocation.class);
|
||||
verify(allocationMapper, times(2)).insert(allocations.capture());
|
||||
assertEquals(List.of(3, 7), allocations.getAllValues().stream()
|
||||
.map(InboundPlanPalletAllocation::getPlannedPackageCount).toList());
|
||||
}
|
||||
|
||||
private SourceOrderSnapshot order(Long id, String inboundCode, String volume, String warehouse) {
|
||||
return new SourceOrderSnapshot(id, "100", "CONT-1", inboundCode, "PENDING_ASSIGNMENT", null,
|
||||
new BigDecimal(volume), new BigDecimal(volume).multiply(BigDecimal.TEN).intValue(),
|
||||
|
||||
Reference in New Issue
Block a user