aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-scanner-engine/src/it/java
diff options
context:
space:
mode:
authorJavier García Orduña <javier.garcia@sonarsource.com>2024-12-05 09:44:46 +0100
committersonartech <sonartech@sonarsource.com>2024-12-05 20:03:16 +0000
commit864fba71bc231ef64babee0453a7306d1650210d (patch)
tree541e57d971a697b4b9c6cde44c8d1e7872026064 /sonar-scanner-engine/src/it/java
parentb80137d990395bf214dee4c0faf8d1603508ead6 (diff)
downloadsonarqube-864fba71bc231ef64babee0453a7306d1650210d.tar.gz
sonarqube-864fba71bc231ef64babee0453a7306d1650210d.zip
SONAR-22305 Ignore scanner properties with null values
Diffstat (limited to 'sonar-scanner-engine/src/it/java')
-rw-r--r--sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/bootstrap/BootstrapMediumIT.java32
1 files changed, 28 insertions, 4 deletions
diff --git a/sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/bootstrap/BootstrapMediumIT.java b/sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/bootstrap/BootstrapMediumIT.java
index ac110567e85..4af42659e6e 100644
--- a/sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/bootstrap/BootstrapMediumIT.java
+++ b/sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/bootstrap/BootstrapMediumIT.java
@@ -126,15 +126,31 @@ class BootstrapMediumIT {
ScannerMain.run(new ByteArrayInputStream("""
{"scannerProperties": [{"value": "aValueWithoutKey"}]}""".getBytes()));
- assertThat(logTester.logs(Level.WARN)).contains("Ignoring property with null key: 'aValueWithoutKey'");
+ assertThat(logTester.logs(Level.WARN)).contains("Ignoring property with null key. Value='aValueWithoutKey'");
+ }
+
+ @Test
+ void should_warn_if_null_property_value() {
+ ScannerMain.run(new ByteArrayInputStream("""
+ {"scannerProperties": [{"key": "aKey", "value": null}]}""".getBytes()));
+
+ assertThat(logTester.logs(Level.WARN)).contains("Ignoring property with null value. Key='aKey'");
+ }
+
+ @Test
+ void should_warn_if_not_provided_property_value() {
+ ScannerMain.run(new ByteArrayInputStream("""
+ {"scannerProperties": [{"key": "aKey"}]}""".getBytes()));
+
+ assertThat(logTester.logs(Level.WARN)).contains("Ignoring property with null value. Key='aKey'");
}
@Test
void should_warn_if_duplicate_property_keys() {
ScannerMain.run(new ByteArrayInputStream("""
- {"scannerProperties": [{"key": "aKey"}, {"key": "aKey"}]}""".getBytes()));
+ {"scannerProperties": [{"key": "aKey", "value": "aValue"}, {"key": "aKey", "value": "aValue"}]}""".getBytes()));
- assertThat(logTester.logs(Level.WARN)).contains("Duplicated properties with key: 'aKey'");
+ assertThat(logTester.logs(Level.WARN)).contains("Duplicated properties. Key='aKey'");
}
@Test
@@ -142,7 +158,15 @@ class BootstrapMediumIT {
ScannerMain.run(new ByteArrayInputStream("""
{"scannerProperties": [{"key": "aKey", "value": "aValue"},]}""".getBytes()));
- assertThat(logTester.logs(Level.WARN)).contains("Ignoring null property");
+ assertThat(logTester.logs(Level.WARN)).contains("Ignoring null or empty property");
+ }
+
+ @Test
+ void should_warn_if_empty_property() {
+ ScannerMain.run(new ByteArrayInputStream("""
+ {"scannerProperties": [{}]}""".getBytes()));
+
+ assertThat(logTester.logs(Level.WARN)).contains("Ignoring null or empty property");
}
/**