aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-core/src
diff options
context:
space:
mode:
authorDuarte Meneses <duarte.meneses@sonarsource.com>2023-01-12 09:35:20 +0100
committersonartech <sonartech@sonarsource.com>2023-01-12 20:02:51 +0000
commit118a3ed166799831e097748f2ce8e113298ad14e (patch)
tree9ea5410359990f4ef457bf0822b5b31a770d15de /sonar-core/src
parent0b5343ff7744ec27ed14a90e07833319719bc9a8 (diff)
downloadsonarqube-118a3ed166799831e097748f2ce8e113298ad14e.tar.gz
sonarqube-118a3ed166799831e097748f2ce8e113298ad14e.zip
[NO JIRA] Fix quality issues related to assertions
Diffstat (limited to 'sonar-core/src')
-rw-r--r--sonar-core/src/test/java/org/sonar/core/i18n/I18nClassloaderTest.java2
-rw-r--r--sonar-core/src/test/java/org/sonar/core/platform/PluginInfoTest.java2
-rw-r--r--sonar-core/src/test/java/org/sonar/core/platform/ServerIdTest.java6
-rw-r--r--sonar-core/src/test/java/org/sonar/core/util/MacAddressProviderTest.java10
4 files changed, 11 insertions, 9 deletions
diff --git a/sonar-core/src/test/java/org/sonar/core/i18n/I18nClassloaderTest.java b/sonar-core/src/test/java/org/sonar/core/i18n/I18nClassloaderTest.java
index ce4d30546bd..d4c10259903 100644
--- a/sonar-core/src/test/java/org/sonar/core/i18n/I18nClassloaderTest.java
+++ b/sonar-core/src/test/java/org/sonar/core/i18n/I18nClassloaderTest.java
@@ -65,7 +65,7 @@ public class I18nClassloaderTest {
@Test
public void override_toString() {
- assertThat(i18nClassloader.toString()).isEqualTo("i18n-classloader");
+ assertThat(i18nClassloader).hasToString("i18n-classloader");
}
private static URLClassLoader newCheckstyleClassloader() {
diff --git a/sonar-core/src/test/java/org/sonar/core/platform/PluginInfoTest.java b/sonar-core/src/test/java/org/sonar/core/platform/PluginInfoTest.java
index 6d3b56bcf25..5c8aefa2e4c 100644
--- a/sonar-core/src/test/java/org/sonar/core/platform/PluginInfoTest.java
+++ b/sonar-core/src/test/java/org/sonar/core/platform/PluginInfoTest.java
@@ -287,7 +287,7 @@ public class PluginInfoTest {
@Test
public void test_toString() {
PluginInfo pluginInfo = new PluginInfo("java").setVersion(Version.create("1.1"));
- assertThat(pluginInfo.toString()).isEqualTo("[java / 1.1]");
+ assertThat(pluginInfo).hasToString("[java / 1.1]");
pluginInfo.setImplementationBuild("SHA1");
assertThat(pluginInfo).hasToString("[java / 1.1 / SHA1]");
diff --git a/sonar-core/src/test/java/org/sonar/core/platform/ServerIdTest.java b/sonar-core/src/test/java/org/sonar/core/platform/ServerIdTest.java
index e3ef58677ed..82019204fc3 100644
--- a/sonar-core/src/test/java/org/sonar/core/platform/ServerIdTest.java
+++ b/sonar-core/src/test/java/org/sonar/core/platform/ServerIdTest.java
@@ -113,7 +113,7 @@ public class ServerIdTest {
assertThat(serverId.getFormat()).isEqualTo(DEPRECATED);
assertThat(serverId.getDatasetId()).isEqualTo(deprecated);
assertThat(serverId.getDatabaseId()).isEmpty();
- assertThat(serverId.toString()).isEqualTo(deprecated);
+ assertThat(serverId).hasToString(deprecated);
}
@Test
@@ -124,7 +124,7 @@ public class ServerIdTest {
assertThat(serverId.getFormat()).isEqualTo(NO_DATABASE_ID);
assertThat(serverId.getDatasetId()).isEqualTo(noDatabaseId);
assertThat(serverId.getDatabaseId()).isEmpty();
- assertThat(serverId.toString()).isEqualTo(noDatabaseId);
+ assertThat(serverId).hasToString(noDatabaseId);
}
@DataProvider
@@ -148,7 +148,7 @@ public class ServerIdTest {
assertThat(serverId.getFormat()).isEqualTo(WITH_DATABASE_ID);
assertThat(serverId.getDatasetId()).isEqualTo(datasetId);
assertThat(serverId.getDatabaseId()).contains(databaseId);
- assertThat(serverId.toString()).isEqualTo(rawServerId);
+ assertThat(serverId).hasToString(rawServerId);
}
@DataProvider
diff --git a/sonar-core/src/test/java/org/sonar/core/util/MacAddressProviderTest.java b/sonar-core/src/test/java/org/sonar/core/util/MacAddressProviderTest.java
index 15e196c9d29..677c59f4e85 100644
--- a/sonar-core/src/test/java/org/sonar/core/util/MacAddressProviderTest.java
+++ b/sonar-core/src/test/java/org/sonar/core/util/MacAddressProviderTest.java
@@ -28,14 +28,16 @@ public class MacAddressProviderTest {
@Test
public void getSecureMungedAddress() {
byte[] address = MacAddressProvider.getSecureMungedAddress();
- assertThat(address).isNotEmpty();
- assertThat(address).hasSize(6);
+ assertThat(address)
+ .isNotEmpty()
+ .hasSize(6);
}
@Test
public void constructDummyMulticastAddress() {
byte[] address = MacAddressProvider.constructDummyMulticastAddress();
- assertThat(address).isNotEmpty();
- assertThat(address).hasSize(6);
+ assertThat(address)
+ .isNotEmpty()
+ .hasSize(6);
}
}