package cn.lihongjie.coal.warehouseGoodsSummary.service;

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

import cn.lihongjie.coal.base.dto.CommonQuery;
import cn.lihongjie.coal.runner.InitDataRunner;

import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.mock.mockito.MockBean;

import java.util.*;

@SpringBootTest(
        properties = {
                "PG_DATABASE=coal_master",
                "spring.profiles.active=master",
                "spring.jpa.hibernate.ddl-auto=none",
                "spring.main.lazy-initialization=true"
        }

)
@MockBean(InitDataRunner.class)

class WarehouseGoodsSummaryServiceTest {


    @Autowired
    WarehouseGoodsSummaryService service;

    @Test
    @DisplayName("验证sql拦截器是否生效")
    void test1() {

        service.list(new CommonQuery());
        
    }

    @Test
    @DisplayName("验证上期结余是否正确")
    void test2() {

        CommonQuery query = new CommonQuery();
        query.setItems(new ArrayList<>());
        query.getItems().add(new CommonQuery.QueryItem().withKey("startTime").withOpt("ge").withValue("2021-01-01 00:00:00"));
        service.list(query);

    }
}
