Test #1

Merged
admin merged 1726 commits from test into main 2026-09-17 11:52:45 +08:00
2 changed files with 23 additions and 1 deletions
Showing only changes of commit a381d443da - Show all commits
@@ -58,7 +58,7 @@ class FeeManagementContractTest {
.contains("ContainerFeeAdjustRequest:")
.contains("required: [expectedSourceVersion, businessDate, amount]")
.contains("additionalProperties: false")
.contains("费用方向、费用项目、往来单位、币种和备注保持原快照")
.contains("费用方向、费用项目、供应商、币种和备注保持原快照")
.contains("旧版本异参、已作废或非已审核状态返回 A0409 且零写入");
}
@@ -107,6 +107,13 @@ class FeeManagementContractTest {
assertThat(stringMap(properties(schemas, "FeeItemSaveRequest").get("feeCode")))
.containsEntry("maxLength", 50)
.containsEntry("pattern", "^[A-Za-z0-9_-]+$");
Map<String, Object> supplierCategory = stringMap(
properties(schemas, "FeeItemSaveRequest").get("supplierCategory"));
assertThat(supplierCategory)
.containsEntry("nullable", true)
.containsEntry("enum", List.of("BOOKING", "CUSTOMS", "TRUCKING", "CERTIFICATE"));
assertThat(list(stringMap(schemas.get("FeeItemSaveRequest")).get("required")))
.doesNotContain("supplierCategory");
}
private static void assertPermission(String methodName, String permission) {
@@ -3,8 +3,11 @@ package com.baiyue.firstleg.controller;
import com.baiyue.common.core.exception.BizException;
import com.baiyue.firstleg.service.FinanceFeeSourceSnapshotService;
import org.junit.jupiter.api.Test;
import org.springframework.core.io.ClassPathResource;
import org.springframework.test.util.ReflectionTestUtils;
import java.nio.charset.StandardCharsets;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.mockito.Mockito.mock;
@@ -40,6 +43,18 @@ class InternalFinanceFeeSourceControllerTest {
assertThat(methodPath("container")).isEqualTo("/containers/{containerId}/fees/{feeId}/source-snapshot");
}
@Test
void openApiRequiresExactSourceVersionAndDocumentsSupplierConstraint() throws Exception {
String source = new ClassPathResource("openapi/firstleg-v1.yaml")
.getContentAsString(StandardCharsets.UTF_8);
assertThat(source)
.contains("/internal/firstleg/v1/inbounds/{inboundId}/fees/{feeId}/source-snapshot:")
.contains("/internal/firstleg/v1/containers/{containerId}/fees/{feeId}/source-snapshot:")
.contains("{name: sourceVersion, in: query, required: true")
.contains("supplierCategory: {type: string, enum: [BOOKING, CUSTOMS, TRUCKING, CERTIFICATE], nullable: true")
.contains("为空时仅要求供应商ACTIVE");
}
private InternalFinanceFeeSourceController controller() {
InternalFinanceFeeSourceController value = new InternalFinanceFeeSourceController(service);
ReflectionTestUtils.setField(value, "expectedToken", "finance-token");