diff options
author | Julien HENRY <julien.henry@sonarsource.com> | 2024-09-27 16:27:04 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2024-09-27 20:02:48 +0000 |
commit | 93ca857eaa612624a932a87b50f610f7f7954138 (patch) | |
tree | 4c48699a1cbb45b0d9f0e93ef9efb0f5a471998b /sonar-scanner-engine/src/test/java/org/sonar/scanner | |
parent | 1fb4fa71017a200b11e5234db82885eb88b72499 (diff) | |
download | sonarqube-93ca857eaa612624a932a87b50f610f7f7954138.tar.gz sonarqube-93ca857eaa612624a932a87b50f610f7f7954138.zip |
SONAR-23013 Improve coverage
Diffstat (limited to 'sonar-scanner-engine/src/test/java/org/sonar/scanner')
-rw-r--r-- | sonar-scanner-engine/src/test/java/org/sonar/scanner/http/ScannerWsClientProviderTest.java | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/http/ScannerWsClientProviderTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/http/ScannerWsClientProviderTest.java index e605999ddd3..3aea5460db9 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/http/ScannerWsClientProviderTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/http/ScannerWsClientProviderTest.java @@ -30,6 +30,7 @@ import java.util.Collections; import java.util.HashMap; import java.util.Map; import java.util.Properties; +import nl.altindag.ssl.exception.GenericKeyStoreException; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Tag; @@ -319,6 +320,19 @@ class ScannerWsClientProviderTest { assertThat(r.content()).isEqualTo("Success"); } } + + @Test + void it_should_fail_if_invalid_truststore_password() { + scannerProps.put("sonar.host.url", sonarqubeMock.baseUrl()); + scannerProps.put("sonar.scanner.truststorePath", toPath(requireNonNull(ScannerWsClientProviderTest.class.getResource("/ssl/client-truststore.p12"))).toString()); + scannerProps.put("sonar.scanner.truststorePassword", "wrong_password"); + + var scannerPropsObj = new ScannerProperties(scannerProps); + var thrown = assertThrows(GenericKeyStoreException.class, + () -> underTest.provide(scannerPropsObj, env, GLOBAL_ANALYSIS_MODE, system2, ANALYSIS_WARNINGS, sonarUserHome)); + + assertThat(thrown).hasStackTraceContaining("Unable to read truststore"); + } } @Nested |