fix: reserve stable inbound code for draft label printing
This commit is contained in:
+5
-2
@@ -3,6 +3,7 @@ package com.baiyue.firstleg.service;
|
||||
import com.baiyue.common.core.api.ApiResponse;
|
||||
import com.baiyue.common.core.exception.BizException;
|
||||
import com.baiyue.firstleg.client.OrderCargoClient;
|
||||
import com.baiyue.firstleg.client.PrintableOrderInboundClient;
|
||||
import com.baiyue.firstleg.entity.InboundCartonLabelEntity;
|
||||
import com.baiyue.firstleg.entity.InboundOrderEntity;
|
||||
import com.baiyue.firstleg.repository.InboundCartonLabelRepository;
|
||||
@@ -28,6 +29,7 @@ import static org.mockito.Mockito.when;
|
||||
class InboundCartonLabelServiceTest {
|
||||
@Mock private InboundCartonLabelRepository repository;
|
||||
@Mock private OrderCargoClient orderCargoClient;
|
||||
@Mock private PrintableOrderInboundClient printableOrderInboundClient;
|
||||
@Mock private InboundOrderCreationService inboundOrderCreationService;
|
||||
private InboundCartonLabelService service;
|
||||
|
||||
@@ -36,6 +38,7 @@ class InboundCartonLabelServiceTest {
|
||||
service = new InboundCartonLabelService();
|
||||
ReflectionTestUtils.setField(service, "repository", repository);
|
||||
ReflectionTestUtils.setField(service, "orderCargoClient", orderCargoClient);
|
||||
ReflectionTestUtils.setField(service, "printableOrderInboundClient", printableOrderInboundClient);
|
||||
ReflectionTestUtils.setField(service, "inboundOrderCreationService", inboundOrderCreationService);
|
||||
ReflectionTestUtils.setField(service, "internalToken", "internal-token");
|
||||
}
|
||||
@@ -222,7 +225,7 @@ class InboundCartonLabelServiceTest {
|
||||
@Test
|
||||
void rejectsAnOrderWithoutAnOwnedPreparingInbound() {
|
||||
when(repository.findByOrder(10001L, 60001L)).thenReturn(null);
|
||||
when(orderCargoClient.inboundSnapshot("internal-token", 10001L, 60001L))
|
||||
when(printableOrderInboundClient.reserve("internal-token", 10001L, 60001L))
|
||||
.thenThrow(org.mockito.Mockito.mock(feign.FeignException.class));
|
||||
|
||||
assertThatThrownBy(() -> service.requireInboundIdByOrder(10001L, 60001L))
|
||||
@@ -239,7 +242,7 @@ class InboundCartonLabelServiceTest {
|
||||
null, null, null, 2);
|
||||
InboundOrderEntity repaired = inbound();
|
||||
when(repository.findByOrder(10001L, 60001L)).thenReturn(null, repaired);
|
||||
when(orderCargoClient.inboundSnapshot("internal-token", 10001L, 60001L))
|
||||
when(printableOrderInboundClient.reserve("internal-token", 10001L, 60001L))
|
||||
.thenReturn(ApiResponse.success(snapshot));
|
||||
|
||||
assertThat(service.requireInboundIdByOrder(10001L, 60001L)).isEqualTo(70001L);
|
||||
|
||||
Reference in New Issue
Block a user