From 118a3ed166799831e097748f2ce8e113298ad14e Mon Sep 17 00:00:00 2001 From: Duarte Meneses Date: Thu, 12 Jan 2023 09:35:20 +0100 Subject: [NO JIRA] Fix quality issues related to assertions --- .../java/org/sonar/server/notification/NotificationChannelTest.java | 2 +- .../org/sonar/server/platform/serverid/ServerIdFactoryImplTest.java | 4 ++-- .../src/test/java/org/sonar/server/telemetry/TelemetryClientTest.java | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'server/sonar-webserver-core/src') diff --git a/server/sonar-webserver-core/src/test/java/org/sonar/server/notification/NotificationChannelTest.java b/server/sonar-webserver-core/src/test/java/org/sonar/server/notification/NotificationChannelTest.java index 40b0a25d890..edd6354a881 100644 --- a/server/sonar-webserver-core/src/test/java/org/sonar/server/notification/NotificationChannelTest.java +++ b/server/sonar-webserver-core/src/test/java/org/sonar/server/notification/NotificationChannelTest.java @@ -31,7 +31,7 @@ public class NotificationChannelTest { public void defaultMethods() { NotificationChannel channel = new FakeNotificationChannel(); assertThat(channel.getKey()).isEqualTo("FakeNotificationChannel"); - assertThat(channel.toString()).isEqualTo("FakeNotificationChannel"); + assertThat(channel).hasToString("FakeNotificationChannel"); } private static class FakeNotificationChannel extends NotificationChannel { diff --git a/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/serverid/ServerIdFactoryImplTest.java b/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/serverid/ServerIdFactoryImplTest.java index 897d6ebe5fc..11ec21846fd 100644 --- a/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/serverid/ServerIdFactoryImplTest.java +++ b/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/serverid/ServerIdFactoryImplTest.java @@ -71,7 +71,7 @@ public class ServerIdFactoryImplTest { ServerId serverId = underTest.create(); - assertThat(serverId.getDatabaseId().get()).isEqualTo(crc32Hex(sanitizedJdbcUrl)); + assertThat(serverId.getDatabaseId()).contains(crc32Hex(sanitizedJdbcUrl)); assertThat(serverId.getDatasetId()).isEqualTo(uuid); } @@ -91,7 +91,7 @@ public class ServerIdFactoryImplTest { ServerId serverId = underTest.create(currentServerId); - assertThat(serverId.getDatabaseId().get()).isEqualTo(crc32Hex(sanitizedJdbcUrl)); + assertThat(serverId.getDatabaseId()).contains(crc32Hex(sanitizedJdbcUrl)); assertThat(serverId.getDatasetId()).isEqualTo(currentServerId.getDatasetId()); } diff --git a/server/sonar-webserver-core/src/test/java/org/sonar/server/telemetry/TelemetryClientTest.java b/server/sonar-webserver-core/src/test/java/org/sonar/server/telemetry/TelemetryClientTest.java index 765dc58d825..2beb1f54f47 100644 --- a/server/sonar-webserver-core/src/test/java/org/sonar/server/telemetry/TelemetryClientTest.java +++ b/server/sonar-webserver-core/src/test/java/org/sonar/server/telemetry/TelemetryClientTest.java @@ -61,7 +61,7 @@ public class TelemetryClientTest { Buffer body = new Buffer(); request.body().writeTo(body); assertThat(body.readUtf8()).isEqualTo(JSON); - assertThat(request.url().toString()).isEqualTo(TELEMETRY_URL); + assertThat(request.url()).hasToString(TELEMETRY_URL); } @Test @@ -79,6 +79,6 @@ public class TelemetryClientTest { Buffer body = new Buffer(); request.body().writeTo(body); assertThat(body.readUtf8()).isEqualTo(JSON); - assertThat(request.url().toString()).isEqualTo(TELEMETRY_URL); + assertThat(request.url()).hasToString(TELEMETRY_URL); } } -- cgit v1.2.3