From 006ead5557ffd0345eec67134777eee76b0063ec Mon Sep 17 00:00:00 2001 From: Daniel Schwarz Date: Thu, 28 Sep 2017 15:37:42 +0200 Subject: [PATCH] SONAR-9127 add unit test of the definition of api/qualitygates/get_by_project --- .../qualitygate/ws/GetByProjectActionTest.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/server/sonar-server/src/test/java/org/sonar/server/qualitygate/ws/GetByProjectActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/qualitygate/ws/GetByProjectActionTest.java index 6a26415520f..4945ff91435 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/qualitygate/ws/GetByProjectActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/qualitygate/ws/GetByProjectActionTest.java @@ -23,6 +23,7 @@ import javax.annotation.Nullable; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; +import org.sonar.api.server.ws.WebService; import org.sonar.api.utils.System2; import org.sonar.api.web.UserRole; import org.sonar.db.DbClient; @@ -65,6 +66,21 @@ public class GetByProjectActionTest { private WsActionTester ws = new WsActionTester( new GetByProjectAction(userSession, dbClient, TestComponentFinder.from(db), new QualityGateFinder(dbClient))); + @Test + public void definition() { + WebService.Action def = ws.getDef(); + assertThat(def.description()).isNotEmpty(); + assertThat(def.isInternal()).isTrue(); + assertThat(def.since()).isEqualTo("6.1"); + assertThat(def.changelog()).isEmpty(); + assertThat(def.params()).extracting(WebService.Param::key).containsExactlyInAnyOrder("projectId", "projectKey"); + + WebService.Param projectKey = def.param("projectKey"); + assertThat(projectKey.description()).isNotEmpty(); + assertThat(projectKey.isRequired()).isFalse(); + assertThat(projectKey.exampleValue()).isNotEmpty(); + } + @Test public void json_example() { OrganizationDto organizationDto = db.organizations().insert(); -- 2.39.5