package com.trade.client.companyrelated.service;

import com.trade.service.companyrelated.domain.ImporterEntity;
import com.trade.service.companyrelated.domain.vo.ImporterEntitySearch;
import liquibase.pro.packaged.A;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;

import javax.annotation.Resource;

import static org.junit.jupiter.api.Assertions.*;

@SpringBootTest
class ImporterEntityCServiceTest {

    @Resource
    private ImporterEntityCService importerEntityCService;

    @Test
    void add() {
        ImporterEntity importerEntity = new ImporterEntity();
        importerEntity.setUserId(1L);
        importerEntity.setCertNo("1234567890");
        importerEntityCService.add(importerEntity);
    }

    @Test
    void update() {
        ImporterEntity importerEntity = new ImporterEntity();
        importerEntity.setId(1L);
        importerEntity.setCertNo("7777777");
        importerEntityCService.update(importerEntity);
        Assertions.assertEquals("7777777", importerEntityCService.getByEntityId(1L).getCertNo());
    }

    @Test
    void deleteByEntityId() {
        importerEntityCService.deleteByEntityId(1L);
        assertNull(importerEntityCService.getByEntityId(1L));
    }

    @Test
    void queryListBySearch() {
        ImporterEntitySearch search = new ImporterEntitySearch();
        search.setUserId(1L);
        Assertions.assertEquals(1, importerEntityCService.queryListBySearch(search).getList().size());
    }
}
