package com.estate.expert.admin.service;
|
|
import com.estate.expert.admin.domain.common.request.PageReq;
|
import com.estate.expert.admin.domain.plan.PlanState;
|
import com.estate.expert.admin.domain.plan.PlanType;
|
import lombok.extern.slf4j.Slf4j;
|
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.extension.ExtendWith;
|
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
import org.springframework.transaction.annotation.Transactional;
|
|
import javax.annotation.Resource;
|
import java.util.List;
|
|
/**
|
* @ClassName PlanServiceTest
|
* @Description
|
* @Author daisyli
|
* @Date 2023/9/9
|
**/
|
@Slf4j
|
@SpringBootTest
|
@ExtendWith(SpringExtension.class)
|
@Transactional
|
public class PlanServiceTest {
|
|
@Resource
|
private PlanService planService;
|
|
@Test
|
public void testList() {
|
var res = planService.list(null, null,
|
null, null,
|
null, PageReq.defaultPageReq());
|
Assertions.assertEquals(10, res.getTotalElements());
|
|
// clients
|
res = planService.list(null, null,
|
null, List.of(1),
|
null, PageReq.defaultPageReq());
|
Assertions.assertEquals(10, res.getTotalElements());
|
|
res = planService.list(null, null,
|
null, List.of(0),
|
null, PageReq.defaultPageReq());
|
Assertions.assertEquals(0, res.getTotalElements());
|
|
res = planService.list(null, null,
|
null, List.of(0, 1),
|
null, PageReq.defaultPageReq());
|
Assertions.assertEquals(10, res.getTotalElements());
|
|
// state
|
res = planService.list(null, null,
|
List.of(PlanState.COMPLETE, PlanState.EXECUTING, PlanState.PUBLISHED), List.of(1),
|
null, PageReq.defaultPageReq());
|
Assertions.assertEquals(10, res.getTotalElements());
|
|
// planTypes
|
res = planService.list(null, List.of(PlanType.SECURITY_CHECK, PlanType.COMPREHENSIVE_CHECK),
|
List.of(PlanState.COMPLETE, PlanState.EXECUTING, PlanState.PUBLISHED), List.of(1),
|
null, PageReq.defaultPageReq());
|
Assertions.assertEquals(10, res.getTotalElements());
|
}
|
|
}
|