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

import com.cf.imes.framework.test.core.ut.BaseMockitoUnitTest;
import com.cf.imes.module.system.enums.notify.NotifyTemplateTypeEnum;
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;

/**
 * 通知模板类型校验器单元测试
 *
 * @author Gqr
 * @since 2025/12/10 14:08
 */
class NofityTemplateTypeValidatorTest extends BaseMockitoUnitTest {
    @Mock
    private ConstraintValidatorContext constraintValidatorContext;

    @Test
    void testValid() {
        NofityTemplateTypeValidator validator = new NofityTemplateTypeValidator();
        assertTrue(validator.isValid(NotifyTemplateTypeEnum.NOTIFICATION_MESSAGE.getType(), constraintValidatorContext));
        assertTrue(validator.isValid(NotifyTemplateTypeEnum.SYSTEM_MESSAGE.getType(), constraintValidatorContext));
        assertTrue(validator.isValid(null, constraintValidatorContext));
        assertFalse(validator.isValid(3, constraintValidatorContext));
    }
}
