test(warehouse): cover PDA occupancy package counts
This commit is contained in:
+21
@@ -119,6 +119,27 @@ class PalletLocationAllocationServiceTest {
|
||||
verify(pallets, never()).findAvailable(any(Long.class), any(Long.class), any(), any(), any(Integer.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
void confirmPersistsPackageCountOnEveryOccupancyTarget() {
|
||||
LocationDtos.ActiveResource resource = new LocationDtos.ActiveResource(
|
||||
101L, 201L, 20L, 30L, "TP-001", 40L, "A-01", false, "RESERVED");
|
||||
when(locations.findActiveResources(10001L, "FIRSTLEG", 88L)).thenReturn(List.of(resource));
|
||||
when(locations.confirmOccupied(any())).thenReturn(List.of(new LocationDtos.OccupancyResult(
|
||||
301L, "OC-301", 101L, 30L, 40L, "A-01", false)));
|
||||
when(pallets.transitionStatus(10001L, 20L, 30L, List.of("RESERVED"), "OCCUPIED"))
|
||||
.thenReturn(1);
|
||||
|
||||
service.confirm(new PalletAllocationDtos.ConfirmRequest(10001L, 20L, "FIRSTLEG", 88L,
|
||||
9001L, new BigDecimal("1.0"), new BigDecimal("2.0"), 20));
|
||||
|
||||
org.mockito.ArgumentCaptor<LocationDtos.ConfirmCommand> command =
|
||||
org.mockito.ArgumentCaptor.forClass(LocationDtos.ConfirmCommand.class);
|
||||
verify(locations).confirmOccupied(command.capture());
|
||||
assertThat(command.getValue().targets()).singleElement()
|
||||
.extracting(LocationDtos.OccupancyTarget::allocatedPackageCount)
|
||||
.isEqualTo(20);
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldReleaseOnlyPalletsReturnedBySelectedLocationRelease() {
|
||||
var resource = new LocationDtos.ExactSelectiveReleaseResult(
|
||||
|
||||
Reference in New Issue
Block a user