This commit is contained in:
2026-09-10 14:16:24 +08:00
parent 0dc0053787
commit 6d0cd3e301
2 changed files with 11 additions and 1 deletions
@@ -33,7 +33,7 @@ class ContainerCustomsControllerContractTest {
String yaml=new ClassPathResource("openapi/customs-v1.yaml").getContentAsString(java.nio.charset.StandardCharsets.UTF_8);
new Yaml().load(yaml);
assertThat(yaml).contains("ContainerView:","DocumentView:","FileView:","InboundView:","ActionRequest:","ScopeRequest:")
.contains("merchantStatus:","WAITING_UPLOAD","CUSTOMS_COMPLETED","loadingPlanId:","hasActualCargo:")
.contains("merchantStatus:","WAITING_UPLOAD","CUSTOMS_COMPLETED","loadingPlanId:","hasActualCargo:","nullable: true")
.contains("LOADING_LIST_BUY_DECLARATION_ITEMS")
.doesNotContain("/cases/","CUSTOMS_DECLARATION");
}
@@ -60,6 +60,16 @@ class ContainerCustomsServiceTest {
verify(mapper).insertContainer(anyLong(),eq(9L),eq(8L),eq(ContainerCustomsService.READY));
}
@Test void editingPlanReturnsNoCustomsAggregateInsteadOfConflict(){
when(mapper.planInbounds(9L)).thenReturn(List.of(new ContainerCustomsMapper.InboundRow(
9L,"LP9",8L,"EDITING","CAB","C",11L,21L,"O","I",7L,"客户","TAX_REFUND")));
assertThat(service.platformView(9L)).isNull();
verify(mapper,never()).insertContainer(anyLong(),anyLong(),anyLong(),anyString());
verify(mapper,never()).container(9L);
}
@Test void completedPlanWithoutActualCargoCannotStartCustoms(){
when(mapper.claimCommand(anyLong(),eq(5L),eq("START_CONTAINER_CUSTOMS_9"),eq("empty-plan"),anyString())).thenReturn(1);
when(mapper.planInbounds(9L)).thenReturn(List.of());