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

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

/**
 * {@link CustomPlateNoRuleCodeEnum} 的单元测试
 */
class CustomPlateNoRuleCodeEnumTest {

    @Test
    void testEnumValues() {
        // 测试枚举值是否正确
        assertEquals("custom", CustomPlateNoRuleCodeEnum.CUSTOM.getRuleCode());
        assertEquals("date", CustomPlateNoRuleCodeEnum.DATE.getRuleCode());
        assertEquals("orderNo", CustomPlateNoRuleCodeEnum.ORDERNO.getRuleCode());
        assertEquals("plateNo", CustomPlateNoRuleCodeEnum.PLATENO.getRuleCode());
        assertEquals("roomNo", CustomPlateNoRuleCodeEnum.ROOMNO.getRuleCode());
        assertEquals("bodyNo", CustomPlateNoRuleCodeEnum.BODYNO.getRuleCode());
    }

    @Test
    void testMatch() {
        // 测试 match 方法
        assertEquals(CustomPlateNoRuleCodeEnum.CUSTOM, CustomPlateNoRuleCodeEnum.match("custom"));
        assertEquals(CustomPlateNoRuleCodeEnum.DATE, CustomPlateNoRuleCodeEnum.match("date"));
        assertEquals(CustomPlateNoRuleCodeEnum.ORDERNO, CustomPlateNoRuleCodeEnum.match("orderNo"));
        assertEquals(CustomPlateNoRuleCodeEnum.PLATENO, CustomPlateNoRuleCodeEnum.match("plateNo"));
        assertEquals(CustomPlateNoRuleCodeEnum.ROOMNO, CustomPlateNoRuleCodeEnum.match("roomNo"));
        assertEquals(CustomPlateNoRuleCodeEnum.BODYNO, CustomPlateNoRuleCodeEnum.match("bodyNo"));
        assertNull(CustomPlateNoRuleCodeEnum.match("nonexistent")); // 不存在的规则编码
        assertNull(CustomPlateNoRuleCodeEnum.match(null)); // null值
    }
}