aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/java/org/sonarsource/scanner/cli/PropertyResolverTest.java
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2024-05-03 11:40:31 +0200
committerJulien HENRY <julien.henry@sonarsource.com>2024-05-03 14:48:44 +0200
commit43be745547fcc827761a172136c3f3e9834f5544 (patch)
treeac0055706ac3a5a0df5af5512abdd1a6694157f7 /src/test/java/org/sonarsource/scanner/cli/PropertyResolverTest.java
parente7fc5ea5667ce260ad48d5603c262614bbed8222 (diff)
downloadsonar-scanner-cli-43be745547fcc827761a172136c3f3e9834f5544.tar.gz
sonar-scanner-cli-43be745547fcc827761a172136c3f3e9834f5544.zip
Update tests to JUnit 5
Diffstat (limited to 'src/test/java/org/sonarsource/scanner/cli/PropertyResolverTest.java')
-rw-r--r--src/test/java/org/sonarsource/scanner/cli/PropertyResolverTest.java28
1 files changed, 12 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 0ff6102..874e476 100644
--- a/src/test/java/org/sonarsource/scanner/cli/PropertyResolverTest.java
+++ b/src/test/java/org/sonarsource/scanner/cli/PropertyResolverTest.java
@@ -22,18 +22,15 @@ package org.sonarsource.scanner.cli;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
+import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
-public class PropertyResolverTest {
- @Rule
- public ExpectedException exception = ExpectedException.none();
+class PropertyResolverTest {
@Test
- public void resolve_properties() {
+ void resolve_properties() {
Properties map = new Properties();
Map<String, String> env = new HashMap<>();
@@ -58,7 +55,7 @@ public class PropertyResolverTest {
}
@Test
- public void use_env() {
+ void use_env() {
Properties map = new Properties();
Map<String, String> env = new HashMap<>();
@@ -76,7 +73,7 @@ public class PropertyResolverTest {
}
@Test
- public void resolve_recursively() {
+ void resolve_recursively() {
Properties map = new Properties();
Map<String, String> env = new HashMap<>();
map.put("A", "value a");
@@ -91,7 +88,7 @@ public class PropertyResolverTest {
}
@Test
- public void dont_resolve_nested() {
+ void dont_resolve_nested() {
Properties map = new Properties();
Map<String, String> env = new HashMap<>();
map.put("A", "value a");
@@ -106,7 +103,7 @@ public class PropertyResolverTest {
}
@Test
- public void missing_var() {
+ void missing_var() {
Map<String, String> env = new HashMap<>();
Properties map = new Properties();
map.put("A", "/path/${missing} var/");
@@ -118,7 +115,7 @@ public class PropertyResolverTest {
}
@Test
- public void fail_loop_properties_resolution() {
+ void fail_loop_properties_resolution() {
Properties map = new Properties();
Map<String, String> env = new HashMap<>();
@@ -126,14 +123,13 @@ public class PropertyResolverTest {
map.put("A", "${B}");
map.put("B", "${A}");
- exception.expect(IllegalArgumentException.class);
- exception.expectMessage("variable: B");
PropertyResolver resolver = new PropertyResolver(map, env);
- resolver.resolve();
+
+ assertThatThrownBy(resolver::resolve).isInstanceOf(IllegalArgumentException.class).hasMessageContaining("variable: B");
}
@Test
- public void preserve_empty() {
+ void preserve_empty() {
Properties map = new Properties();
Map<String, String> env = new HashMap<>();