|
|
@@ -51,6 +51,7 @@ import static com.ruoyi.system.domain.flash.FlashDeliveryStatus.ACCEPTED;
|
|
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
|
|
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
|
|
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
|
|
+import static org.junit.jupiter.api.Assertions.assertNotNull;
|
|
|
import static org.junit.jupiter.api.Assertions.assertNull;
|
|
|
import static org.junit.jupiter.api.Assertions.assertThrows;
|
|
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
|
|
@@ -731,6 +732,64 @@ class FlashDeliveryApplicationServiceTest {
|
|
|
assertEquals(4.5, view.getRider().getStar());
|
|
|
}
|
|
|
|
|
|
+ @Test
|
|
|
+ void userDetailByOrderNoReturnsParticipantDetail() {
|
|
|
+ Fixture fixture = new Fixture();
|
|
|
+ FlashDeliveryOrder order = order(10L, "COMPLETED");
|
|
|
+ order.setRiderId(8L);
|
|
|
+ order.setRiderStars(4.5);
|
|
|
+ when(fixture.orderMapper.selectOne(any(Wrapper.class))).thenReturn(order);
|
|
|
+ InfoUser rider = new InfoUser();
|
|
|
+ rider.setUserId(8L);
|
|
|
+ when(fixture.userMapper.selectInfoUserByUserId(8L)).thenReturn(rider);
|
|
|
+ when(fixture.imageMapper.selectList(any(Wrapper.class))).thenReturn(List.of());
|
|
|
+
|
|
|
+ var view = fixture.service.userDetailByOrderNo(7L, "FL-20260813-021");
|
|
|
+
|
|
|
+ assertEquals(10L, view.getId());
|
|
|
+ assertEquals(4.5, view.getRiderStars());
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test
|
|
|
+ void userDetailByOrderNoRejectsNonParticipantAndUnknownOrderNo() {
|
|
|
+ Fixture fixture = new Fixture();
|
|
|
+ FlashDeliveryOrder order = order(10L, "COMPLETED");
|
|
|
+ order.setReceiverUserId(null);
|
|
|
+ when(fixture.orderMapper.selectOne(any(Wrapper.class))).thenReturn(order);
|
|
|
+ assertThrows(ServiceException.class,
|
|
|
+ () -> fixture.service.userDetailByOrderNo(88L, "FL-20260813-021"));
|
|
|
+
|
|
|
+ when(fixture.orderMapper.selectOne(any(Wrapper.class))).thenReturn(null);
|
|
|
+ assertThrows(ServiceException.class,
|
|
|
+ () -> fixture.service.userDetailByOrderNo(7L, "FL-UNKNOWN"));
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test
|
|
|
+ void riderDetailByOrderNoReturnsAssignedOrderDetail() {
|
|
|
+ Fixture fixture = new Fixture();
|
|
|
+ rider(fixture, 8L);
|
|
|
+ FlashDeliveryOrder order = order(10L, "ACCEPTED");
|
|
|
+ order.setRiderId(8L);
|
|
|
+ when(fixture.orderMapper.selectOne(any(Wrapper.class))).thenReturn(order);
|
|
|
+ when(fixture.userMapper.selectInfoUserByUserId(7L)).thenReturn(new InfoUser());
|
|
|
+ when(fixture.imageMapper.selectList(any(Wrapper.class))).thenReturn(List.of());
|
|
|
+
|
|
|
+ var view = fixture.service.riderDetailByOrderNo(8L, "FL-20260813-021");
|
|
|
+
|
|
|
+ assertEquals(10L, view.getId());
|
|
|
+ assertNotNull(view.getUser());
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test
|
|
|
+ void riderDetailByOrderNoRejectsUnknownOrderNo() {
|
|
|
+ Fixture fixture = new Fixture();
|
|
|
+ rider(fixture, 8L);
|
|
|
+ when(fixture.orderMapper.selectOne(any(Wrapper.class))).thenReturn(null);
|
|
|
+
|
|
|
+ assertThrows(ServiceException.class,
|
|
|
+ () -> fixture.service.riderDetailByOrderNo(8L, "FL-UNKNOWN"));
|
|
|
+ }
|
|
|
+
|
|
|
@Test
|
|
|
void orderWithoutCreationTimeReceiverBindingIsNotClaimedLater() {
|
|
|
Fixture fixture = new Fixture();
|