liujie
2026-08-21 a7c8a8f6055e1a03414f2227d12ff2e87ec52d41
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package com.tourguide.modules.order.dto;
 
import com.tourguide.modules.order.entity.TourOrder;
import org.junit.jupiter.api.Test;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import static org.junit.jupiter.api.Assertions.assertEquals;
 
class MiniOrderListResponseTest {
    @Test
    void completedOrderShouldDistinguishPendingReviewAndReviewed() {
        TourOrder order = baseOrder("GROUP_QUICK", "COMPLETED");
 
        assertEquals("pendingReview", MiniOrderListResponse.from(order, false).getDisplayStatus());
        assertEquals("completed", MiniOrderListResponse.from(order, true).getDisplayStatus());
    }
 
    @Test
    void privatePremiumShouldUseGroupPriceUnitAndPremiumDuration() {
        MiniOrderListResponse response = MiniOrderListResponse.from(
                baseOrder("PRIVATE_PREMIUM", "PENDING_MEETING"), false);
 
        assertEquals("包团·精讲", response.getServiceName());
        assertEquals(Integer.valueOf(60), response.getDurationMinutes());
        assertEquals("团", response.getPriceUnit());
        assertEquals("pendingGuide", response.getDisplayStatus());
    }
 
    private TourOrder baseOrder(String orderType, String status) {
        TourOrder order = new TourOrder();
        order.setId(1L);
        order.setOrderNo("MJ202607290001");
        order.setScenicName("青城山景区");
        order.setOrderType(orderType);
        order.setPeopleCount(4);
        order.setUnitPrice(new BigDecimal("36.00"));
        order.setAmount(new BigDecimal("144.00"));
        order.setPlacedAt(LocalDateTime.of(2026, 7, 29, 9, 30));
        order.setStatus(status);
        return order;
    }
}