package com.njcn.gather.aireport.reportmodel.component;

import com.njcn.gather.aireport.reportmodel.mapper.ReportModelMapper;
import com.njcn.gather.aireport.reportmodel.pojo.vo.ReportModelUserNameVO;
import org.junit.Assert;
import org.junit.Test;

import java.util.Arrays;
import java.util.Map;

import static org.mockito.ArgumentMatchers.anyCollection;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

public class ReportModelUserNameResolverTest {

    @Test
    public void resolveUserNamesReturnsSysUserNameById() {
        ReportModelMapper mapper = mock(ReportModelMapper.class);
        ReportModelUserNameVO user = new ReportModelUserNameVO();
        user.setId("user-001");
        user.setName("张三");
        when(mapper.selectUserNamesByIds(anyCollection())).thenReturn(Arrays.asList(user));

        ReportModelUserNameResolver resolver = new ReportModelUserNameResolver(mapper);
        Map<String, String> result = resolver.resolveUserNames(Arrays.asList("user-001"));

        Assert.assertEquals("张三", result.get("user-001"));
    }
}
