package com.cf.imes.module.system.enums.pay;

import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.*;

/**
 * {@link IncomeExpenseTypeEnum} 的单元测试
 */
public class IncomeExpenseTypeEnumTest {

    @Test
    public void testFromType() {
        // 测试正常情况 - 收入
        assertEquals(IncomeExpenseTypeEnum.INCOME, IncomeExpenseTypeEnum.fromType(0));
        
        // 测试正常情况 - 支出
        assertEquals(IncomeExpenseTypeEnum.EXPENSES, IncomeExpenseTypeEnum.fromType(1));
        
        // 测试不存在的类型
        assertNull(IncomeExpenseTypeEnum.fromType(999));
        
        // 测试null值
        assertNull(IncomeExpenseTypeEnum.fromType(null));
    }

    @Test
    public void testEnumValues() {
        // 测试枚举值的基本属性
        assertEquals(0, IncomeExpenseTypeEnum.INCOME.getCode());
        assertEquals("收入", IncomeExpenseTypeEnum.INCOME.getDesc());
        
        assertEquals(1, IncomeExpenseTypeEnum.EXPENSES.getCode());
        assertEquals("支出", IncomeExpenseTypeEnum.EXPENSES.getDesc());
    }
}