fix iam and order deployment test contracts

This commit is contained in:
2026-08-13 13:01:51 +08:00
parent e5fda0899e
commit a16b41eb8c
3 changed files with 14 additions and 4 deletions
@@ -236,7 +236,7 @@ class OrderApplicationServiceStateTest {
OrderMasterDataGuard masterData = mock(OrderMasterDataGuard.class);
OrderEntity order = persistedDraft("SELF_EXPRESS", "OVERSEAS");
when(repository.findOwned(20002L, 1L)).thenReturn(order);
when(repository.findCargo(20002L, 1L)).thenReturn(List.of(new OrderCargoEntity()));
when(repository.findCargo(20002L, 1L)).thenReturn(List.of(completeCargo()));
when(repository.findParties(20002L, 1L)).thenReturn(List.of());
when(repository.saveOrder(20002L, order)).thenReturn(1);
@@ -271,7 +271,7 @@ class OrderApplicationServiceStateTest {
OrderPricingChannelGuard pricing = mock(OrderPricingChannelGuard.class);
OrderEntity order = persistedDraft("SELF_EXPRESS", "OVERSEAS");
when(repository.findOwned(20002L, 1L)).thenReturn(order);
when(repository.findCargo(20002L, 1L)).thenReturn(List.of(new OrderCargoEntity()));
when(repository.findCargo(20002L, 1L)).thenReturn(List.of(completeCargo()));
when(repository.findParties(20002L, 1L)).thenReturn(List.of());
doThrow(new BizException(ResultCode.CONFLICT, "所选渠道已下线,请重新选择"))
.when(pricing).requireAvailable(20002L, 8L, "CH");
@@ -568,6 +568,16 @@ class OrderApplicationServiceStateTest {
return order;
}
private OrderCargoEntity completeCargo() {
OrderCargoEntity cargo = new OrderCargoEntity();
cargo.setCargoName("货物");
cargo.setPackageType("CARTON");
cargo.setPackageCount(1);
cargo.setGrossWeightKg(BigDecimal.ONE);
cargo.setVolumeCbm(BigDecimal.ONE);
return cargo;
}
private OrderEntity persistedOrder(OrderStatus status) {
OrderEntity order = new OrderEntity();
order.setId(1L);