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

import com.cf.imes.framework.common.enums.MachineTypeEnum;
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:17
 */
class MachineTypeValidatorTest extends BaseMockitoUnitTest {
    @Mock
    private ConstraintValidatorContext constraintValidatorContext;

    @Test
    void testValid() {
        MachineTypeValidator validator = new MachineTypeValidator();
        assertTrue(validator.isValid(MachineTypeEnum.CUTTING.getType(), constraintValidatorContext));
        assertTrue(validator.isValid(MachineTypeEnum.DRILL.getType(), constraintValidatorContext));
        assertTrue(validator.isValid(MachineTypeEnum.PANELSAW.getType(), constraintValidatorContext));
        assertTrue(validator.isValid(MachineTypeEnum.LABELING.getType(), constraintValidatorContext));
        assertTrue(validator.isValid(MachineTypeEnum.BANDING.getType(), constraintValidatorContext));
        assertTrue(validator.isValid(null, constraintValidatorContext));
        assertFalse(validator.isValid(100, constraintValidatorContext));
    }
}