This commit is contained in:
2026-08-17 14:46:44 +08:00
parent b914bb7532
commit a34b5d5ba0
38 changed files with 249 additions and 115 deletions
@@ -16,5 +16,5 @@ public interface WarehouseSupplierClient {
@RequestParam(defaultValue = "true") boolean requireActive,
@RequestParam String category);
record SupplierSnapshot(long supplierId, String name, String category, String scope, String status) {}
record SupplierSnapshot(long supplierId, String name, String category, String status) {}
}
@@ -40,7 +40,7 @@ class FinanceFeeSourceEventServiceTest {
lenient().when(supplierValidator.categoryFor(any(), any())).thenReturn("TRUCKING");
lenient().when(supplierValidator.requireActive(anyLong(), any())).thenReturn(
new com.baiyue.finance.client.WarehouseSupplierClient.SupplierSnapshot(
71L, "现有供应商", "TRUCKING", "DOMESTIC", "ACTIVE"));
71L, "现有供应商", "TRUCKING", "ACTIVE"));
}
@Test
@@ -545,7 +545,7 @@ class FinanceSettlementBehaviorTest {
org.mockito.Mockito.lenient().when(supplierValidator.categoryFor(any(), any())).thenReturn("BOOKING");
org.mockito.Mockito.lenient().when(supplierValidator.requireActive(anyLong(), any()))
.thenReturn(new com.baiyue.finance.client.WarehouseSupplierClient.SupplierSnapshot(
20L, "供应商20", "BOOKING", "INTERNATIONAL", "ACTIVE"));
20L, "供应商20", "BOOKING", "ACTIVE"));
return supplierValidator;
}
@@ -28,7 +28,7 @@ class FinanceSupplierValidatorTest {
@Test
void requiresActiveWarehouseSupplierWithMatchingCategory() {
var supplier = new WarehouseSupplierClient.SupplierSnapshot(20L, "正式供应商", "TRUCKING", "DOMESTIC", "ACTIVE");
var supplier = new WarehouseSupplierClient.SupplierSnapshot(20L, "正式供应商", "TRUCKING", "ACTIVE");
when(client.get("internal-token", 20L, true, "TRUCKING")).thenReturn(ApiResponse.success(supplier));
assertThat(validator.requireActive(20L, "TRUCKING").name()).isEqualTo("正式供应商");
@@ -37,7 +37,7 @@ class FinanceSupplierValidatorTest {
@Test
void rejectsMismatchedOrUnavailableSupplier() {
var mismatched = new WarehouseSupplierClient.SupplierSnapshot(20L, "订舱供应商", "BOOKING", "INTERNATIONAL", "ACTIVE");
var mismatched = new WarehouseSupplierClient.SupplierSnapshot(20L, "订舱供应商", "BOOKING", "ACTIVE");
when(client.get("internal-token", 20L, true, "TRUCKING")).thenReturn(ApiResponse.success(mismatched));
assertCode(() -> validator.requireActive(20L, "TRUCKING"), "FIN_409");