package com.ruoyi.web.modules.industryservice.support;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;

import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import com.ruoyi.common.exception.ServiceException;

@DisplayName("YakHerdInventoryMonthSupport")
class YakHerdInventoryMonthSupportTest
{
    @Test
    @DisplayName("月份选项 12 个")
    void monthOptions()
    {
        assertEquals(12, YakHerdInventoryMonthSupport.resolveMonthOptions().size());
        assertEquals(1, YakHerdInventoryMonthSupport.resolveMonthOptions().get(0).intValue());
        assertEquals(12, YakHerdInventoryMonthSupport.resolveMonthOptions().get(11).intValue());
    }

    @Test
    @DisplayName("未来月份拒绝")
    void rejectFutureMonth()
    {
        int year = java.time.Year.now().getValue();
        int futureMonth = java.time.YearMonth.now().getMonthValue() + 1;
        if (futureMonth > 12)
        {
            return;
        }
        assertThrows(ServiceException.class,
                () -> YakHerdInventoryMonthSupport.validateStatPeriod(year, futureMonth));
    }
}
