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

import static org.junit.jupiter.api.Assertions.assertEquals;
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;
import com.ruoyi.web.modules.diagnosis.domain.BizConsultSession;
import com.ruoyi.web.modules.diagnosis.domain.VetConsultSendBody;

@DisplayName("AiConsultValidation")
class AiConsultValidationTest
{
    @Test
    @DisplayName("搜索关键字为空")
    void emptySearchKeyword()
    {
        BizConsultSession q = new BizConsultSession();
        ServiceException ex = assertThrows(ServiceException.class,
                () -> AiConsultValidation.validateListQuery(q, true));
        assertEquals("请输入筛选条件", ex.getMessage());
    }

    @Test
    @DisplayName("AI提问分类非法")
    void invalidAiCategory()
    {
        ServiceException ex = assertThrows(ServiceException.class,
                () -> AiConsultValidation.validateAiCategory("9"));
        assertEquals("AI提问分类无效", ex.getMessage());
    }

    @Test
    @DisplayName("发送校验复用")
    void sendValidation()
    {
        VetConsultSendBody body = new VetConsultSendBody();
        body.setMsgType(ConsultSessionRules.MSG_TYPE_TEXT);
        body.setContent("");
        ServiceException ex = assertThrows(ServiceException.class, () -> VetConsultValidation.validateSendBody(body));
        assertEquals("请输入消息内容", ex.getMessage());
    }
}
