From 525f9956185f7512c73cc5854fa074f38f6d68d1 Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Sat, 4 Mar 2017 15:28:58 +0100 Subject: [PATCH] Support RELEASE versions in IssueJsonReportTest --- .../test/java/it/analysis/IssueJsonReportTest.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/it/it-tests/src/test/java/it/analysis/IssueJsonReportTest.java b/it/it-tests/src/test/java/it/analysis/IssueJsonReportTest.java index b0f5afbe49e..d5ac274bcc8 100644 --- a/it/it-tests/src/test/java/it/analysis/IssueJsonReportTest.java +++ b/it/it-tests/src/test/java/it/analysis/IssueJsonReportTest.java @@ -42,9 +42,12 @@ import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; import org.skyscreamer.jsonassert.JSONAssert; +import org.sonarqube.ws.client.GetRequest; +import org.sonarqube.ws.client.WsResponse; import util.ItUtils; import static org.assertj.core.api.Assertions.assertThat; +import static util.ItUtils.newWsClient; public class IssueJsonReportTest { @@ -276,9 +279,13 @@ public class IssueJsonReportTest { JSONAssert.assertEquals(expectedJson, json, false); } - private String expected(String path) throws IOException, FileNotFoundException { - return sanitize(IOUtils.toString(getResourceInputStream(path))) - .replaceAll(Pattern.quote(SONAR_VERSION_PLACEHOLDER), orchestrator.getServer().version().toString()); + private String expected(String path) throws IOException { + try (WsResponse response = newWsClient(orchestrator).wsConnector().call(new GetRequest("api/server/version"))) { + String version = response.content(); + + return sanitize(IOUtils.toString(getResourceInputStream(path))) + .replaceAll(Pattern.quote(SONAR_VERSION_PLACEHOLDER), version); + } } @Test -- 2.39.5