Merge remote-tracking branch 'origin/test' into dev

This commit is contained in:
2026-09-09 00:19:29 +08:00
19 changed files with 752 additions and 33 deletions
@@ -8,6 +8,7 @@ import com.baiyue.lastleg.inboundplan.dto.ManualInboundPlanRequest;
import com.baiyue.lastleg.inboundplan.dto.UpdateFbaAppointmentRequest;
import com.baiyue.lastleg.inboundplan.service.InboundFbaAppointmentService;
import com.baiyue.lastleg.inboundplan.service.InboundPlanService;
import com.baiyue.lastleg.inboundplan.service.ContainerInboundPlanConversionCoordinator;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
@@ -30,6 +31,7 @@ import static org.mockito.Mockito.when;
class InboundPlanControllerTest {
@Mock InboundPlanService service;
@Mock InboundFbaAppointmentService appointmentService;
@Mock ContainerInboundPlanConversionCoordinator containerConversion;
private InboundPlanController controller;
@BeforeEach
@@ -37,6 +39,7 @@ class InboundPlanControllerTest {
controller = new InboundPlanController();
ReflectionTestUtils.setField(controller, "service", service);
ReflectionTestUtils.setField(controller, "appointmentService", appointmentService);
ReflectionTestUtils.setField(controller, "containerConversion", containerConversion);
}
@Test
@@ -79,19 +82,21 @@ class InboundPlanControllerTest {
@Test
void platformContainerConversionUsesStableBookingIdentity() {
controller.convertContainer(platform(), new ConvertContainerInboundPlanRequest(" BOOKING-1 "));
var request = new ConvertContainerInboundPlanRequest(" BOOKING-1 ", 3, "a".repeat(64));
controller.convertContainer(platform(), "convert-key", request);
verify(service).convertContainer(" BOOKING-1 ");
verify(containerConversion).confirm(request, "convert-key");
}
@Test
void merchantCannotConvertAWholeContainer() {
AuthenticatedUser customer = new AuthenticatedUser(8L, 100L, 100L, 9L, "customer", "MERCHANT", "WEB", Set.of());
assertThatThrownBy(() -> controller.convertContainer(customer,
new ConvertContainerInboundPlanRequest("BOOKING-1")))
assertThatThrownBy(() -> controller.convertContainer(customer, "convert-key",
new ConvertContainerInboundPlanRequest("BOOKING-1", 3, "a".repeat(64))))
.isInstanceOf(ResponseStatusException.class);
verify(service, never()).convertContainer(org.mockito.ArgumentMatchers.any());
verify(containerConversion, never()).confirm(org.mockito.ArgumentMatchers.any(),
org.mockito.ArgumentMatchers.any());
}
private static AuthenticatedUser platform() {