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("YakAssetStatusMapper")
class YakAssetStatusMapperTest
{
    @Test
    @DisplayName("ZCZX-MYNZDA-UT-001 状态映射")
    void ut001_mapStatus()
    {
        assertEquals(1, YakAssetStatusMapper.mapToLocalStatus("正常"));
        assertEquals(2, YakAssetStatusMapper.mapToLocalStatus("死淘"));
        assertEquals(3, YakAssetStatusMapper.mapToLocalStatus("丢失"));
        assertEquals(4, YakAssetStatusMapper.mapToLocalStatus("出栏"));
        assertEquals(2, YakAssetStatusMapper.mapToLocalStatus("死亡"));
        assertEquals(2, YakAssetStatusMapper.normalizeLegacyNumericStatus(2));
        assertEquals(1, YakAssetStatusMapper.normalizeLegacyNumericStatus(6));
        assertEquals(4, YakAssetStatusMapper.mapToLocalStatus("10"));
        assertThrows(ServiceException.class, () -> YakAssetStatusMapper.mapToLocalStatus("未知状态"));
    }
}
