diff --git a/src/backend/job-crontab/boot-job-crontab/src/test/java/com/tencent/bk/job/crontab/dao/impl/CronJobDAOImplIntegrationTest.java b/src/backend/job-crontab/boot-job-crontab/src/test/java/com/tencent/bk/job/crontab/dao/impl/CronJobDAOImplIntegrationTest.java index 05aac61869..a9b48c6cd9 100644 --- a/src/backend/job-crontab/boot-job-crontab/src/test/java/com/tencent/bk/job/crontab/dao/impl/CronJobDAOImplIntegrationTest.java +++ b/src/backend/job-crontab/boot-job-crontab/src/test/java/com/tencent/bk/job/crontab/dao/impl/CronJobDAOImplIntegrationTest.java @@ -53,7 +53,9 @@ import java.util.Collections; import java.util.List; import java.util.Random; +import java.util.Set; import java.util.UUID; +import java.util.stream.Collectors; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; @@ -419,16 +421,18 @@ void listCronJobByCondition() { assertThat(cronJobInfoPageData.getStart()).isEqualTo(0); assertThat(cronJobInfoPageData.getPageSize()).isEqualTo(2); assertThat(cronJobInfoPageData.getTotal()).isEqualTo(4); - assertThat(cronJobInfoPageData.getData()).contains(CRON_JOB_5); - assertThat(cronJobInfoPageData.getData()).contains(CRON_JOB_1); + Set ids = cronJobInfoPageData.getData().stream().map(CronJobInfoDTO::getId).collect(Collectors.toSet()); + assertThat(ids).contains(CRON_JOB_5.getId()); + assertThat(ids).contains(CRON_JOB_1.getId()); baseSearchCondition.setStart(2); cronJobInfoPageData = cronJobDAO.listPageCronJobsWithoutVarsByCondition(cronJobCondition, baseSearchCondition); assertThat(cronJobInfoPageData.getStart()).isEqualTo(2); assertThat(cronJobInfoPageData.getPageSize()).isEqualTo(2); assertThat(cronJobInfoPageData.getTotal()).isEqualTo(4); - assertThat(cronJobInfoPageData.getData()).contains(CRON_JOB_9); - assertThat(cronJobInfoPageData.getData()).contains(CRON_JOB_3); + ids = cronJobInfoPageData.getData().stream().map(CronJobInfoDTO::getId).collect(Collectors.toSet()); + assertThat(ids).contains(CRON_JOB_9.getId()); + assertThat(ids).contains(CRON_JOB_3.getId()); System.out.println(cronJobInfoPageData.getData()); baseSearchCondition.setStart(0); @@ -437,8 +441,9 @@ void listCronJobByCondition() { assertThat(cronJobInfoPageData.getStart()).isEqualTo(0); assertThat(cronJobInfoPageData.getPageSize()).isEqualTo(2); assertThat(cronJobInfoPageData.getTotal()).isEqualTo(4); - assertThat(cronJobInfoPageData.getData()).contains(CRON_JOB_9); - assertThat(cronJobInfoPageData.getData()).contains(CRON_JOB_3); + ids = cronJobInfoPageData.getData().stream().map(CronJobInfoDTO::getId).collect(Collectors.toSet()); + assertThat(ids).contains(CRON_JOB_9.getId()); + assertThat(ids).contains(CRON_JOB_3.getId()); System.out.println(cronJobInfoPageData.getData()); baseSearchCondition.setOrder(0); }