优化
This commit is contained in:
+8
-1
@@ -58,7 +58,7 @@ class FeeManagementContractTest {
|
|||||||
.contains("ContainerFeeAdjustRequest:")
|
.contains("ContainerFeeAdjustRequest:")
|
||||||
.contains("required: [expectedSourceVersion, businessDate, amount]")
|
.contains("required: [expectedSourceVersion, businessDate, amount]")
|
||||||
.contains("additionalProperties: false")
|
.contains("additionalProperties: false")
|
||||||
.contains("费用方向、费用项目、往来单位、币种和备注保持原快照")
|
.contains("费用方向、费用项目、供应商、币种和备注保持原快照")
|
||||||
.contains("旧版本异参、已作废或非已审核状态返回 A0409 且零写入");
|
.contains("旧版本异参、已作废或非已审核状态返回 A0409 且零写入");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,6 +107,13 @@ class FeeManagementContractTest {
|
|||||||
assertThat(stringMap(properties(schemas, "FeeItemSaveRequest").get("feeCode")))
|
assertThat(stringMap(properties(schemas, "FeeItemSaveRequest").get("feeCode")))
|
||||||
.containsEntry("maxLength", 50)
|
.containsEntry("maxLength", 50)
|
||||||
.containsEntry("pattern", "^[A-Za-z0-9_-]+$");
|
.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) {
|
private static void assertPermission(String methodName, String permission) {
|
||||||
|
|||||||
+15
@@ -3,8 +3,11 @@ package com.baiyue.firstleg.controller;
|
|||||||
import com.baiyue.common.core.exception.BizException;
|
import com.baiyue.common.core.exception.BizException;
|
||||||
import com.baiyue.firstleg.service.FinanceFeeSourceSnapshotService;
|
import com.baiyue.firstleg.service.FinanceFeeSourceSnapshotService;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.springframework.core.io.ClassPathResource;
|
||||||
import org.springframework.test.util.ReflectionTestUtils;
|
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.assertThat;
|
||||||
import static org.assertj.core.api.Assertions.assertThatThrownBy;
|
import static org.assertj.core.api.Assertions.assertThatThrownBy;
|
||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
@@ -40,6 +43,18 @@ class InternalFinanceFeeSourceControllerTest {
|
|||||||
assertThat(methodPath("container")).isEqualTo("/containers/{containerId}/fees/{feeId}/source-snapshot");
|
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() {
|
private InternalFinanceFeeSourceController controller() {
|
||||||
InternalFinanceFeeSourceController value = new InternalFinanceFeeSourceController(service);
|
InternalFinanceFeeSourceController value = new InternalFinanceFeeSourceController(service);
|
||||||
ReflectionTestUtils.setField(value, "expectedToken", "finance-token");
|
ReflectionTestUtils.setField(value, "expectedToken", "finance-token");
|
||||||
|
|||||||
Reference in New Issue
Block a user