aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/test/ws/ListAction.java17
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/test/ws/TestsWsTest.java10
2 files changed, 19 insertions, 8 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/test/ws/ListAction.java b/server/sonar-server/src/main/java/org/sonar/server/test/ws/ListAction.java
index 0087e4c0f5b..886e04927f9 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/test/ws/ListAction.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/test/ws/ListAction.java
@@ -76,16 +76,17 @@ public class ListAction implements TestsWsAction {
public void define(WebService.NewController controller) {
WebService.NewAction action = controller
.createAction("list")
- .setDescription(
- "Get the list of tests.<br /> " +
- "Require Browse permission on file's project.<br /> " +
+ .setDescription(String.format(
+ "Get the list of tests either in a test file or that test a given line of source code.<br /> " +
+ "Require Browse permission on the file's project.<br /> " +
"One (and only one) of the following combination of parameters must be provided: " +
"<ul>" +
- "<li>" + TEST_FILE_ID + "</li>" +
- "<li>" + TEST_ID + "</li>" +
- "<li>" + SOURCE_FILE_ID + " and " + SOURCE_FILE_LINE_NUMBER + "</li>" +
- "<li>" + SOURCE_FILE_KEY + "and" + SOURCE_FILE_LINE_NUMBER + "</li>" +
- "</ul>")
+ "<li>%s - get a specific test</li>" +
+ "<li>%s - get the tests in a test file</li>" +
+ "<li>%s - get the tests in a test file</li>" +
+ "<li>%s and %6$s - get the tests that cover a specific line of code</li>" +
+ "<li>%s and %6$s - get the tests that cover a specific line of code</li>" +
+ "</ul>", TEST_ID, TEST_FILE_ID, TEST_FILE_KEY, SOURCE_FILE_ID, SOURCE_FILE_KEY, SOURCE_FILE_LINE_NUMBER))
.setSince("5.2")
.setResponseExample(Resources.getResource(getClass(), "tests-example-list.json"))
.setHandler(this)
diff --git a/server/sonar-server/src/test/java/org/sonar/server/test/ws/TestsWsTest.java b/server/sonar-server/src/test/java/org/sonar/server/test/ws/TestsWsTest.java
index f5fcb86ff13..2626c1204f5 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/test/ws/TestsWsTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/test/ws/TestsWsTest.java
@@ -63,6 +63,16 @@ public class TestsWsTest {
assertThat(action.handler()).isNotNull();
assertThat(action.responseExampleAsString()).isNotEmpty();
assertThat(action.params()).hasSize(8);
+ assertThat(action.description()).isEqualTo("Get the list of tests either in a test file or that test a given line of source code.<br /> " +
+ "Require Browse permission on the file's project.<br /> " +
+ "One (and only one) of the following combination of parameters must be provided: " +
+ "<ul>" +
+ "<li>testId - get a specific test</li>" +
+ "<li>testFileId - get the tests in a test file</li>" +
+ "<li>testFileKey - get the tests in a test file</li>" +
+ "<li>sourceFileId and sourceFileLineNumber - get the tests that cover a specific line of code</li>" +
+ "<li>sourceFileKey and sourceFileLineNumber - get the tests that cover a specific line of code</li>" +
+ "</ul>");
}
@Test