package com.crm.manager.service;

import com.crm.rely.backend.core.dto.user.info.UserAttachInfoDto;
import com.crm.rely.backend.exception.ServiceException;
import org.apache.commons.compress.utils.Lists;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import java.util.Arrays;
import java.util.List;

@SpringBootTest
@RunWith(SpringJUnit4ClassRunner.class)
public class UserInfoAttachServiceTest {

    @Autowired
    private UserInfoAttachService userInfoAttachService;

    @Test
    public void saveAttachInfo() {
        try {
            userInfoAttachService.saveAttachInfo(3L, Arrays.asList(1L));
//            userInfoAttachService.saveAttachInfo(3L, Lists.newArrayList());
        } catch (ServiceException e) {
            e.printStackTrace();
            throw new RuntimeException(e.getMessage());

        }
    }

    @Test
    public void getAttachInfoById() {
        try {
            List<UserAttachInfoDto> attachInfoByUserId = userInfoAttachService.getAttachInfoByUserId(3L);
            System.out.println(attachInfoByUserId);
        } catch (ServiceException e) {
            e.printStackTrace();
            throw new RuntimeException(e.getMessage());

        }
    }


}
