package com.ruoyi.web.modules.diagnosis.service.impl;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.when;
import java.util.Collections;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;
import com.ruoyi.web.modules.diagnosis.domain.AppOnlineConsultVetQuery;
import com.ruoyi.web.modules.diagnosis.domain.vo.AppOnlineConsultVetListVo;
import com.ruoyi.web.modules.diagnosis.mapper.AppOnlineConsultMapper;

@ExtendWith(MockitoExtension.class)
@DisplayName("AppOnlineConsultServiceImpl")
class AppOnlineConsultServiceImplTest
{
    @Mock
    private AppOnlineConsultMapper appOnlineConsultMapper;

    @InjectMocks
    private AppOnlineConsultServiceImpl service;

    @Test
    @DisplayName("兽医列表 trim 关键字")
    void list()
    {
        AppOnlineConsultVetListVo vo = new AppOnlineConsultVetListVo();
        vo.setId(1L);
        vo.setResourceName("张兽医");
        when(appOnlineConsultMapper.selectOnlineConsultVetList(any())).thenReturn(Collections.singletonList(vo));

        AppOnlineConsultVetQuery query = new AppOnlineConsultVetQuery();
        query.setResourceName(" 张 ");
        assertEquals(1, service.selectOnlineConsultVetList(query).size());
    }
}
