You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
441 lines
19 KiB
441 lines
19 KiB
|
1 week ago
|
package common.ecommerce.hengjian.adapter;
|
||
|
|
|
||
|
|
import common.ecommerce.hengjian.HengjianConstants;
|
||
|
|
import common.ecommerce.http.JacksonJsonCodec;
|
||
|
|
import common.ecommerce.shared.model.Platform;
|
||
|
|
import common.ecommerce.shared.spi.ChannelSecret;
|
||
|
|
import common.ecommerce.shared.support.Money;
|
||
|
|
import common.ecommerce.shared.testkit.RecordingTransport;
|
||
|
|
import common.ecommerce.shared.testkit.Responses;
|
||
|
|
import common.ecommerce.warehouse.enums.LabelMode;
|
||
|
|
import common.ecommerce.warehouse.enums.WarehouseCapability;
|
||
|
|
import common.ecommerce.warehouse.enums.WarehouseProvider;
|
||
|
|
import common.ecommerce.warehouse.error.WarehouseUnsupportedCapabilityException;
|
||
|
|
import common.ecommerce.warehouse.model.OutboundCommand;
|
||
|
|
import common.ecommerce.warehouse.model.OutboundLine;
|
||
|
|
import common.ecommerce.warehouse.model.OutboundReceipt;
|
||
|
|
import common.ecommerce.warehouse.model.OutboundRef;
|
||
|
|
import common.ecommerce.warehouse.model.ShipTo;
|
||
|
|
import common.ecommerce.warehouse.sdk.WarehouseConnection;
|
||
|
|
import common.ecommerce.warehouse.sdk.WarehouseContext;
|
||
|
|
import common.ecommerce.warehouse.sdk.WarehouseSdk;
|
||
|
|
import common.ecommerce.warehouse.spi.WarehouseAccount;
|
||
|
|
import common.ecommerce.warehouse.testkit.InMemoryWarehouses;
|
||
|
|
import org.junit.jupiter.api.Test;
|
||
|
|
|
||
|
|
import java.time.Clock;
|
||
|
|
import java.time.Instant;
|
||
|
|
import java.time.ZoneId;
|
||
|
|
import java.time.ZoneOffset;
|
||
|
|
|
||
|
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||
|
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||
|
|
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||
|
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 创建销售发货单({@code POST /v1/saleOrder/create})契约测试。
|
||
|
|
*/
|
||
|
|
class HengjianCreateOrderTest {
|
||
|
|
|
||
|
|
private static final Instant NOW = Instant.parse("2026-11-12T03:04:05Z");
|
||
|
|
private static final Clock CLOCK = Clock.fixed(NOW, ZoneOffset.UTC);
|
||
|
|
|
||
|
|
private static final String CREATE_BODY =
|
||
|
|
"{\"statusCode\":200,\"status\":0,\"code\":200,\"message\":\"创建订单成功\","
|
||
|
|
+ "\"data\":{\"orderId\":193252852}}";
|
||
|
|
|
||
|
|
private static WarehouseContext ctx() {
|
||
|
|
return ctx(ZoneOffset.UTC);
|
||
|
|
}
|
||
|
|
|
||
|
|
private static WarehouseContext ctx(ZoneId zone) {
|
||
|
|
return WarehouseContext.of("HJ-EFCA", WarehouseProvider.HENGJIAN, "EFCA",
|
||
|
|
WarehouseConnection.of(HengjianConstants.TEST_BASE_URL,
|
||
|
|
ChannelSecret.builder().appSecret("token-1").build(), zone),
|
||
|
|
"req-1", CLOCK);
|
||
|
|
}
|
||
|
|
|
||
|
|
private static HengjianAdapter adapter(RecordingTransport transport) {
|
||
|
|
return new HengjianAdapter(transport, new JacksonJsonCodec());
|
||
|
|
}
|
||
|
|
|
||
|
|
private static RecordingTransport creating() {
|
||
|
|
return RecordingTransport.create()
|
||
|
|
.route(HengjianConstants.PATH_ORDER_CREATE, req -> Responses.ok(CREATE_BODY));
|
||
|
|
}
|
||
|
|
|
||
|
|
private static ShipTo shipTo() {
|
||
|
|
return ShipTo.builder()
|
||
|
|
.name("Test Receiver")
|
||
|
|
.phone("555-0100")
|
||
|
|
.email("buyer@example.com")
|
||
|
|
.countryCode("US")
|
||
|
|
.stateOrProvince("CA")
|
||
|
|
.city("Los Angeles")
|
||
|
|
.addressLine1("1 Test St")
|
||
|
|
.addressLine2("Suite 2")
|
||
|
|
.postalCode("90001")
|
||
|
|
.build();
|
||
|
|
}
|
||
|
|
|
||
|
|
private static OutboundCommand.Builder order() {
|
||
|
|
return OutboundCommand.builder()
|
||
|
|
.outboundRequestNo("OB-2026-0001")
|
||
|
|
.orderRef("SO-1")
|
||
|
|
.salesPlatform(Platform.AMAZON_SC)
|
||
|
|
.carrier("UPS")
|
||
|
|
.carrierCode("UPSG_HL")
|
||
|
|
.shopName("EFCA-STORE")
|
||
|
|
.shipTo(shipTo())
|
||
|
|
.line(OutboundLine.builder()
|
||
|
|
.lineNo("1")
|
||
|
|
.omsSku("DM00001")
|
||
|
|
.quantity(2)
|
||
|
|
.declareValue(Money.of("9.99", "USD"))
|
||
|
|
.build());
|
||
|
|
}
|
||
|
|
|
||
|
|
// ---------------------------------------------------------------- 请求形状
|
||
|
|
|
||
|
|
@Test
|
||
|
|
void sendsPostToSaleOrderCreate() {
|
||
|
|
RecordingTransport transport = creating();
|
||
|
|
adapter(transport).create(ctx(), order().build());
|
||
|
|
|
||
|
|
assertEquals("POST", transport.lastDataRequest().method());
|
||
|
|
assertEquals(HengjianConstants.TEST_BASE_URL + "/v1/saleOrder/create",
|
||
|
|
transport.lastDataRequest().url());
|
||
|
|
}
|
||
|
|
|
||
|
|
/** 文档必填的字段必须全部出现。 */
|
||
|
|
@Test
|
||
|
|
void sendsAllMandatoryFields() {
|
||
|
|
RecordingTransport transport = creating();
|
||
|
|
adapter(transport).create(ctx(), order().build());
|
||
|
|
String body = transport.lastDataRequest().body();
|
||
|
|
|
||
|
|
String[] mandatory = {"orderNo", "shipToCountry", "shipToState", "shipToCity",
|
||
|
|
"shipToPostal", "shipToAddress1", "shipToContact", "shipToTelephone",
|
||
|
|
"createdAt", "productItems", "attachInfoItems"};
|
||
|
|
for (String field : mandatory) {
|
||
|
|
assertTrue(body.contains("\"" + field + "\""), "缺少必填字段 " + field + ",body=" + body);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
/** 产品行里的四个必填子字段都要有。 */
|
||
|
|
@Test
|
||
|
|
void productItemCarriesMandatoryFlags() {
|
||
|
|
RecordingTransport transport = creating();
|
||
|
|
adapter(transport).create(ctx(), order().build());
|
||
|
|
String body = transport.lastDataRequest().body();
|
||
|
|
|
||
|
|
String[] mandatory = {"sku", "quantity", "isInsure", "isSignature"};
|
||
|
|
for (String field : mandatory) {
|
||
|
|
assertTrue(body.contains("\"" + field + "\""), "产品行缺少 " + field + ",body=" + body);
|
||
|
|
}
|
||
|
|
assertTrue(body.contains("\"sku\":\"DM00001\""), body);
|
||
|
|
assertTrue(body.contains("\"quantity\":2"), body);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 恒健把 {@code attachInfoItems} 标为必填:没有附件时发空数组,
|
||
|
|
* 不能省略字段。
|
||
|
|
*/
|
||
|
|
@Test
|
||
|
|
void sendsEmptyAttachmentArrayWhenNoLabel() {
|
||
|
|
RecordingTransport transport = creating();
|
||
|
|
adapter(transport).create(ctx(), order().build());
|
||
|
|
String body = transport.lastDataRequest().body();
|
||
|
|
|
||
|
|
assertTrue(body.contains("\"attachInfoItems\":[]"),
|
||
|
|
"没有附件时应发空数组而不是省略,body=" + body);
|
||
|
|
}
|
||
|
|
|
||
|
|
/** 平台面单:base64 内容进 file,类型 0,名称优先用跟踪号。 */
|
||
|
|
@Test
|
||
|
|
void sendsPlatformLabelAsAttachment() {
|
||
|
|
RecordingTransport transport = creating();
|
||
|
|
adapter(transport).create(ctx(), order()
|
||
|
|
.labelMode(LabelMode.PLATFORM_LABEL)
|
||
|
|
.trackingNumber("1ZXH1234567890")
|
||
|
|
.labelContentBase64("data:application/pdf;base64,JVBERi0xLjQK")
|
||
|
|
.build());
|
||
|
|
String body = transport.lastDataRequest().body();
|
||
|
|
|
||
|
|
assertTrue(body.contains("\"name\":\"1ZXH1234567890\""), body);
|
||
|
|
// data URI 头必须剥掉,否则仓方会把前缀当文件内容
|
||
|
|
assertTrue(body.contains("\"file\":\"JVBERi0xLjQK\""), body);
|
||
|
|
assertFalse(body.contains("data:application/pdf"), body);
|
||
|
|
assertTrue(body.contains("\"type\":\"0\""), body);
|
||
|
|
}
|
||
|
|
|
||
|
|
/** 声明平台面单却不给文件,本地就拒绝——仓没有面单可打等于静默失败。 */
|
||
|
|
@Test
|
||
|
|
void rejectsPlatformLabelWithoutContent() {
|
||
|
|
RecordingTransport transport = creating();
|
||
|
|
IllegalArgumentException ex = assertThrows(IllegalArgumentException.class,
|
||
|
|
() -> adapter(transport).create(ctx(),
|
||
|
|
order().labelMode(LabelMode.PLATFORM_LABEL).build()));
|
||
|
|
assertTrue(ex.getMessage().contains("labelContentBase64"), ex.getMessage());
|
||
|
|
assertTrue(transport.dataRequests().isEmpty(), "本地校验失败不应发出请求");
|
||
|
|
}
|
||
|
|
|
||
|
|
/** 给了面单内容却不是平台面单模式,拒绝而不是静默丢弃。 */
|
||
|
|
@Test
|
||
|
|
void rejectsLabelContentWithoutPlatformMode() {
|
||
|
|
RecordingTransport transport = creating();
|
||
|
|
IllegalArgumentException ex = assertThrows(IllegalArgumentException.class,
|
||
|
|
() -> adapter(transport).create(ctx(),
|
||
|
|
order().labelContentBase64("JVBERi0xLjQK").build()));
|
||
|
|
assertTrue(ex.getMessage().contains("PLATFORM_LABEL"), ex.getMessage());
|
||
|
|
assertTrue(transport.dataRequests().isEmpty());
|
||
|
|
}
|
||
|
|
|
||
|
|
/** 时间按 UTC 输出,不受调用方传的时区影响。 */
|
||
|
|
@Test
|
||
|
|
void formatsTimesInUtc() {
|
||
|
|
RecordingTransport transport = creating();
|
||
|
|
adapter(transport).create(ctx(ZoneId.of("America/Los_Angeles")),
|
||
|
|
order().latestShipDate(Instant.parse("2026-11-15T23:30:00Z")).build());
|
||
|
|
String body = transport.lastDataRequest().body();
|
||
|
|
|
||
|
|
// createdAt 用注入的固定时钟
|
||
|
|
assertTrue(body.contains("\"createdAt\":\"2026-11-12 03:04:05\""), body);
|
||
|
|
assertTrue(body.contains("\"expectedShipDate\":\"2026-11-15 23:30:00\""),
|
||
|
|
"恒健要求 UTC,不能按仓所在时区输出,body=" + body);
|
||
|
|
}
|
||
|
|
|
||
|
|
/** 行金额是「当前 SKU 总金额」,申报单价要乘数量。 */
|
||
|
|
@Test
|
||
|
|
void skuAmountIsLineTotalNotUnitPrice() {
|
||
|
|
RecordingTransport transport = creating();
|
||
|
|
adapter(transport).create(ctx(), order().build());
|
||
|
|
String body = transport.lastDataRequest().body();
|
||
|
|
|
||
|
|
// 9.99 × 2 = 19.98
|
||
|
|
assertTrue(body.contains("\"skuAmount\":19.98"), "skuAmount 必须是行总额,body=" + body);
|
||
|
|
}
|
||
|
|
|
||
|
|
@Test
|
||
|
|
void usesExplicitTotalAmountWhenGiven() {
|
||
|
|
RecordingTransport transport = creating();
|
||
|
|
adapter(transport).create(ctx(), OutboundCommand.builder()
|
||
|
|
.outboundRequestNo("OB-2")
|
||
|
|
.salesPlatform(Platform.AMAZON_SC)
|
||
|
|
.shipTo(shipTo())
|
||
|
|
.line(OutboundLine.builder()
|
||
|
|
.lineNo("1")
|
||
|
|
.omsSku("DM00001")
|
||
|
|
.quantity(3)
|
||
|
|
.declareValue(Money.of("10.00", "USD"))
|
||
|
|
.totalAmount(Money.of("28.00", "USD"))
|
||
|
|
.build())
|
||
|
|
.build());
|
||
|
|
|
||
|
|
assertTrue(transport.lastDataRequest().body().contains("\"skuAmount\":28.0"));
|
||
|
|
}
|
||
|
|
|
||
|
|
/** 保价由「是否有保价金额」推导;有金额就要带 insureAmount。 */
|
||
|
|
@Test
|
||
|
|
void insuredLineSendsFlagAndAmount() {
|
||
|
|
RecordingTransport transport = creating();
|
||
|
|
adapter(transport).create(ctx(), OutboundCommand.builder()
|
||
|
|
.outboundRequestNo("OB-3")
|
||
|
|
.salesPlatform(Platform.AMAZON_SC)
|
||
|
|
.shipTo(shipTo())
|
||
|
|
.line(OutboundLine.builder()
|
||
|
|
.lineNo("1")
|
||
|
|
.omsSku("DM00001")
|
||
|
|
.quantity(1)
|
||
|
|
.insuredAmount(Money.of("100.00", "USD"))
|
||
|
|
.build())
|
||
|
|
.build());
|
||
|
|
String body = transport.lastDataRequest().body();
|
||
|
|
|
||
|
|
assertTrue(body.contains("\"isInsure\":1"), body);
|
||
|
|
assertTrue(body.contains("\"insureAmount\":100.0"), body);
|
||
|
|
}
|
||
|
|
|
||
|
|
@Test
|
||
|
|
void uninsuredLineSendsZero() {
|
||
|
|
RecordingTransport transport = creating();
|
||
|
|
adapter(transport).create(ctx(), order().build());
|
||
|
|
|
||
|
|
assertTrue(transport.lastDataRequest().body().contains("\"isInsure\":0"));
|
||
|
|
}
|
||
|
|
|
||
|
|
/** 签收:布尔值映射成 1 / 0;null 视为不签收(恒健必填,不能省略)。 */
|
||
|
|
@Test
|
||
|
|
void signatureFlagIsMandatoryAndMapped() {
|
||
|
|
RecordingTransport required = creating();
|
||
|
|
adapter(required).create(ctx(), order().signatureRequired(true).build());
|
||
|
|
assertTrue(required.lastDataRequest().body().contains("\"isSignature\":1"));
|
||
|
|
|
||
|
|
RecordingTransport notRequired = creating();
|
||
|
|
adapter(notRequired).create(ctx(), order().build());
|
||
|
|
assertTrue(notRequired.lastDataRequest().body().contains("\"isSignature\":0"));
|
||
|
|
}
|
||
|
|
|
||
|
|
@Test
|
||
|
|
void mapsShopCurrencyAndCarrier() {
|
||
|
|
RecordingTransport transport = creating();
|
||
|
|
adapter(transport).create(ctx(), order()
|
||
|
|
.currency("CAD")
|
||
|
|
.sfp(true)
|
||
|
|
.remark("买家备注")
|
||
|
|
.build());
|
||
|
|
String body = transport.lastDataRequest().body();
|
||
|
|
|
||
|
|
assertTrue(body.contains("\"channelAccount\":\"EFCA-STORE\""), body);
|
||
|
|
assertTrue(body.contains("\"currency\":\"CAD\""), body);
|
||
|
|
assertTrue(body.contains("\"carrier\":\"UPS\""), body);
|
||
|
|
assertTrue(body.contains("\"carrierCode\":\"UPSG_HL\""), body);
|
||
|
|
assertTrue(body.contains("\"isPrime\":1"), body);
|
||
|
|
assertTrue(body.contains("\"customerRemark\":\"买家备注\""), body);
|
||
|
|
}
|
||
|
|
|
||
|
|
/** 恒健没有平台维度:salesPlatform 不发,也不拿它推 isDFOrder。 */
|
||
|
|
@Test
|
||
|
|
void doesNotSendSalesPlatformOrInferDfOrder() {
|
||
|
|
RecordingTransport transport = creating();
|
||
|
|
adapter(transport).create(ctx(), order().build());
|
||
|
|
String body = transport.lastDataRequest().body();
|
||
|
|
|
||
|
|
assertFalse(body.contains("salesPlatform"), body);
|
||
|
|
assertFalse(body.contains("isDFOrder"), body);
|
||
|
|
}
|
||
|
|
|
||
|
|
/** 仓代码:命令显式指定优先,否则用账户配置。 */
|
||
|
|
@Test
|
||
|
|
void warehouseCodeResolvesFromCommandThenAccount() {
|
||
|
|
RecordingTransport fromCommand = creating();
|
||
|
|
adapter(fromCommand).create(ctx(), order().warehouseId("EFNJ").build());
|
||
|
|
assertTrue(fromCommand.lastDataRequest().body().contains("\"warehouseCode\":\"EFNJ\""));
|
||
|
|
|
||
|
|
RecordingTransport fromAccount = creating();
|
||
|
|
adapter(fromAccount).create(ctx(), order().build());
|
||
|
|
assertTrue(fromAccount.lastDataRequest().body().contains("\"warehouseCode\":\"EFCA\""));
|
||
|
|
}
|
||
|
|
|
||
|
|
// ---------------------------------------------------------------- 本地必填校验
|
||
|
|
|
||
|
|
@Test
|
||
|
|
void rejectsMissingShipToFields() {
|
||
|
|
String[] fields = {"countryCode", "stateOrProvince", "postalCode", "addressLine1",
|
||
|
|
"name", "phone", "city"};
|
||
|
|
for (String field : fields) {
|
||
|
|
ShipTo.Builder b = ShipTo.builder()
|
||
|
|
.name("N").phone("P").countryCode("US").stateOrProvince("CA")
|
||
|
|
.city("C").addressLine1("A").postalCode("Z");
|
||
|
|
if ("countryCode".equals(field)) {
|
||
|
|
b.countryCode(null);
|
||
|
|
} else if ("stateOrProvince".equals(field)) {
|
||
|
|
b.stateOrProvince(null);
|
||
|
|
} else if ("postalCode".equals(field)) {
|
||
|
|
b.postalCode(null);
|
||
|
|
} else if ("addressLine1".equals(field)) {
|
||
|
|
b.addressLine1(null);
|
||
|
|
} else if ("name".equals(field)) {
|
||
|
|
b.name(null);
|
||
|
|
} else if ("phone".equals(field)) {
|
||
|
|
b.phone(null);
|
||
|
|
} else {
|
||
|
|
b.city(null);
|
||
|
|
}
|
||
|
|
OutboundCommand cmd = OutboundCommand.builder()
|
||
|
|
.outboundRequestNo("OB-X")
|
||
|
|
.salesPlatform(Platform.AMAZON_SC)
|
||
|
|
.shipTo(b.build())
|
||
|
|
.line(OutboundLine.builder().lineNo("1").omsSku("S").quantity(1).build())
|
||
|
|
.build();
|
||
|
|
assertThrows(IllegalArgumentException.class,
|
||
|
|
() -> adapter(creating()).create(ctx(), cmd), field);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
// ---------------------------------------------------------------- 响应
|
||
|
|
|
||
|
|
@Test
|
||
|
|
void readsProviderOrderIdFromData() {
|
||
|
|
RecordingTransport transport = creating();
|
||
|
|
OutboundReceipt receipt = adapter(transport).create(ctx(), order().build());
|
||
|
|
|
||
|
|
assertEquals("OB-2026-0001", receipt.outboundRequestNo());
|
||
|
|
assertEquals("193252852", receipt.providerOrderId(), "仓内部数字 id 必须落库,取消时要用");
|
||
|
|
assertEquals("创建订单成功", receipt.rawStatus());
|
||
|
|
}
|
||
|
|
|
||
|
|
/** 没有 orderId 不能当成功:后续取消需要它。 */
|
||
|
|
@Test
|
||
|
|
void rejectsResponseWithoutOrderId() {
|
||
|
|
RecordingTransport transport = RecordingTransport.create()
|
||
|
|
.route(HengjianConstants.PATH_ORDER_CREATE, req -> Responses.ok(
|
||
|
|
"{\"statusCode\":200,\"status\":0,\"code\":200,\"message\":\"ok\"}"));
|
||
|
|
|
||
|
|
RuntimeException ex = assertThrows(RuntimeException.class,
|
||
|
|
() -> adapter(transport).create(ctx(), order().build()));
|
||
|
|
assertTrue(ex.getMessage().contains("data.orderId"), ex.getMessage());
|
||
|
|
}
|
||
|
|
|
||
|
|
@Test
|
||
|
|
void businessErrorIsPropagated() {
|
||
|
|
RecordingTransport transport = RecordingTransport.create()
|
||
|
|
.route(HengjianConstants.PATH_ORDER_CREATE, req -> Responses.ok(
|
||
|
|
"{\"code\":500,\"message\":\"仓库不存在\"}"));
|
||
|
|
|
||
|
|
RuntimeException ex = assertThrows(RuntimeException.class,
|
||
|
|
() -> adapter(transport).create(ctx(), order().build()));
|
||
|
|
assertTrue(ex.getMessage().contains("仓库不存在"), ex.getMessage());
|
||
|
|
}
|
||
|
|
|
||
|
|
// ---------------------------------------------------------------- 能力位与未接入接口
|
||
|
|
|
||
|
|
@Test
|
||
|
|
void declaresOutboundAndLabelCapabilities() {
|
||
|
|
HengjianAdapter adapter = adapter(RecordingTransport.create());
|
||
|
|
|
||
|
|
assertTrue(adapter.capabilities().contains(WarehouseCapability.OUTBOUND));
|
||
|
|
assertTrue(adapter.capabilities().contains(WarehouseCapability.PLATFORM_LABEL_DELIVERY));
|
||
|
|
}
|
||
|
|
|
||
|
|
/** 查询 / 取消还没接:显式拒绝,不返回 null 或空集合。 */
|
||
|
|
@Test
|
||
|
|
void unimplementedOutboundMethodsThrow() {
|
||
|
|
HengjianAdapter adapter = adapter(RecordingTransport.create());
|
||
|
|
|
||
|
|
assertThrows(RuntimeException.class,
|
||
|
|
() -> adapter.get(ctx(), OutboundRef.ofRequestNo("OB-1")));
|
||
|
|
assertThrows(RuntimeException.class,
|
||
|
|
() -> adapter.packages(ctx(), OutboundRef.ofRequestNo("OB-1")));
|
||
|
|
assertThrows(RuntimeException.class,
|
||
|
|
() -> adapter.checkCancel(ctx(), OutboundRef.ofRequestNo("OB-1")));
|
||
|
|
assertThrows(RuntimeException.class,
|
||
|
|
() -> adapter.cancel(ctx(), common.ecommerce.warehouse.model.CancelCommand.builder()
|
||
|
|
.outboundRequestNo("OB-1").build()));
|
||
|
|
}
|
||
|
|
|
||
|
|
/** 未声明的能力位仍然被门面挡住(INVENTORY_QUERY 还没接)。 */
|
||
|
|
@Test
|
||
|
|
void undeclaredCapabilityIsRejectedByFacade() {
|
||
|
|
WarehouseSdk sdk = WarehouseSdk.builder()
|
||
|
|
.warehouseRepository(new InMemoryWarehouses().put(WarehouseAccount.builder()
|
||
|
|
.warehouseCode("HJ-EFCA")
|
||
|
|
.provider(WarehouseProvider.HENGJIAN.name())
|
||
|
|
.providerWarehouseId("EFCA")
|
||
|
|
.credentialRef("kms://test")
|
||
|
|
.timeZone("America/Los_Angeles")
|
||
|
|
.build()))
|
||
|
|
.clock(CLOCK)
|
||
|
|
.register(new HengjianAdapterFactory())
|
||
|
|
.build();
|
||
|
|
|
||
|
|
assertThrows(WarehouseUnsupportedCapabilityException.class,
|
||
|
|
() -> sdk.warehouses("HJ-EFCA", WarehouseConnection.of(
|
||
|
|
HengjianConstants.TEST_BASE_URL,
|
||
|
|
ChannelSecret.builder().appSecret("t").build(),
|
||
|
|
ZoneOffset.UTC))
|
||
|
|
.inventory().query(null));
|
||
|
|
}
|
||
|
|
}
|