diff options
author | Duarte Meneses <duarte.meneses@sonarsource.com> | 2023-01-12 09:35:20 +0100 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2023-01-12 20:02:51 +0000 |
commit | 118a3ed166799831e097748f2ce8e113298ad14e (patch) | |
tree | 9ea5410359990f4ef457bf0822b5b31a770d15de /server/sonar-main | |
parent | 0b5343ff7744ec27ed14a90e07833319719bc9a8 (diff) | |
download | sonarqube-118a3ed166799831e097748f2ce8e113298ad14e.tar.gz sonarqube-118a3ed166799831e097748f2ce8e113298ad14e.zip |
[NO JIRA] Fix quality issues related to assertions
Diffstat (limited to 'server/sonar-main')
3 files changed, 10 insertions, 9 deletions
diff --git a/server/sonar-main/src/test/java/org/sonar/application/command/JvmOptionsTest.java b/server/sonar-main/src/test/java/org/sonar/application/command/JvmOptionsTest.java index 3e23bed0305..3c6b727efcb 100644 --- a/server/sonar-main/src/test/java/org/sonar/application/command/JvmOptionsTest.java +++ b/server/sonar-main/src/test/java/org/sonar/application/command/JvmOptionsTest.java @@ -338,7 +338,7 @@ public class JvmOptionsTest { public void toString_prints_all_jvm_options() { underTest.add("-foo").add("-bar"); - assertThat(underTest.toString()).isEqualTo("[-foo, -bar]"); + assertThat(underTest).hasToString("[-foo, -bar]"); } private void expectJvmOptionNotNullNPE(ThrowingCallable callback) { diff --git a/server/sonar-main/src/test/java/org/sonar/application/config/AppSettingsImplTest.java b/server/sonar-main/src/test/java/org/sonar/application/config/AppSettingsImplTest.java index e42c4bf13bd..c274323d413 100644 --- a/server/sonar-main/src/test/java/org/sonar/application/config/AppSettingsImplTest.java +++ b/server/sonar-main/src/test/java/org/sonar/application/config/AppSettingsImplTest.java @@ -38,8 +38,8 @@ public class AppSettingsImplTest { AppSettingsImpl underTest = new AppSettingsImpl(initialProps); underTest.reload(newProps); - assertThat(underTest.getValue("foo").get()).isEqualTo("baz"); - assertThat(underTest.getValue("newProp").get()).isEqualTo("newVal"); + assertThat(underTest.getValue("foo")).contains("baz"); + assertThat(underTest.getValue("newProp")).contains("newVal"); assertThat(underTest.getProps().rawProperties()).hasSize(2); } } diff --git a/server/sonar-main/src/test/java/org/sonar/application/es/EsYmlSettingsTest.java b/server/sonar-main/src/test/java/org/sonar/application/es/EsYmlSettingsTest.java index 30c1284c18c..fe7887e2d7d 100644 --- a/server/sonar-main/src/test/java/org/sonar/application/es/EsYmlSettingsTest.java +++ b/server/sonar-main/src/test/java/org/sonar/application/es/EsYmlSettingsTest.java @@ -39,14 +39,15 @@ public class EsYmlSettingsTest { File yamlFile = temp.newFile(); new EsYmlSettings(new HashMap<>()).writeToYmlSettingsFile(yamlFile); - assertThat(yamlFile).exists(); - assertThat(yamlFile).hasContent(""" - # This file has been automatically generated by SonarQube during startup. + assertThat(yamlFile) + .exists() + .hasContent(""" + # This file has been automatically generated by SonarQube during startup. - # DO NOT EDIT THIS FILE + # DO NOT EDIT THIS FILE - { - }"""); + { + }"""); } @Test |