From 0931df7153c21204278e4352c536e1896ca1f13a Mon Sep 17 00:00:00 2001 From: xuxueli <931591021@qq.com> Date: Wed, 20 Apr 2022 15:55:12 +0800 Subject: [PATCH] code optimize --- .../xxl/job/admin/controller/JobInfoControllerTest.java | 5 ++++- .../java/com/xxl/job/admin/dao/XxlJobInfoDaoTest.java | 9 ++++++--- .../test/java/com/xxl/job/admin/util/I18nUtilTest.java | 9 ++++++--- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/xxl-job-admin/src/test/java/com/xxl/job/admin/controller/JobInfoControllerTest.java b/xxl-job-admin/src/test/java/com/xxl/job/admin/controller/JobInfoControllerTest.java index a8231cbe..49bf8aec 100644 --- a/xxl-job-admin/src/test/java/com/xxl/job/admin/controller/JobInfoControllerTest.java +++ b/xxl-job-admin/src/test/java/com/xxl/job/admin/controller/JobInfoControllerTest.java @@ -3,6 +3,8 @@ package com.xxl.job.admin.controller; import com.xxl.job.admin.service.LoginService; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.http.MediaType; import org.springframework.test.web.servlet.MvcResult; import org.springframework.util.LinkedMultiValueMap; @@ -13,6 +15,7 @@ import javax.servlet.http.Cookie; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; public class JobInfoControllerTest extends AbstractSpringMvcTest { + private static Logger logger = LoggerFactory.getLogger(JobInfoControllerTest.class); private Cookie cookie; @@ -41,7 +44,7 @@ public class JobInfoControllerTest extends AbstractSpringMvcTest { .cookie(cookie) ).andReturn(); - System.out.println(ret.getResponse().getContentAsString()); + logger.info(ret.getResponse().getContentAsString()); } } diff --git a/xxl-job-admin/src/test/java/com/xxl/job/admin/dao/XxlJobInfoDaoTest.java b/xxl-job-admin/src/test/java/com/xxl/job/admin/dao/XxlJobInfoDaoTest.java index 4fce17ec..0cb7d53c 100644 --- a/xxl-job-admin/src/test/java/com/xxl/job/admin/dao/XxlJobInfoDaoTest.java +++ b/xxl-job-admin/src/test/java/com/xxl/job/admin/dao/XxlJobInfoDaoTest.java @@ -4,6 +4,8 @@ import com.xxl.job.admin.core.model.XxlJobInfo; import com.xxl.job.admin.core.scheduler.MisfireStrategyEnum; import com.xxl.job.admin.core.scheduler.ScheduleTypeEnum; import org.junit.jupiter.api.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.boot.test.context.SpringBootTest; import javax.annotation.Resource; @@ -12,6 +14,7 @@ import java.util.List; @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) public class XxlJobInfoDaoTest { + private static Logger logger = LoggerFactory.getLogger(XxlJobInfoDaoTest.class); @Resource private XxlJobInfoDao xxlJobInfoDao; @@ -20,9 +23,9 @@ public class XxlJobInfoDaoTest { public void pageList(){ List list = xxlJobInfoDao.pageList(0, 20, 0, -1, null, null, null); int list_count = xxlJobInfoDao.pageListCount(0, 20, 0, -1, null, null, null); - - System.out.println(list); - System.out.println(list_count); + + logger.info("", list); + logger.info("", list_count); List list2 = xxlJobInfoDao.getJobsByGroup(1); } diff --git a/xxl-job-admin/src/test/java/com/xxl/job/admin/util/I18nUtilTest.java b/xxl-job-admin/src/test/java/com/xxl/job/admin/util/I18nUtilTest.java index a62541f7..29079f18 100644 --- a/xxl-job-admin/src/test/java/com/xxl/job/admin/util/I18nUtilTest.java +++ b/xxl-job-admin/src/test/java/com/xxl/job/admin/util/I18nUtilTest.java @@ -2,6 +2,8 @@ package com.xxl.job.admin.util; import com.xxl.job.admin.core.util.I18nUtil; import org.junit.jupiter.api.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.boot.test.context.SpringBootTest; /** @@ -11,12 +13,13 @@ import org.springframework.boot.test.context.SpringBootTest; */ @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) public class I18nUtilTest { + private static Logger logger = LoggerFactory.getLogger(I18nUtilTest.class); @Test public void test(){ - System.out.println(I18nUtil.getString("admin_name")); - System.out.println(I18nUtil.getMultString("admin_name", "admin_name_full")); - System.out.println(I18nUtil.getMultString()); + logger.info(I18nUtil.getString("admin_name")); + logger.info(I18nUtil.getMultString("admin_name", "admin_name_full")); + logger.info(I18nUtil.getMultString()); } }