package com.ruoyi.web.modules.prosperity.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;

/**
 * GTFY-NB-UT-001、002
 */
@DisplayName("AchievementReportValidation")
class AchievementReportValidationTest
{

    @Test
    @DisplayName("GTFY-NB-UT-001 statYear 合法")
    void ut001_validYear()
    {
        assertEquals(2026, AchievementReportValidation.parseStatYear("2026"));
        assertEquals(2000, AchievementReportValidation.parseStatYear("2000"));
    }

    @Test
    @DisplayName("GTFY-NB-UT-002 statYear 非法")
    void ut002_invalidYear()
    {
        assertThrows(ServiceException.class, () -> AchievementReportValidation.parseStatYear(""));
        assertThrows(ServiceException.class, () -> AchievementReportValidation.parseStatYear("26"));
        assertThrows(ServiceException.class, () -> AchievementReportValidation.parseStatYear("20266"));
        assertThrows(ServiceException.class, () -> AchievementReportValidation.parseStatYear("abcd"));
        assertThrows(ServiceException.class, () -> AchievementReportValidation.parseStatYear("1899"));
    }
}
