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

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

    @Test
    void testValid() {
        AdvertisementStatusValidator validator = new AdvertisementStatusValidator();
        assertTrue(validator.isValid(AdvertisementStatusEnum.UNPUBLISHED.getStatus(), constraintValidatorContext));
        assertTrue(validator.isValid(AdvertisementStatusEnum.PUBLISHED.getStatus(), constraintValidatorContext));
        assertTrue(validator.isValid(AdvertisementStatusEnum.ENDED.getStatus(), constraintValidatorContext));
        assertTrue(validator.isValid(null, constraintValidatorContext));
        assertFalse(validator.isValid(100, constraintValidatorContext));
    }
}