This is an automated email from the ASF dual-hosted git repository.

liubao pushed a commit to branch master
in repository 
https://gitbox.apache.org/repos/asf/incubator-servicecomb-java-chassis.git

commit 964a4117a2075fe452b5c25510bd4738d7e25335
Author: acsukesh <[email protected]>
AuthorDate: Wed Jul 4 18:31:32 2018 +0530

    [SCB-713] Required client test code added
---
 .../demo/springmvc/client/SpringmvcClient.java     | 37 +++++++++++++++++++++-
 1 file changed, 36 insertions(+), 1 deletion(-)

diff --git 
a/demo/demo-springmvc/springmvc-client/src/main/java/org/apache/servicecomb/demo/springmvc/client/SpringmvcClient.java
 
b/demo/demo-springmvc/springmvc-client/src/main/java/org/apache/servicecomb/demo/springmvc/client/SpringmvcClient.java
index c683862..cc93248 100644
--- 
a/demo/demo-springmvc/springmvc-client/src/main/java/org/apache/servicecomb/demo/springmvc/client/SpringmvcClient.java
+++ 
b/demo/demo-springmvc/springmvc-client/src/main/java/org/apache/servicecomb/demo/springmvc/client/SpringmvcClient.java
@@ -89,7 +89,7 @@ public class SpringmvcClient {
       testController(templateUrlWithServiceName, microserviceName);
 
       testController();
-
+      testRequiredBody(templateUrlWithServiceName, microserviceName);
       testSpringMvcDefaultValues(templateUrlWithServiceName, microserviceName);
     }
     HttpHeaders headers = new HttpHeaders();
@@ -225,6 +225,41 @@ public class SpringmvcClient {
         "newer");
   }
 
+  private static void testRequiredBody(RestTemplate template, String 
microserviceName) {
+    String prefix = "cse://" + microserviceName;
+    Person user = new Person();
+
+    TestMgr.check("No user data found",
+        template.postForObject(prefix + 
"/annotations/saysomething?prefix={prefix}",
+            user,
+            String.class,
+            "ha"));
+
+    user.setName("world");
+    TestMgr.check("ha world",
+        template.postForObject(prefix + 
"/annotations/saysomething?prefix={prefix}",
+            user,
+            String.class,
+            "ha"));
+
+    TestMgr.check("No user data found",
+        template.postForObject(prefix + 
"/annotations/saysomething?prefix={prefix}",
+            null,
+            String.class,
+            "ha"));
+
+    TestMgr.check("No user name found",
+        template.postForObject(prefix + "/annotations/say",
+            "",
+            String.class,
+            "ha"));
+    TestMgr.check("test",
+        template.postForObject(prefix + "/annotations/say",
+            "test",
+            String.class,
+            "ha"));
+  }
+
   private static void testSpringMvcDefaultValues(RestTemplate template, String 
microserviceName) {
     String cseUrlPrefix = "cse://" + microserviceName + 
"/SpringMvcDefaultValues/";
     //default values

Reply via email to