From 0557d87fda76b8f1396913d2ba9065e0238c35d0 Mon Sep 17 00:00:00 2001 From: Nicolas QUINQUENEL Date: Thu, 28 Nov 2024 12:20:13 +0100 Subject: [PATCH] SLI-1680 Update documentation links to match the rebranding --- .../documentation/SonarLintDocumentation.kt | 2 +- .../SonarLintDocumentationTests.kt | 51 +++++++++++++++++++ 2 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 src/test/java/org/sonarlint/intellij/documentation/SonarLintDocumentationTests.kt diff --git a/src/main/java/org/sonarlint/intellij/documentation/SonarLintDocumentation.kt b/src/main/java/org/sonarlint/intellij/documentation/SonarLintDocumentation.kt index fabc301bf..1558e666a 100644 --- a/src/main/java/org/sonarlint/intellij/documentation/SonarLintDocumentation.kt +++ b/src/main/java/org/sonarlint/intellij/documentation/SonarLintDocumentation.kt @@ -22,7 +22,7 @@ package org.sonarlint.intellij.documentation object SonarLintDocumentation { object Intellij { - const val BASE_DOCS_URL = "https://docs.sonarsource.com/sonarlint/intellij" + const val BASE_DOCS_URL = "https://docs.sonarsource.com/sonarqube-for-ide/intellij" const val CONNECTED_MODE_LINK = "$BASE_DOCS_URL/team-features/connected-mode" const val CONNECTED_MODE_SETUP_LINK = "$BASE_DOCS_URL/team-features/connected-mode-setup" const val SECURITY_HOTSPOTS_LINK = "$BASE_DOCS_URL/using-sonarlint/security-hotspots" diff --git a/src/test/java/org/sonarlint/intellij/documentation/SonarLintDocumentationTests.kt b/src/test/java/org/sonarlint/intellij/documentation/SonarLintDocumentationTests.kt new file mode 100644 index 000000000..2738557ea --- /dev/null +++ b/src/test/java/org/sonarlint/intellij/documentation/SonarLintDocumentationTests.kt @@ -0,0 +1,51 @@ +package org.sonarlint.intellij.documentation + +import java.net.HttpURLConnection +import java.net.URL +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Disabled +import org.junit.jupiter.api.TestInstance +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.MethodSource + +@TestInstance(TestInstance.Lifecycle.PER_CLASS) +@Disabled("Only for manual testing - this test should not impact realisability") +class SonarLintDocumentationTests { + + @ParameterizedTest + @MethodSource("pagesProvider") + fun should_verify_page_is_not_404(pageUrl: String) { + val url = URL(pageUrl) + + val connection = url.openConnection() as HttpURLConnection + + val responseCode = connection.responseCode + assertThat(responseCode).isNotEqualTo(404) + } + + private fun pagesProvider() = listOf( + SonarLintDocumentation.Intellij.BASE_DOCS_URL, + SonarLintDocumentation.Intellij.CONNECTED_MODE_LINK, + SonarLintDocumentation.Intellij.CONNECTED_MODE_SETUP_LINK, + SonarLintDocumentation.Intellij.SECURITY_HOTSPOTS_LINK, + SonarLintDocumentation.Intellij.TAINT_VULNERABILITIES_LINK, + SonarLintDocumentation.Intellij.CLEAN_CODE_LINK, + SonarLintDocumentation.Intellij.SUPPORT_POLICY_LINK, + SonarLintDocumentation.Intellij.FOCUS_ON_NEW_CODE_LINK, + SonarLintDocumentation.Intellij.CONNECTED_MODE_BENEFITS_LINK, + SonarLintDocumentation.Intellij.SHARING_CONNECTED_MODE_CONFIGURATION_LINK, + SonarLintDocumentation.Intellij.TROUBLESHOOTING_CONNECTED_MODE_SETUP_LINK, + SonarLintDocumentation.Intellij.RULE_SECTION_LINK, + SonarLintDocumentation.Intellij.FILE_EXCLUSION_LINK, + + SonarLintDocumentation.SonarQube.SMART_NOTIFICATIONS, + + SonarLintDocumentation.SonarCloud.SMART_NOTIFICATIONS, + + SonarLintDocumentation.Marketing.COMPARE_SERVER_PRODUCTS_LINK, + SonarLintDocumentation.Marketing.SONARQUBE_EDITIONS_DOWNLOADS_LINK, + SonarLintDocumentation.Marketing.SONARCLOUD_PRODUCT_LINK, + SonarLintDocumentation.Marketing.SONARCLOUD_PRODUCT_SIGNUP_LINK, + ) + +}