From 3b478c9a27a4bb225ba32a86ba90286a7d95c62f Mon Sep 17 00:00:00 2001 From: Lukasz Jarocki Date: Tue, 5 Apr 2022 10:39:03 +0200 Subject: [PATCH] NO-JIRA fixing SQ issues, code smells, bugs --- .../task/projectanalysis/metric/MetricRepositoryImplTest.java | 4 ++-- .../src/test/java/org/sonar/db/audit/AuditDaoTest.java | 4 ++-- .../org/sonar/server/plugins/PluginsRiskConsentFilter.java | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/metric/MetricRepositoryImplTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/metric/MetricRepositoryImplTest.java index b5608a7c4d0..f82f87f090e 100644 --- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/metric/MetricRepositoryImplTest.java +++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/metric/MetricRepositoryImplTest.java @@ -193,7 +193,7 @@ public class MetricRepositoryImplTest { .collect(Collectors.toList()); underTest.start(); - assertThat(underTest.getMetricsByType(Metric.MetricType.MILLISEC).size()).isZero(); + assertThat(underTest.getMetricsByType(Metric.MetricType.MILLISEC)).isEmpty(); } @Test @@ -202,7 +202,7 @@ public class MetricRepositoryImplTest { .mapToObj(i -> dbTester.measures().insertMetric(t -> t.setKey("key_enabled_" + i).setEnabled(true).setValueType("MILISEC"))); underTest.start(); - assertThat(underTest.getMetricsByType(Metric.MetricType.RATING).size()).isZero(); + assertThat(underTest.getMetricsByType(Metric.MetricType.RATING)).isEmpty(); } @Test diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/audit/AuditDaoTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/audit/AuditDaoTest.java index 81468810d00..4be0ec9766a 100644 --- a/server/sonar-db-dao/src/test/java/org/sonar/db/audit/AuditDaoTest.java +++ b/server/sonar-db-dao/src/test/java/org/sonar/db/audit/AuditDaoTest.java @@ -47,7 +47,7 @@ public class AuditDaoTest { List auditDtos = testAuditDao.selectByPeriodPaginated(dbSession, 1, 20000, 1); - assertThat(auditDtos.size()).isEqualTo(10000); + assertThat(auditDtos).hasSize(10_000); } @Test @@ -87,7 +87,7 @@ public class AuditDaoTest { List auditDtos = testAuditDao.selectByPeriodPaginated(dbSession, 1, 101, 1); - assertThat(auditDtos.size()).isEqualTo(100); + assertThat(auditDtos).hasSize(100); } @Test diff --git a/server/sonar-webserver-core/src/main/java/org/sonar/server/plugins/PluginsRiskConsentFilter.java b/server/sonar-webserver-core/src/main/java/org/sonar/server/plugins/PluginsRiskConsentFilter.java index f5adf5ea5dc..022ed65c22f 100644 --- a/server/sonar-webserver-core/src/main/java/org/sonar/server/plugins/PluginsRiskConsentFilter.java +++ b/server/sonar-webserver-core/src/main/java/org/sonar/server/plugins/PluginsRiskConsentFilter.java @@ -44,7 +44,7 @@ public class PluginsRiskConsentFilter extends ServletFilter { private static final String PLUGINS_RISK_CONSENT_PATH = "/admin/plugin_risk_consent"; //NOSONAR this path will be the same in every environment - private static final Set SKIPPED_URLS = ImmutableSet.of( + private static final Set SKIPPED_URLS = Set.of( PLUGINS_RISK_CONSENT_PATH, "/account/reset_password", "/admin/change_admin_password", -- 2.39.5