test(firstleg): harden pallet option page contract

This commit is contained in:
2026-09-01 11:03:40 +08:00
parent 7ace1ded56
commit 4991536065
6 changed files with 57 additions and 8 deletions
@@ -254,6 +254,30 @@ class InboundMeasurementServiceTest {
verify(warehousePallets).palletSnapshots("internal-token", 100L, 1L, 20L, "TP-5");
}
@Test
void weightPalletOptionsFailsClosedOnWarehouseNon2xxResponse() {
InboundOrderEntity inbound = inbound("WAIT_MEASURE");
when(repository.findInbound(1L, 10L)).thenReturn(inbound);
when(warehousePallets.palletSnapshots("internal-token", 100L, 1L, 20L, "TP-5"))
.thenThrow(mock(feign.FeignException.class));
assertThatThrownBy(() -> service.weightPalletOptions(1L, 10L, 1L, 20L, "TP-5"))
.isInstanceOf(BizException.class)
.hasMessageContaining("仓库服务暂不可用");
}
@Test
void weightPalletOptionsFailsClosedOnWarehouseNetworkError() {
InboundOrderEntity inbound = inbound("WAIT_MEASURE");
when(repository.findInbound(1L, 10L)).thenReturn(inbound);
when(warehousePallets.palletSnapshots("internal-token", 100L, 1L, 20L, null))
.thenThrow(mock(feign.RetryableException.class));
assertThatThrownBy(() -> service.weightPalletOptions(1L, 10L, 1L, 20L, null))
.isInstanceOf(BizException.class)
.hasMessageContaining("仓库服务暂不可用");
}
@Test
void creatingWeightResultRejectsPalletOutsideTheInboundWarehouse() {
InboundOrderEntity inbound = inbound("WAIT_MEASURE");