You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@juneau.apache.org by ja...@apache.org on 2020/01/20 21:49:44 UTC
[juneau-petstore] 35/48: mock rest
This is an automated email from the ASF dual-hosted git repository.
jamesbognar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/juneau-petstore.git
commit b1cee1440bbc0968f027dd8a657aff6b2cceb5ed
Author: rasa <fi...@gmail.com>
AuthorDate: Sat Dec 14 08:36:51 2019 +0200
mock rest
---
.../main/java/org/apache/juneau/petstore/MockTest.java | 17 +++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)
diff --git a/juneau-petstore-server/src/main/java/org/apache/juneau/petstore/MockTest.java b/juneau-petstore-server/src/main/java/org/apache/juneau/petstore/MockTest.java
index d8376e5..f28fdb6 100644
--- a/juneau-petstore-server/src/main/java/org/apache/juneau/petstore/MockTest.java
+++ b/juneau-petstore-server/src/main/java/org/apache/juneau/petstore/MockTest.java
@@ -90,8 +90,8 @@ public class MockTest {
.assertBody(pet.toString());
}
- // Posting pet (doesn`t work)
-/*
+ // Posting pet
+
@Rest(serializers = JsonSerializer.class, parsers = JsonParser.class)
public static class PostPetMockRest {
@@ -100,7 +100,7 @@ public class MockTest {
public Ok echo(@Body CreatePet pet) throws IdConflict, NotAcceptable, UnsupportedMediaType {
return OK;
}
-
+ }
@Test
public void testPostPet() throws Exception {
CreatePet pet = new CreatePet("Sunshine", 100, Species.BIRD, null);
@@ -113,7 +113,7 @@ public class MockTest {
.assertBody(pet.toString());
}
- */
+
// Delete pet by Id
@@ -260,8 +260,7 @@ public class MockTest {
)
public Ok getOrder(@Body long orderId) throws InvalidId, IdNotFound, NotAcceptable {
- if (orderId < 1 || orderId > 1000)
- throw new InvalidId();
+
return OK;
}
@@ -314,9 +313,7 @@ public class MockTest {
)
public Ok deleteOrder(@Body long orderId) throws InvalidId, IdNotFound, NotAcceptable {
- if (orderId < 0)
- throw new InvalidId();
-
+
return OK;
}
@@ -396,7 +393,7 @@ public class MockTest {
@RestMethod(name = POST, path = "/user", summary = "Create user"
)
- public Ok createUser(User user) throws InvalidUsername, IdConflict, NotAcceptable, UnsupportedMediaType {
+ public Ok createUser(@Body User user) throws InvalidUsername, IdConflict, NotAcceptable, UnsupportedMediaType {
return OK;
}