package com.ruoyi.web.modules.news.support;

import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.junit.jupiter.api.Assertions.assertThrows;

import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import com.ruoyi.common.exception.ServiceException;

@DisplayName("养殖资讯入参校验")
class FarmingNewsValidationTest
{
    @Test
    @DisplayName("YZX-UT-001 type 非空")
    void ut001_typeRequired()
    {
        assertThrows(ServiceException.class, () -> FarmingNewsValidation.validateType(null));
        assertThrows(ServiceException.class, () -> FarmingNewsValidation.validateType(""));
        assertThrows(ServiceException.class, () -> FarmingNewsValidation.validateType("   "));
        assertDoesNotThrow(() -> FarmingNewsValidation.validateType("001001"));
    }

    @Test
    @DisplayName("id 非空")
    void idRequired()
    {
        assertThrows(ServiceException.class, () -> FarmingNewsValidation.validateId(null));
        assertDoesNotThrow(() -> FarmingNewsValidation.validateId(1L));
    }
}
