优化
This commit is contained in:
@@ -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");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user