优化
This commit is contained in:
+3
-3
@@ -100,10 +100,10 @@ class ReceivingContainerControllerTest {
|
||||
@Test
|
||||
void fbaCartonResolutionDelegatesWithoutControllerModeRejection() {
|
||||
ReceivingContainerRequests.CartonResolve request =
|
||||
new ReceivingContainerRequests.CartonResolve("NYEXX2608260002#4-1");
|
||||
new ReceivingContainerRequests.CartonResolve("NYEXX2608260001#4-1");
|
||||
when(service.resolveCarton("42", request)).thenReturn(new ReceivingContainerResponses.CartonResolved(
|
||||
"NYEXX2608260002#4-1", "IN-1", "FBA", "900", "Shared LAX", null, null, null,
|
||||
"ABE3", 1, 40, 0, 40));
|
||||
"NYEXX2608260001#4-1", "NYEXX2608260001", "FBA", "900", "Shared LAX", null, null, null,
|
||||
"ABE3", 1, 4, 0, 4));
|
||||
|
||||
controller.resolveCarton(picker(), request);
|
||||
|
||||
|
||||
+59
-5
@@ -406,15 +406,69 @@ class ReceivingContainerServiceBehaviorTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void fbaCartonResolutionForNyexx2608260002DoesNotApplyReceiptModeGate() {
|
||||
void fbaCartonResolutionWithoutManifestForNyexx2608260001DoesNotWriteReceiptState() {
|
||||
stubCurrent("FBA", "CONT-A");
|
||||
when(cartons.selectOne(any())).thenReturn(carton(1L, "NYEXX2608260002#4-1"));
|
||||
InboundPlanLine fba = line("FBA");
|
||||
fba.setInboundCode("NYEXX2608260001"); fba.setRequiredPackageCount(4);
|
||||
when(lines.selectList(any())).thenReturn(List.of(fba));
|
||||
|
||||
var resolved = service.resolveCarton("7", new ReceivingContainerRequests.CartonResolve("NYEXX2608260002#4-1"));
|
||||
var resolved = service.resolveCarton("7", new ReceivingContainerRequests.CartonResolve("NYEXX2608260001#4-1"));
|
||||
var replay = service.resolveCarton("7", new ReceivingContainerRequests.CartonResolve("NYEXX2608260001#4-1"));
|
||||
|
||||
assertThat(resolved.cartonMark()).isEqualTo("NYEXX2608260002#4-1");
|
||||
assertThat(resolved.inboundCode()).isEqualTo("IN-1");
|
||||
assertThat(resolved.cartonMark()).isEqualTo("NYEXX2608260001#4-1");
|
||||
assertThat(resolved.inboundCode()).isEqualTo("NYEXX2608260001");
|
||||
assertThat(resolved.destinationType()).isEqualTo("FBA");
|
||||
assertThat(replay).isEqualTo(resolved);
|
||||
verifyNoInteractions(workflow, operations);
|
||||
}
|
||||
|
||||
@Test
|
||||
void fbaCartonResolutionRejectsCrossContainerAndInvalidPrefixesAsConflicts() {
|
||||
stubCurrent("FBA", "CONT-A");
|
||||
InboundPlanLine current = line("FBA");
|
||||
current.setInboundCode("NYEXX2608260001"); current.setRequiredPackageCount(4);
|
||||
InboundPlanLine foreign = line("FBA");
|
||||
foreign.setInboundCode("NYEXX2608269999"); foreign.setPlanId(99L);
|
||||
when(lines.selectList(any())).thenReturn(List.of(current), List.of(foreign));
|
||||
|
||||
assertThatThrownBy(() -> service.resolveCarton("7",
|
||||
new ReceivingContainerRequests.CartonResolve("NYEXX2608269999#4-1")))
|
||||
.isInstanceOfSatisfying(ResponseStatusException.class,
|
||||
error -> assertThat(error.getStatusCode().value()).isEqualTo(409));
|
||||
assertThatThrownBy(() -> service.resolveCarton("7",
|
||||
new ReceivingContainerRequests.CartonResolve("NYEXX2608260001")))
|
||||
.isInstanceOfSatisfying(ResponseStatusException.class,
|
||||
error -> assertThat(error.getStatusCode().value()).isEqualTo(409));
|
||||
assertThatThrownBy(() -> service.resolveCarton("7",
|
||||
new ReceivingContainerRequests.CartonResolve("#4-1")))
|
||||
.isInstanceOfSatisfying(ResponseStatusException.class,
|
||||
error -> assertThat(error.getStatusCode().value()).isEqualTo(409));
|
||||
|
||||
org.mockito.Mockito.reset(lines, cartons);
|
||||
when(lines.selectList(any())).thenReturn(List.of(current), List.of());
|
||||
assertThatThrownBy(() -> service.resolveCarton("7",
|
||||
new ReceivingContainerRequests.CartonResolve("UNKNOWN#5-1")))
|
||||
.isInstanceOfSatisfying(ResponseStatusException.class,
|
||||
error -> assertThat(error.getStatusCode().value()).isEqualTo(404));
|
||||
|
||||
InboundPlanLine duplicate = line("FBA");
|
||||
duplicate.setId(20L); duplicate.setInboundCode("NYEXX2608260001");
|
||||
org.mockito.Mockito.reset(lines);
|
||||
when(lines.selectList(any())).thenReturn(List.of(current, duplicate));
|
||||
assertThatThrownBy(() -> service.resolveCarton("7",
|
||||
new ReceivingContainerRequests.CartonResolve("NYEXX2608260001#any-tail")))
|
||||
.isInstanceOfSatisfying(ResponseStatusException.class,
|
||||
error -> assertThat(error.getStatusCode().value()).isEqualTo(409));
|
||||
}
|
||||
|
||||
@Test
|
||||
void overseasCartonResolutionWithoutManifestIsNotFound() {
|
||||
stubCurrent("OVERSEAS", "CONT-A");
|
||||
|
||||
assertThatThrownBy(() -> service.resolveCarton("7",
|
||||
new ReceivingContainerRequests.CartonResolve("IN-1#2-1")))
|
||||
.isInstanceOfSatisfying(ResponseStatusException.class,
|
||||
error -> assertThat(error.getStatusCode().value()).isEqualTo(404));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user