Browse Source
销毁能力此前只有接口和端点常量,没有任何实现。补齐: - DestructionCommand:单号 / 仓 / 库存类型 / 期望销毁日期 / 商品行 / 附件 - AttachmentType 底层枚举(面单 / 装箱单 / 提单 / 其他),仓方码由 YqnDestructionMapper 映射为 0/1/2/3 - DestructionCapable.create 改收命令对象;门面改为经幂等守卫, 幂等键 warehouseCode + destructionNo + create(销毁会减库存,重复下发等于报废两次) 三处接口特性和其它接口不同: - 路径与旧常量不一致:/destroyplan/DestructionPlanCreate → 文档给出的 /v1/destroyPlan/createDestroyPlan - 期望日期字段名是 hopeDestroyData(Data 不是 Date),照原样发 - 响应只有 destroyPlanOrderNo,没有状态。所以新建单据的 status/rawStatus 留空,Javadoc 明确写了「创建成功 ≠ 已执行销毁」 另修一处签名冲突:DestructionCapable.get(ctx, String) 与 OutboundCapable.get 擦除后同签名,改为 getDestruction。查询接口仓方未提供,显式抛不支持。 顺带修正上一提交的轨迹成功码判定:该文档示例是自动生成的占位符 (message:"example"),code=1 不可靠,且同站其它接口都是 200。 改为两者都接受,标注待联调核对;测试相应改成兼容 1/200、拒绝 500。 Co-Authored-By: Claude <noreply@anthropic.com>feature/supplier-lingxing
12 changed files with 765 additions and 23 deletions
@ -0,0 +1,46 @@
@@ -0,0 +1,46 @@
|
||||
package common.ecommerce.warehouse.enums; |
||||
|
||||
/** |
||||
* 销毁单附件类型。 |
||||
* |
||||
* <p>取值来自仓方协议的分类口径;core 只表达语义,仓方码值由适配器映射。</p> |
||||
*/ |
||||
public enum AttachmentType { |
||||
|
||||
/** 面单。 */ |
||||
SHIPPING_LABEL(10, "面单"), |
||||
/** 装箱单。 */ |
||||
PACKING_LIST(20, "装箱单"), |
||||
/** 提单 / BOL。 */ |
||||
BOL(30, "提单"), |
||||
/** 其他。 */ |
||||
OTHER(40, "其他"); |
||||
|
||||
private final int code; |
||||
private final String label; |
||||
|
||||
AttachmentType(int code, String label) { |
||||
this.code = code; |
||||
this.label = label; |
||||
} |
||||
|
||||
/** 落库用的稳定码;由 SDK 分配,永不复用、永不重排。 */ |
||||
public int code() { |
||||
return code; |
||||
} |
||||
|
||||
/** 中文显示名。 */ |
||||
public String label() { |
||||
return label; |
||||
} |
||||
|
||||
/** 按落库码反查。 */ |
||||
public static AttachmentType ofCode(int code) { |
||||
for (AttachmentType t : values()) { |
||||
if (t.code == code) { |
||||
return t; |
||||
} |
||||
} |
||||
return null; |
||||
} |
||||
} |
||||
@ -0,0 +1,237 @@
@@ -0,0 +1,237 @@
|
||||
package common.ecommerce.warehouse.model; |
||||
|
||||
import common.ecommerce.warehouse.enums.AttachmentType; |
||||
|
||||
import java.time.LocalDate; |
||||
import java.util.ArrayList; |
||||
import java.util.Collections; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 销毁计划创建命令。<b>写操作</b>,幂等键是 {@link #destructionNo()}。 |
||||
* |
||||
* <p>单据创建只代表「销毁申请已提交」,最终是否执行以仓方实际操作为准——不要把 |
||||
* 创建成功当成库存已扣减。</p> |
||||
*/ |
||||
public final class DestructionCommand { |
||||
|
||||
/** OMS 销毁单号,同时是仓方的来源单号 {@code sourceNo}。 */ |
||||
private final String destructionNo; |
||||
/** 销毁仓 code;null 时用账户配置的仓。 */ |
||||
private final String warehouseId; |
||||
/** 库存类型:0 可售 / 1 不可售。 */ |
||||
private final int inventoryType; |
||||
/** 期望销毁日期。 */ |
||||
private final LocalDate hopeDestroyDate; |
||||
private final String remark; |
||||
private final List<DestructionLine> lines; |
||||
private final List<Attachment> attachments; |
||||
|
||||
private DestructionCommand(Builder b) { |
||||
this.destructionNo = require(b.destructionNo, "destructionNo"); |
||||
this.warehouseId = b.warehouseId; |
||||
if (b.inventoryType != 0 && b.inventoryType != 1) { |
||||
throw new IllegalArgumentException("inventoryType must be 0 (sellable) or 1 (unsellable)"); |
||||
} |
||||
this.inventoryType = b.inventoryType; |
||||
if (b.hopeDestroyDate == null) { |
||||
throw new IllegalArgumentException("hopeDestroyDate is required"); |
||||
} |
||||
this.hopeDestroyDate = b.hopeDestroyDate; |
||||
this.remark = b.remark; |
||||
if (b.lines.isEmpty()) { |
||||
throw new IllegalArgumentException("lines must not be empty"); |
||||
} |
||||
this.lines = Collections.unmodifiableList(new ArrayList<DestructionLine>(b.lines)); |
||||
this.attachments = Collections.unmodifiableList(new ArrayList<Attachment>(b.attachments)); |
||||
} |
||||
|
||||
public static Builder builder() { |
||||
return new Builder(); |
||||
} |
||||
|
||||
/** OMS 销毁单号;同时作为仓方的来源单号与幂等键。 */ |
||||
public String destructionNo() { |
||||
return destructionNo; |
||||
} |
||||
|
||||
/** 销毁仓 code;null 时用账户配置的仓。 */ |
||||
public String warehouseId() { |
||||
return warehouseId; |
||||
} |
||||
|
||||
/** 库存类型:0 可售 / 1 不可售。 */ |
||||
public int inventoryType() { |
||||
return inventoryType; |
||||
} |
||||
|
||||
public LocalDate hopeDestroyDate() { |
||||
return hopeDestroyDate; |
||||
} |
||||
|
||||
public String remark() { |
||||
return remark; |
||||
} |
||||
|
||||
public List<DestructionLine> lines() { |
||||
return lines; |
||||
} |
||||
|
||||
public List<Attachment> attachments() { |
||||
return attachments; |
||||
} |
||||
|
||||
private static String require(String v, String name) { |
||||
if (v == null || v.trim().isEmpty()) { |
||||
throw new IllegalArgumentException(name + " must not be blank"); |
||||
} |
||||
return v.trim(); |
||||
} |
||||
|
||||
/** 待销毁商品行。 */ |
||||
public static final class DestructionLine { |
||||
|
||||
private final String providerSku; |
||||
private final int planQuantity; |
||||
|
||||
public DestructionLine(String providerSku, int planQuantity) { |
||||
if (providerSku == null || providerSku.trim().isEmpty()) { |
||||
throw new IllegalArgumentException("providerSku must not be blank"); |
||||
} |
||||
if (planQuantity <= 0) { |
||||
throw new IllegalArgumentException("planQuantity must be positive"); |
||||
} |
||||
this.providerSku = providerSku.trim(); |
||||
this.planQuantity = planQuantity; |
||||
} |
||||
|
||||
public String providerSku() { |
||||
return providerSku; |
||||
} |
||||
|
||||
public int planQuantity() { |
||||
return planQuantity; |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 附件。 |
||||
* |
||||
* <p>SDK 不落文件、不上传对象存储:{@link #url()} 由调用方提供,适配器原样下发。</p> |
||||
*/ |
||||
public static final class Attachment { |
||||
|
||||
private final String name; |
||||
private final String remark; |
||||
/** 附件类型;null 表示不指定,由仓方按默认处理。 */ |
||||
private final AttachmentType type; |
||||
private final String url; |
||||
|
||||
private Attachment(Builder b) { |
||||
this.name = b.name; |
||||
this.remark = b.remark; |
||||
this.type = b.type; |
||||
this.url = b.url; |
||||
} |
||||
|
||||
public static Builder builder() { |
||||
return new Builder(); |
||||
} |
||||
|
||||
public String name() { |
||||
return name; |
||||
} |
||||
|
||||
public String remark() { |
||||
return remark; |
||||
} |
||||
|
||||
public AttachmentType type() { |
||||
return type; |
||||
} |
||||
|
||||
public String url() { |
||||
return url; |
||||
} |
||||
|
||||
public static final class Builder { |
||||
private String name; |
||||
private String remark; |
||||
private AttachmentType type; |
||||
private String url; |
||||
|
||||
public Builder name(String v) { |
||||
this.name = v; |
||||
return this; |
||||
} |
||||
|
||||
public Builder remark(String v) { |
||||
this.remark = v; |
||||
return this; |
||||
} |
||||
|
||||
public Builder type(AttachmentType v) { |
||||
this.type = v; |
||||
return this; |
||||
} |
||||
|
||||
public Builder url(String v) { |
||||
this.url = v; |
||||
return this; |
||||
} |
||||
|
||||
public Attachment build() { |
||||
return new Attachment(this); |
||||
} |
||||
} |
||||
} |
||||
|
||||
public static final class Builder { |
||||
private String destructionNo; |
||||
private String warehouseId; |
||||
private int inventoryType; |
||||
private LocalDate hopeDestroyDate; |
||||
private String remark; |
||||
private final List<DestructionLine> lines = new ArrayList<DestructionLine>(); |
||||
private final List<Attachment> attachments = new ArrayList<Attachment>(); |
||||
|
||||
public Builder destructionNo(String v) { |
||||
this.destructionNo = v; |
||||
return this; |
||||
} |
||||
|
||||
public Builder warehouseId(String v) { |
||||
this.warehouseId = v; |
||||
return this; |
||||
} |
||||
|
||||
public Builder inventoryType(int v) { |
||||
this.inventoryType = v; |
||||
return this; |
||||
} |
||||
|
||||
public Builder hopeDestroyDate(LocalDate v) { |
||||
this.hopeDestroyDate = v; |
||||
return this; |
||||
} |
||||
|
||||
public Builder remark(String v) { |
||||
this.remark = v; |
||||
return this; |
||||
} |
||||
|
||||
public Builder line(String providerSku, int planQuantity) { |
||||
this.lines.add(new DestructionLine(providerSku, planQuantity)); |
||||
return this; |
||||
} |
||||
|
||||
public Builder attachment(Attachment v) { |
||||
this.attachments.add(v); |
||||
return this; |
||||
} |
||||
|
||||
public DestructionCommand build() { |
||||
return new DestructionCommand(this); |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,122 @@
@@ -0,0 +1,122 @@
|
||||
package common.ecommerce.yqn.adapter; |
||||
|
||||
import common.ecommerce.warehouse.enums.AttachmentType; |
||||
import common.ecommerce.warehouse.enums.WarehouseProvider; |
||||
import common.ecommerce.warehouse.model.DestructionCommand; |
||||
import common.ecommerce.warehouse.model.DestructionOrder; |
||||
import common.ecommerce.yqn.dto.YqnDtos; |
||||
|
||||
import java.time.LocalDate; |
||||
import java.time.format.DateTimeFormatter; |
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 运去哪销毁计划报文映射(API 88)。 |
||||
*/ |
||||
public final class YqnDestructionMapper { |
||||
|
||||
private static final DateTimeFormatter DATE = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
||||
|
||||
private YqnDestructionMapper() { |
||||
} |
||||
|
||||
/** |
||||
* 统一命令 → 运去哪创建请求。 |
||||
* |
||||
* @param cmd 统一命令 |
||||
* @param defaultWarehouseCode 命令未指定仓时的回退仓 code |
||||
*/ |
||||
public static YqnDtos.CreateDestroyPlanRequest toRequest(DestructionCommand cmd, |
||||
String defaultWarehouseCode) { |
||||
YqnDtos.CreateDestroyPlanRequest req = new YqnDtos.CreateDestroyPlanRequest(); |
||||
req.warehouseCode = hasText(cmd.warehouseId()) ? cmd.warehouseId() : defaultWarehouseCode; |
||||
if (!hasText(req.warehouseCode)) { |
||||
throw new IllegalArgumentException( |
||||
"yqn destruction needs a warehouseCode; none given and account has none"); |
||||
} |
||||
req.sourceNo = cmd.destructionNo(); |
||||
req.inventoryType = cmd.inventoryType(); |
||||
req.hopeDestroyData = formatDate(cmd.hopeDestroyDate()); |
||||
req.remark = cmd.remark(); |
||||
req.destroyPlanOrderItems = toItems(cmd.lines()); |
||||
req.orderAttaches = toAttaches(cmd.attachments()); |
||||
return req; |
||||
} |
||||
|
||||
private static List<YqnDtos.CreateDestroyPlanRequest.DestroyPlanItem> toItems( |
||||
List<DestructionCommand.DestructionLine> lines) { |
||||
List<YqnDtos.CreateDestroyPlanRequest.DestroyPlanItem> items = |
||||
new ArrayList<YqnDtos.CreateDestroyPlanRequest.DestroyPlanItem>(lines.size()); |
||||
for (DestructionCommand.DestructionLine line : lines) { |
||||
YqnDtos.CreateDestroyPlanRequest.DestroyPlanItem item = |
||||
new YqnDtos.CreateDestroyPlanRequest.DestroyPlanItem(); |
||||
item.sku = line.providerSku(); |
||||
item.planQty = line.planQuantity(); |
||||
items.add(item); |
||||
} |
||||
return items; |
||||
} |
||||
|
||||
private static List<YqnDtos.CreateDestroyPlanRequest.DestroyPlanAttach> toAttaches( |
||||
List<DestructionCommand.Attachment> attachments) { |
||||
if (attachments == null || attachments.isEmpty()) { |
||||
return null; |
||||
} |
||||
List<YqnDtos.CreateDestroyPlanRequest.DestroyPlanAttach> out = |
||||
new ArrayList<YqnDtos.CreateDestroyPlanRequest.DestroyPlanAttach>(attachments.size()); |
||||
for (DestructionCommand.Attachment attachment : attachments) { |
||||
YqnDtos.CreateDestroyPlanRequest.DestroyPlanAttach item = |
||||
new YqnDtos.CreateDestroyPlanRequest.DestroyPlanAttach(); |
||||
item.name = attachment.name(); |
||||
item.remark = attachment.remark(); |
||||
item.attachType = attachTypeCode(attachment.type()); |
||||
item.url = attachment.url(); |
||||
out.add(item); |
||||
} |
||||
return out; |
||||
} |
||||
|
||||
/** 底层附件类型 → 运去哪 attachType:0 面单 / 1 装箱单 / 2 提单 / 3 其他;null 不传。 */ |
||||
static Integer attachTypeCode(AttachmentType type) { |
||||
if (type == null) { |
||||
return null; |
||||
} |
||||
switch (type) { |
||||
case SHIPPING_LABEL: |
||||
return 0; |
||||
case PACKING_LIST: |
||||
return 1; |
||||
case BOL: |
||||
return 2; |
||||
case OTHER: |
||||
return 3; |
||||
default: |
||||
throw new IllegalArgumentException("yqn does not support attachType: " + type); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 创建响应 → 统一销毁单。 |
||||
* |
||||
* <p>接口只回 {@code destroyPlanOrderNo},没有状态,所以 {@code status}/ |
||||
* {@code rawStatus} 留空——不要把它当成「已执行」。</p> |
||||
*/ |
||||
public static DestructionOrder toCreated(DestructionCommand cmd, String warehouseCode, |
||||
String providerDestroyPlanNo) { |
||||
return DestructionOrder.builder() |
||||
.destructionNo(cmd.destructionNo()) |
||||
.providerDestructionId(providerDestroyPlanNo) |
||||
.warehouseCode(warehouseCode) |
||||
.sourceProvider(WarehouseProvider.YQN) |
||||
.build(); |
||||
} |
||||
|
||||
static String formatDate(LocalDate date) { |
||||
return date == null ? null : DATE.format(date); |
||||
} |
||||
|
||||
private static boolean hasText(String v) { |
||||
return v != null && !v.trim().isEmpty(); |
||||
} |
||||
} |
||||
@ -0,0 +1,166 @@
@@ -0,0 +1,166 @@
|
||||
package common.ecommerce.yqn.adapter; |
||||
|
||||
import common.ecommerce.http.JacksonJsonCodec; |
||||
import common.ecommerce.shared.spi.ChannelSecret; |
||||
import common.ecommerce.shared.testkit.RecordingTransport; |
||||
import common.ecommerce.shared.testkit.Responses; |
||||
import common.ecommerce.warehouse.enums.AttachmentType; |
||||
import common.ecommerce.warehouse.enums.WarehouseCapability; |
||||
import common.ecommerce.warehouse.enums.WarehouseProvider; |
||||
import common.ecommerce.warehouse.model.DestructionCommand; |
||||
import common.ecommerce.warehouse.model.DestructionOrder; |
||||
import common.ecommerce.warehouse.sdk.WarehouseConnection; |
||||
import common.ecommerce.warehouse.sdk.WarehouseContext; |
||||
import common.ecommerce.yqn.YqnConstants; |
||||
import org.junit.jupiter.api.Test; |
||||
|
||||
import java.time.Clock; |
||||
import java.time.Instant; |
||||
import java.time.LocalDate; |
||||
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.assertNull; |
||||
import static org.junit.jupiter.api.Assertions.assertThrows; |
||||
import static org.junit.jupiter.api.Assertions.assertTrue; |
||||
|
||||
/** |
||||
* 创建销毁计划(API 88)契约测试。 |
||||
*/ |
||||
class YqnDestructionTest { |
||||
|
||||
private static final Clock CLOCK = Clock.fixed(Instant.parse("2026-11-10T00:00:00Z"), ZoneOffset.UTC); |
||||
|
||||
private static WarehouseContext ctx() { |
||||
return WarehouseContext.of("YQN-RF_NY_US", WarehouseProvider.YQN, "RF_NY_US", |
||||
WarehouseConnection.of(YqnConstants.PR_BASE_URL, |
||||
ChannelSecret.builder().appSecret("key-1").build()), |
||||
"req-destroy", CLOCK); |
||||
} |
||||
|
||||
private static DestructionCommand command() { |
||||
return DestructionCommand.builder() |
||||
.destructionNo("DEST-001") |
||||
.inventoryType(1) |
||||
.hopeDestroyDate(LocalDate.of(2026, 11, 20)) |
||||
.remark("破损库存") |
||||
.line("DM00001", 3) |
||||
.line("DM00002", 1) |
||||
.attachment(DestructionCommand.Attachment.builder() |
||||
.name("销毁凭证.pdf") |
||||
.remark("客户签字") |
||||
.type(AttachmentType.OTHER) |
||||
.url("https://files.example/a.pdf") |
||||
.build()) |
||||
.build(); |
||||
} |
||||
|
||||
@Test |
||||
void sendsDocumentedShape() { |
||||
RecordingTransport transport = RecordingTransport.create() |
||||
.route(YqnConstants.PATH_DESTRUCTION_CREATE, req -> Responses.ok( |
||||
"{\"statusCode\":200,\"status\":0,\"code\":200,\"message\":\"ok\"," |
||||
+ "\"data\":{\"destroyPlanOrderNo\":\"DP123\"}}")); |
||||
YqnAdapter adapter = new YqnAdapter(transport, new JacksonJsonCodec()); |
||||
|
||||
DestructionOrder order = adapter.create(ctx(), command()); |
||||
|
||||
String body = transport.lastDataRequest().body(); |
||||
assertTrue(body.contains("\"warehouseCode\":\"RF_NY_US\""), body); |
||||
assertTrue(body.contains("\"sourceNo\":\"DEST-001\""), body); |
||||
assertTrue(body.contains("\"inventoryType\":1"), body); |
||||
// 字段名是仓方的 hopeDestroyData(不是 Date)
|
||||
assertTrue(body.contains("\"hopeDestroyData\":\"2026-11-20\""), body); |
||||
assertTrue(body.contains("\"sku\":\"DM00001\""), body); |
||||
assertTrue(body.contains("\"planQty\":3"), body); |
||||
assertTrue(body.contains("\"attachType\":3"), body); |
||||
assertTrue(body.contains("\"url\":\"https://files.example/a.pdf\""), body); |
||||
|
||||
assertEquals("DEST-001", order.destructionNo()); |
||||
assertEquals("DP123", order.providerDestructionId()); |
||||
assertEquals("RF_NY_US", order.warehouseCode()); |
||||
assertEquals(WarehouseProvider.YQN, order.sourceProvider()); |
||||
} |
||||
|
||||
/** 创建响应只有单号、没有状态,不能把它当成「已执行」。 */ |
||||
@Test |
||||
void createdOrderHasNoStatus() { |
||||
RecordingTransport transport = RecordingTransport.create() |
||||
.route(YqnConstants.PATH_DESTRUCTION_CREATE, req -> Responses.ok( |
||||
"{\"statusCode\":200,\"status\":0,\"code\":200,\"data\":{\"destroyPlanOrderNo\":\"DP9\"}}")); |
||||
DestructionOrder order = new YqnAdapter(transport, new JacksonJsonCodec()) |
||||
.create(ctx(), command()); |
||||
|
||||
assertNull(order.status()); |
||||
assertNull(order.rawStatus()); |
||||
} |
||||
|
||||
@Test |
||||
void omitsAttachesWhenNoneGiven() { |
||||
RecordingTransport transport = RecordingTransport.create() |
||||
.route(YqnConstants.PATH_DESTRUCTION_CREATE, req -> Responses.ok( |
||||
"{\"statusCode\":200,\"status\":0,\"code\":200,\"data\":{}}")); |
||||
DestructionCommand noAttach = DestructionCommand.builder() |
||||
.destructionNo("DEST-002") |
||||
.inventoryType(0) |
||||
.hopeDestroyDate(LocalDate.of(2026, 12, 1)) |
||||
.line("DM00001", 1) |
||||
.build(); |
||||
new YqnAdapter(transport, new JacksonJsonCodec()).create(ctx(), noAttach); |
||||
|
||||
assertFalse(transport.lastDataRequest().body().contains("orderAttaches")); |
||||
} |
||||
|
||||
@Test |
||||
void commandWarehouseOverridesAccount() { |
||||
RecordingTransport transport = RecordingTransport.create() |
||||
.route(YqnConstants.PATH_DESTRUCTION_CREATE, req -> Responses.ok( |
||||
"{\"statusCode\":200,\"status\":0,\"code\":200,\"data\":{}}")); |
||||
DestructionCommand other = DestructionCommand.builder() |
||||
.destructionNo("DEST-003") |
||||
.warehouseId("RF_LA_US") |
||||
.inventoryType(1) |
||||
.hopeDestroyDate(LocalDate.of(2026, 12, 1)) |
||||
.line("DM00001", 1) |
||||
.build(); |
||||
new YqnAdapter(transport, new JacksonJsonCodec()).create(ctx(), other); |
||||
|
||||
assertTrue(transport.lastDataRequest().body().contains("\"warehouseCode\":\"RF_LA_US\"")); |
||||
} |
||||
|
||||
@Test |
||||
void queryIsExplicitlyUnsupported() { |
||||
YqnAdapter adapter = new YqnAdapter(RecordingTransport.create(), new JacksonJsonCodec()); |
||||
assertThrows(common.ecommerce.warehouse.error.WarehouseUnsupportedCapabilityException.class, |
||||
() -> adapter.getDestruction(ctx(), "DEST-001")); |
||||
} |
||||
|
||||
@Test |
||||
void declaresDestructionCapability() { |
||||
YqnAdapter adapter = new YqnAdapter(RecordingTransport.create(), new JacksonJsonCodec()); |
||||
assertTrue(adapter.capabilities().contains(WarehouseCapability.DESTRUCTION)); |
||||
} |
||||
|
||||
@Test |
||||
void commandValidation() { |
||||
assertThrows(IllegalArgumentException.class, () -> DestructionCommand.builder() |
||||
.destructionNo("D").inventoryType(2) |
||||
.hopeDestroyDate(LocalDate.now()).line("S", 1).build()); |
||||
assertThrows(IllegalArgumentException.class, () -> DestructionCommand.builder() |
||||
.destructionNo("D").inventoryType(1) |
||||
.hopeDestroyDate(LocalDate.now()).build()); |
||||
assertThrows(IllegalArgumentException.class, () -> DestructionCommand.builder() |
||||
.destructionNo("D").inventoryType(1) |
||||
.hopeDestroyDate(LocalDate.now()).line("S", 0).build()); |
||||
} |
||||
|
||||
@Test |
||||
void attachTypeCodesMatchDocument() { |
||||
assertEquals(Integer.valueOf(0), YqnDestructionMapper.attachTypeCode(AttachmentType.SHIPPING_LABEL)); |
||||
assertEquals(Integer.valueOf(1), YqnDestructionMapper.attachTypeCode(AttachmentType.PACKING_LIST)); |
||||
assertEquals(Integer.valueOf(2), YqnDestructionMapper.attachTypeCode(AttachmentType.BOL)); |
||||
assertEquals(Integer.valueOf(3), YqnDestructionMapper.attachTypeCode(AttachmentType.OTHER)); |
||||
assertNull(YqnDestructionMapper.attachTypeCode(null)); |
||||
} |
||||
} |
||||
Loading…
Reference in new issue