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

import com.cf.imes.framework.test.core.ut.BaseMockitoUnitTest;
import com.cf.imes.module.system.enums.pay.PayChannelCodeEnum;
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/9 14:41
 */
public class PayChannelCodeValidatorTest extends BaseMockitoUnitTest {
    @Mock
    private ConstraintValidatorContext constraintValidatorContext;

    @Test
    void testValid() {
        PayChannelCodeValidator validator = new PayChannelCodeValidator();
        assertTrue(validator.isValid(PayChannelCodeEnum.ALIPAY_PC.getCode(), constraintValidatorContext));
        assertTrue(validator.isValid(PayChannelCodeEnum.WECHAT_NATIVE.getCode(), constraintValidatorContext));
        assertTrue(validator.isValid(null, constraintValidatorContext));
        assertFalse(validator.isValid(2, constraintValidatorContext));
    }
}