package com.njcn.rdms.module.project.controller.admin.project.task;

import com.njcn.rdms.framework.common.pojo.CommonResult;
import com.njcn.rdms.framework.test.core.ut.BaseMockitoUnitTest;
import com.njcn.rdms.module.project.controller.admin.project.task.vo.ProjectTaskStatusBoardRespVO;
import com.njcn.rdms.module.project.service.project.ProjectStatusBoardService;
import org.junit.jupiter.api.Test;
import org.mockito.InjectMocks;
import org.mockito.Mock;

import java.util.List;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.Mockito.when;

class ProjectTaskStatusBoardControllerTest extends BaseMockitoUnitTest {

    @InjectMocks
    private ProjectTaskController projectTaskController;
    @Mock
    private ProjectStatusBoardService projectStatusBoardService;

    @Test
    void getTaskStatusBoard_shouldReturnServiceResult() {
        ProjectTaskStatusBoardRespVO respVO = new ProjectTaskStatusBoardRespVO();
        respVO.setTotal(1L);
        respVO.setItems(List.of());
        when(projectStatusBoardService.getTaskStatusBoard(2001L, 5001L, null)).thenReturn(respVO);

        CommonResult<ProjectTaskStatusBoardRespVO> result = projectTaskController.getTaskStatusBoard(2001L, 5001L, null);

        assertEquals(0, result.getCode());
        assertEquals(1L, result.getData().getTotal());
    }

}
