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

import com.cf.imes.framework.test.core.ut.BaseMockitoUnitTest;
import com.cf.imes.module.system.enums.sms.SmsReceiveStatusEnum;
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:16
 */
class SmsReceiveStatusValidatorTest extends BaseMockitoUnitTest {
    @Mock
    private ConstraintValidatorContext constraintValidatorContext;

    @Test
    void testValid() {
        SmsReceiveStatusValidator validator = new SmsReceiveStatusValidator();
        assertTrue(validator.isValid(SmsReceiveStatusEnum.INIT.getStatus(), constraintValidatorContext));
        assertTrue(validator.isValid(SmsReceiveStatusEnum.SUCCESS.getStatus(), constraintValidatorContext));
        assertTrue(validator.isValid(SmsReceiveStatusEnum.FAILURE.getStatus(), constraintValidatorContext));
        assertTrue(validator.isValid(null, constraintValidatorContext));
        assertFalse(validator.isValid(30, constraintValidatorContext));
    }
}