package com.cf.imes.module.system.validation.token;

import com.cf.imes.framework.test.core.ut.BaseMockitoUnitTest;
import com.cf.imes.module.system.enums.token.TokenConfigAppTypeEnum;
import jakarta.validation.ConstraintValidatorContext;
import org.junit.jupiter.api.Test;
import org.mockito.Mock;

import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;

/**
 * token配置管理应用类型校验器单元测试
 *
 * @author Gqr
 * @since 2025/12/10 14:21
 */
class TokenConfigAppTypeEnumValidatorTest extends BaseMockitoUnitTest {
    @Mock
    private ConstraintValidatorContext constraintValidatorContext;

    @Test
    void testValid() {
        TokenConfigAppTypeEnumValidator validator = new TokenConfigAppTypeEnumValidator();
        assertTrue(validator.isValid(TokenConfigAppTypeEnum.WEBCAD.getType(), constraintValidatorContext));
        assertTrue(validator.isValid(null, constraintValidatorContext));
        assertFalse(validator.isValid(2, constraintValidatorContext));
    }
}