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

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 10:00
 */
class CssClassValidatorTest extends BaseMockitoUnitTest {
    @Mock
    private ConstraintValidatorContext constraintValidatorContext;

    @Test
    void testValid() {
        CssClassValidator validator = new CssClassValidator();
        assertTrue(validator.isValid("#abc", constraintValidatorContext));
        assertTrue(validator.isValid("#a1B2c3", constraintValidatorContext));
        assertFalse(validator.isValid("abc", constraintValidatorContext));
        assertFalse(validator.isValid("#abcd1a2", constraintValidatorContext));
        assertFalse(validator.isValid("#12xz99", constraintValidatorContext));
        assertTrue(validator.isValid("", constraintValidatorContext));
    }
}