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

import com.cf.imes.framework.common.enums.CommonStatusEnum;
import com.cf.imes.framework.test.core.ut.BaseMockitoUnitTest;
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/10/29 9:51
 */
class CommonStatusValidatorTest  extends BaseMockitoUnitTest {
    @Mock
    private ConstraintValidatorContext constraintValidatorContext;

    @Test
    void testValid() {
        CommonStatusValidator validator = new CommonStatusValidator();
        assertTrue(validator.isValid(CommonStatusEnum.ENABLE.getStatus(), constraintValidatorContext));
        assertTrue(validator.isValid(CommonStatusEnum.DISABLE.getStatus(), constraintValidatorContext));
        assertTrue(validator.isValid(null, constraintValidatorContext));
        assertFalse(validator.isValid(100, constraintValidatorContext));
    }
}
