aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-ws-client/src/test/java/org
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@gmail.com>2013-06-05 10:37:39 +0200
committerJulien Lancelot <julien.lancelot@gmail.com>2013-06-05 10:37:39 +0200
commitc57dc71e4d5106a94cb9fba6b55dcaa665a63547 (patch)
tree0ac7b3e945a2b3dd5a0563b4588b1b98fc1d50ea /sonar-ws-client/src/test/java/org
parent9337b5d4cf54a6e3601a63022d26f8e27c7110a5 (diff)
downloadsonarqube-c57dc71e4d5106a94cb9fba6b55dcaa665a63547.tar.gz
sonarqube-c57dc71e4d5106a94cb9fba6b55dcaa665a63547.zip
SONAR-3755 Set deadLine as Date instead of String in action plan Client
Diffstat (limited to 'sonar-ws-client/src/test/java/org')
-rw-r--r--sonar-ws-client/src/test/java/org/sonar/wsclient/issue/DefaultActionPlanClientTest.java24
1 files changed, 19 insertions, 5 deletions
diff --git a/sonar-ws-client/src/test/java/org/sonar/wsclient/issue/DefaultActionPlanClientTest.java b/sonar-ws-client/src/test/java/org/sonar/wsclient/issue/DefaultActionPlanClientTest.java
index d6597c2e918..4498541a1db 100644
--- a/sonar-ws-client/src/test/java/org/sonar/wsclient/issue/DefaultActionPlanClientTest.java
+++ b/sonar-ws-client/src/test/java/org/sonar/wsclient/issue/DefaultActionPlanClientTest.java
@@ -25,6 +25,9 @@ import org.junit.Test;
import org.sonar.wsclient.MockHttpServerInterceptor;
import org.sonar.wsclient.internal.HttpRequestFactory;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
import java.util.List;
import static org.fest.assertions.Assertions.assertThat;
@@ -68,14 +71,15 @@ public class DefaultActionPlanClientTest {
}
@Test
- public void should_create_action_plan() {
+ public void should_create_action_plan() throws Exception {
HttpRequestFactory requestFactory = new HttpRequestFactory(httpServer.url());
httpServer.doReturnBody("{\"actionPlan\": {\"key\": \"382f6f2e-ad9d-424a-b973-9b065e04348a\"}}");
ActionPlanClient client = new DefaultActionPlanClient(requestFactory);
- ActionPlan result = client.create(NewActionPlan.create().name("Short term").project("org.sonar.Sample").description("Short term issues").deadLine("01/01/2014"));
+ ActionPlan result = client.create(
+ NewActionPlan.create().name("Short term").project("org.sonar.Sample").description("Short term issues").deadLine(stringToDate("2014-01-01")));
- assertThat(httpServer.requestedPath()).isEqualTo("/api/action_plans/create?project=org.sonar.Sample&description=Short%20term%20issues&name=Short%20term&deadLine=01/01/2014");
+ assertThat(httpServer.requestedPath()).isEqualTo("/api/action_plans/create?project=org.sonar.Sample&description=Short%20term%20issues&name=Short%20term&deadLine=2014-01-01");
assertThat(result).isNotNull();
}
@@ -85,9 +89,10 @@ public class DefaultActionPlanClientTest {
httpServer.doReturnBody("{\"actionPlan\": {\"key\": \"382f6f2e-ad9d-424a-b973-9b065e04348a\"}}");
ActionPlanClient client = new DefaultActionPlanClient(requestFactory);
- ActionPlan result = client.update(UpdateActionPlan.create().key("382f6f2e-ad9d-424a-b973-9b065e04348a").name("Short term").description("Short term issues").deadLine("01/01/2014"));
+ ActionPlan result = client.update(
+ UpdateActionPlan.create().key("382f6f2e-ad9d-424a-b973-9b065e04348a").name("Short term").description("Short term issues").deadLine(stringToDate("2014-01-01")));
- assertThat(httpServer.requestedPath()).isEqualTo("/api/action_plans/update?description=Short%20term%20issues&name=Short%20term&deadLine=01/01/2014&key=382f6f2e-ad9d-424a-b973-9b065e04348a");
+ assertThat(httpServer.requestedPath()).isEqualTo("/api/action_plans/update?description=Short%20term%20issues&name=Short%20term&deadLine=2014-01-01&key=382f6f2e-ad9d-424a-b973-9b065e04348a");
assertThat(result).isNotNull();
}
@@ -139,4 +144,13 @@ public class DefaultActionPlanClientTest {
assertThat(result).isNotNull();
}
+ private static Date stringToDate(String sDate) {
+ try {
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-dd-MM");
+ return sdf.parse(sDate);
+ } catch (ParseException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
}