From: Claire Villard Date: Mon, 29 Apr 2024 08:16:53 +0000 (+0200) Subject: Use Map assertions X-Git-Tag: 6.0.0.4432~7 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=ee9f00edc5e2958fce1c70d0b1cfd62267a3a204;p=sonar-scanner-cli.git Use Map assertions --- diff --git a/src/test/java/org/sonarsource/scanner/cli/PropertyResolverTest.java b/src/test/java/org/sonarsource/scanner/cli/PropertyResolverTest.java index 874e476..a22f9f6 100644 --- a/src/test/java/org/sonarsource/scanner/cli/PropertyResolverTest.java +++ b/src/test/java/org/sonarsource/scanner/cli/PropertyResolverTest.java @@ -41,9 +41,10 @@ class PropertyResolverTest { PropertyResolver resolver = new PropertyResolver(map, env); Properties resolved = resolver.resolve(); - assertThat(resolved.get("A")).isEqualTo("value a"); - assertThat(resolved.get("B")).isEqualTo("value b"); - assertThat(resolved.get("C")).isEqualTo("value a value b "); + assertThat(resolved) + .containsEntry("A", "value a") + .containsEntry("B", "value b") + .containsEntry("C", "value a value b "); map.clear(); map.put("sonar.login", "admin"); @@ -51,7 +52,7 @@ class PropertyResolverTest { resolver = new PropertyResolver(map, env); resolved = resolver.resolve(); - assertThat(resolved.get("sonar.password")).isEqualTo("admin"); + assertThat(resolved).containsEntry("sonar.password", "admin"); } @Test @@ -67,9 +68,10 @@ class PropertyResolverTest { PropertyResolver resolver = new PropertyResolver(map, env); Properties resolved = resolver.resolve(); - assertThat(resolved.get("A")).isEqualTo("invalid"); - assertThat(resolved.get("B")).isEqualTo("value b"); - assertThat(resolved.get("C")).isEqualTo("value a value b "); + assertThat(resolved) + .containsEntry("A", "invalid") + .containsEntry("B", "value b") + .containsEntry("C", "value a value b "); } @Test @@ -82,9 +84,10 @@ class PropertyResolverTest { PropertyResolver resolver = new PropertyResolver(map, env); Properties resolved = resolver.resolve(); - assertThat(resolved.get("A")).isEqualTo("value a"); - assertThat(resolved.get("B")).isEqualTo("value a"); - assertThat(resolved.get("C")).isEqualTo("value a value a"); + assertThat(resolved) + .containsEntry("A", "value a") + .containsEntry("B", "value a") + .containsEntry("C", "value a value a"); } @Test @@ -97,9 +100,10 @@ class PropertyResolverTest { PropertyResolver resolver = new PropertyResolver(map, env); Properties resolved = resolver.resolve(); - assertThat(resolved.get("A")).isEqualTo("value a"); - assertThat(resolved.get("B")).isEqualTo("value b"); - assertThat(resolved.get("C")).isEqualTo("${A value b}"); + assertThat(resolved) + .containsEntry("A", "value a") + .containsEntry("B", "value b") + .containsEntry("C", "${A value b}"); } @Test @@ -110,7 +114,7 @@ class PropertyResolverTest { PropertyResolver resolver = new PropertyResolver(map, env); Properties resolved = resolver.resolve(); - assertThat(resolved.get("A")).isEqualTo("/path/ var/"); + assertThat(resolved).containsEntry("A", "/path/ var/"); } @@ -138,7 +142,8 @@ class PropertyResolverTest { PropertyResolver resolver = new PropertyResolver(map, env); Properties resolved = resolver.resolve(); - assertThat(resolved.get("A")).isEqualTo(""); - assertThat(resolved.get("B")).isEqualTo(""); + assertThat(resolved) + .containsEntry("A", "") + .containsEntry("B", ""); } }