test(firstleg): harden pallet option page contract
This commit is contained in:
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user