diff options
author | Claire Villard <claire.villard@sonarsource.com> | 2024-04-29 10:16:53 +0200 |
---|---|---|
committer | Claire Villard <60586848+claire-villard-sonarsource@users.noreply.github.com> | 2024-05-06 08:03:15 -0600 |
commit | ee9f00edc5e2958fce1c70d0b1cfd62267a3a204 (patch) | |
tree | 9c0e7cb9a2a2d847c893969b7352c7dbb517b62a /src/test/java/org | |
parent | 5750b8d7b2fef83e64164d0eccee8e83ad33afd0 (diff) | |
download | sonar-scanner-cli-ee9f00edc5e2958fce1c70d0b1cfd62267a3a204.tar.gz sonar-scanner-cli-ee9f00edc5e2958fce1c70d0b1cfd62267a3a204.zip |
Use Map assertions
Diffstat (limited to 'src/test/java/org')
-rw-r--r-- | src/test/java/org/sonarsource/scanner/cli/PropertyResolverTest.java | 37 |
1 files changed, 21 insertions, 16 deletions
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", ""); } } |