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

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.execution.vo.execution.ProjectExecutionStatusBoardRespVO;
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 ProjectExecutionStatusBoardControllerTest extends BaseMockitoUnitTest {

    @InjectMocks
    private ProjectExecutionController projectExecutionController;
    @Mock
    private ProjectStatusBoardService projectStatusBoardService;

    @Test
    void getExecutionStatusBoard_shouldReturnServiceResult() {
        ProjectExecutionStatusBoardRespVO respVO = new ProjectExecutionStatusBoardRespVO();
        respVO.setTotal(1L);
        respVO.setItems(List.of());
        when(projectStatusBoardService.getExecutionStatusBoard(2001L, null)).thenReturn(respVO);

        CommonResult<ProjectExecutionStatusBoardRespVO> result = projectExecutionController.getExecutionStatusBoard(2001L, null);

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

}
