should have one zero-argument constructor

This commit is contained in:
thinkgem
2025-11-02 23:57:05 +08:00
parent fde55e9cdf
commit ed6ef1fd38
6 changed files with 31 additions and 19 deletions

View File

@@ -11,6 +11,7 @@ import com.jeesite.modules.sys.entity.Area;
import org.junit.FixMethodOrder; import org.junit.FixMethodOrder;
import org.junit.Test; import org.junit.Test;
import org.junit.runners.MethodSorters; import org.junit.runners.MethodSorters;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.ActiveProfiles;
@@ -26,12 +27,13 @@ import java.util.Map;
@ActiveProfiles("test") @ActiveProfiles("test")
@SpringBootApplication @SpringBootApplication
@FixMethodOrder(MethodSorters.NAME_ASCENDING) @FixMethodOrder(MethodSorters.NAME_ASCENDING)
@SpringBootTest(properties = {"spring.ai.tools.enabled=true"}) @SpringBootTest(properties = {"spring.ai.model.chat=ollama","spring.ai.tools.enabled=true"})
public class AiChatServiceTest extends BaseSpringContextTests { public class AiChatServiceTest extends BaseSpringContextTests {
private final AiCmsChatService aiCmsChatService; private AiCmsChatService aiCmsChatService;
public AiChatServiceTest(AiCmsChatService aiCmsChatService) { @Autowired
public void setAiChatServiceTest(AiCmsChatService aiCmsChatService) {
this.aiCmsChatService = aiCmsChatService; this.aiCmsChatService = aiCmsChatService;
} }

View File

@@ -20,6 +20,7 @@ import com.jeesite.modules.sys.dao.*;
import com.jeesite.modules.sys.entity.*; import com.jeesite.modules.sys.entity.*;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.ActiveProfiles;
@@ -35,14 +36,15 @@ import java.util.List;
@SpringBootTest(classes = ApplicationTest.class) @SpringBootTest(classes = ApplicationTest.class)
public class DaoMapperTest extends BaseSpringContextTests { public class DaoMapperTest extends BaseSpringContextTests {
private final PostDao postDao; private PostDao postDao;
private final UserDao userDao; private UserDao userDao;
private final AreaDao areaDao; private AreaDao areaDao;
private final CompanyDao companyDao; private CompanyDao companyDao;
private final FileUploadDao fileUploadDao; private FileUploadDao fileUploadDao;
private final EmpUserDao empUserDao; private EmpUserDao empUserDao;
public DaoMapperTest(PostDao postDao, UserDao userDao, AreaDao areaDao, CompanyDao companyDao, @Autowired
public void setDaoMapperTest(PostDao postDao, UserDao userDao, AreaDao areaDao, CompanyDao companyDao,
FileUploadDao fileUploadDao, EmpUserDao empUserDao) { FileUploadDao fileUploadDao, EmpUserDao empUserDao) {
this.postDao = postDao; this.postDao = postDao;
this.userDao = userDao; this.userDao = userDao;

View File

@@ -11,6 +11,7 @@ import com.jeesite.modules.gen.entity.GenTable;
import com.jeesite.modules.gen.entity.GenTableColumn; import com.jeesite.modules.gen.entity.GenTableColumn;
import com.jeesite.modules.gen.service.GenTableService; import com.jeesite.modules.gen.service.GenTableService;
import org.junit.Test; import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.annotation.Rollback; import org.springframework.test.annotation.Rollback;
import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.ActiveProfiles;
@@ -25,9 +26,10 @@ import org.springframework.test.context.ActiveProfiles;
@Rollback(false) @Rollback(false)
public class GenTableToolTest extends BaseSpringContextTests { public class GenTableToolTest extends BaseSpringContextTests {
private final GenTableService genTableService; private GenTableService genTableService;
public GenTableToolTest(GenTableService genTableService) { @Autowired
public void setGenTableToolTest(GenTableService genTableService) {
this.genTableService = genTableService; this.genTableService = genTableService;
} }

View File

@@ -23,6 +23,7 @@ import com.jeesite.modules.sys.service.UserService;
import com.jeesite.modules.sys.utils.UserUtils; import com.jeesite.modules.sys.utils.UserUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.junit.Test; import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.annotation.Rollback; import org.springframework.test.annotation.Rollback;
import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.ActiveProfiles;
@@ -40,10 +41,11 @@ import java.util.List;
@Rollback(false) @Rollback(false)
public class MsgPushTest extends BaseSpringContextTests { public class MsgPushTest extends BaseSpringContextTests {
private final UserService userService; private UserService userService;
private final MsgTemplateService msgTemplateService; private MsgTemplateService msgTemplateService;
public MsgPushTest(UserService userService, MsgTemplateService msgTemplateService) { @Autowired
public void setMsgPushTest(UserService userService, MsgTemplateService msgTemplateService) {
this.userService = userService; this.userService = userService;
this.msgTemplateService = msgTemplateService; this.msgTemplateService = msgTemplateService;
} }

View File

@@ -9,6 +9,7 @@ import com.jeesite.common.tests.BaseSpringContextTests;
import com.jeesite.modules.test.dao.TestDataDao; import com.jeesite.modules.test.dao.TestDataDao;
import com.jeesite.modules.test.entity.TestData; import com.jeesite.modules.test.entity.TestData;
import org.junit.Test; import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.ActiveProfiles;
@@ -23,9 +24,10 @@ import java.util.List;
@SpringBootTest(classes = ApplicationTest.class) @SpringBootTest(classes = ApplicationTest.class)
public class InsertBatchTest extends BaseSpringContextTests { public class InsertBatchTest extends BaseSpringContextTests {
private final TestDataDao testDataDao; private TestDataDao testDataDao;
public InsertBatchTest(TestDataDao testDataDao) { @Autowired
public void setInsertBatchTest(TestDataDao testDataDao) {
this.testDataDao = testDataDao; this.testDataDao = testDataDao;
} }

View File

@@ -11,6 +11,7 @@ import com.jeesite.modules.test.entity.TestData;
import com.jeesite.modules.test.entity.TestDataChild; import com.jeesite.modules.test.entity.TestDataChild;
import com.jeesite.modules.test.service.TestDataService; import com.jeesite.modules.test.service.TestDataService;
import org.junit.Test; import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.ActiveProfiles;
@@ -31,9 +32,10 @@ import java.util.concurrent.Executors;
@SpringBootTest(classes = ApplicationTest.class) @SpringBootTest(classes = ApplicationTest.class)
public class MultiDataSourceTest extends BaseSpringContextTests { public class MultiDataSourceTest extends BaseSpringContextTests {
private final TestDataService testDataService; private TestDataService testDataService;
public MultiDataSourceTest(TestDataService testDataService) { @Autowired
public void setMultiDataSourceTest(TestDataService testDataService) {
this.testDataService = testDataService; this.testDataService = testDataService;
} }