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.git
The following commit(s) were added to refs/heads/master by this push:
new 6da6432 org.apache.juneau.http.response tests.
6da6432 is described below
commit 6da643225bd4af7c1cec9372bf43a1bafd2b2dd3
Author: JamesBognar <[email protected]>
AuthorDate: Sun Jul 19 16:35:07 2020 -0400
org.apache.juneau.http.response tests.
---
.../juneau/http/remote/RrpcInterfaceMeta.java | 3 +-
.../org/apache/juneau/http/response/SeeOther.java | 23 -
.../apache/juneau/http/response/Accepted_Test.java | 48 ++
.../juneau/http/response/AlreadyReported_Test.java | 48 ++
.../apache/juneau/http/response/Continue_Test.java | 48 ++
.../apache/juneau/http/response/Created_Test.java | 48 ++
.../juneau/http/response/EarlyHints_Test.java | 48 ++
.../apache/juneau/http/response/Found_Test.java | 56 ++
.../apache/juneau/http/response/IMUsed_Test.java | 48 ++
.../http/response/MovedPermanently_Test.java | 56 ++
.../juneau/http/response/MultiStatus_Test.java | 48 ++
.../juneau/http/response/MultipleChoices_Test.java | 48 ++
.../juneau/http/response/NoContent_Test.java | 46 ++
.../response/NonAuthoritativeInformation_Test.java | 48 ++
.../juneau/http/response/NotModified_Test.java | 46 ++
.../org/apache/juneau/http/response/Ok_Test.java | 48 ++
.../juneau/http/response/PartialContent_Test.java | 48 ++
.../http/response/PermanentRedirect_Test.java | 56 ++
.../juneau/http/response/Processing_Test.java | 48 ++
.../juneau/http/response/ResetContent_Test.java | 46 ++
.../apache/juneau/http/response/SeeOther_Test.java | 56 ++
.../http/response/SwitchingProtocols_Test.java | 48 ++
.../http/response/TemporaryRedirect_Test.java | 56 ++
.../apache/juneau/http/response/UseProxy_Test.java | 48 ++
.../org/apache/juneau/rest/BasicResponsesTest.java | 175 +++++++
.../apache/juneau/rest/responses/BasicTest.java | 578 ---------------------
26 files changed, 1266 insertions(+), 603 deletions(-)
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/remote/RrpcInterfaceMeta.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/remote/RrpcInterfaceMeta.java
index de5fa05..6bfdcc6 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/remote/RrpcInterfaceMeta.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/remote/RrpcInterfaceMeta.java
@@ -63,8 +63,7 @@ public class RrpcInterfaceMeta {
AMap<Method,RrpcInterfaceMethodMeta> methods = AMap.of();
for (MethodInfo m : ci.getPublicMethods())
- if (m.isPublic())
- methods.put(m.inner(), new
RrpcInterfaceMethodMeta(uri, m.inner()));
+ methods.put(m.inner(), new RrpcInterfaceMethodMeta(uri,
m.inner()));
AMap<String,RrpcInterfaceMethodMeta> methodsByPath = AMap.of();
for (RrpcInterfaceMethodMeta rmm : methods.values())
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/SeeOther.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/SeeOther.java
index 8952532..252aea4 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/SeeOther.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/response/SeeOther.java
@@ -13,10 +13,8 @@
package org.apache.juneau.http.response;
import static org.apache.juneau.http.response.SeeOther.*;
-import static org.apache.juneau.internal.StringUtils.*;
import java.net.*;
-import java.text.*;
import org.apache.juneau.annotation.BeanIgnore;
import org.apache.juneau.http.annotation.*;
@@ -76,17 +74,6 @@ public class SeeOther extends HttpResponse {
/**
* Constructor.
*
- * @param message Message to send as the response.
- * @param uri URI containing {@link MessageFormat}-style arguments.
- * @param uriArgs {@link MessageFormat}-style arguments.
- */
- public SeeOther(String message, String uri, Object uriArgs) {
- this(message, toURI(format(uri.toString(), uriArgs)));
- }
-
- /**
- * Constructor.
- *
* @param location <c>Location</c> header value.
*/
public SeeOther(URI location) {
@@ -94,16 +81,6 @@ public class SeeOther extends HttpResponse {
}
/**
- * Constructor.
- *
- * @param uri URI containing {@link MessageFormat}-style arguments.
- * @param uriArgs {@link MessageFormat}-style arguments.
- */
- public SeeOther(String uri, Object uriArgs) {
- this(toURI(format(uri.toString(), uriArgs)));
- }
-
- /**
* @return <c>Location</c> header value.
*/
@ResponseHeader(name="Location", description="Other location.")
diff --git
a/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/response/Accepted_Test.java
b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/response/Accepted_Test.java
new file mode 100644
index 0000000..2ae2583
--- /dev/null
+++
b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/response/Accepted_Test.java
@@ -0,0 +1,48 @@
+//
***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file *
+// * distributed with this work for additional information regarding copyright
ownership. The ASF licenses this file *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance *
+// * with the License. You may obtain a copy of the License at
*
+// *
*
+// * http://www.apache.org/licenses/LICENSE-2.0
*
+// *
*
+// * Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied. See the License for the *
+// * specific language governing permissions and limitations under the
License. *
+//
***************************************************************************************************************************
+package org.apache.juneau.http.response;
+
+import static org.junit.runners.MethodSorters.*;
+
+import org.apache.juneau.rest.annotation.*;
+import org.apache.juneau.rest.mock2.*;
+import org.junit.*;
+
+@FixMethodOrder(NAME_ASCENDING)
+public class Accepted_Test {
+
+ @Rest
+ public static class A {
+ @RestMethod public Accepted getA1() { return new Accepted(); }
+ @RestMethod public Accepted getA2() { return new
Accepted("foo"); }
+ @RestMethod public Accepted getA3() { return new
Accepted().header("Foo","bar"); }
+ }
+
+ @Test
+ public void a01_basic() throws Exception {
+ MockRestClient client =
MockRestClient.createLax(A.class).build();
+
+ client.get("/a1")
+ .run()
+ .assertCode().is(202)
+ .assertBody().is("Accepted");
+ client.get("/a2")
+ .run()
+ .assertCode().is(202)
+ .assertBody().is("foo");
+ client.get("/a3")
+ .run()
+ .assertCode().is(202)
+ .assertStringHeader("Foo").is("bar");
+ }
+}
diff --git
a/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/response/AlreadyReported_Test.java
b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/response/AlreadyReported_Test.java
new file mode 100644
index 0000000..5f0abf5
--- /dev/null
+++
b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/response/AlreadyReported_Test.java
@@ -0,0 +1,48 @@
+//
***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file *
+// * distributed with this work for additional information regarding copyright
ownership. The ASF licenses this file *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance *
+// * with the License. You may obtain a copy of the License at
*
+// *
*
+// * http://www.apache.org/licenses/LICENSE-2.0
*
+// *
*
+// * Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied. See the License for the *
+// * specific language governing permissions and limitations under the
License. *
+//
***************************************************************************************************************************
+package org.apache.juneau.http.response;
+
+import static org.junit.runners.MethodSorters.*;
+
+import org.apache.juneau.rest.annotation.*;
+import org.apache.juneau.rest.mock2.*;
+import org.junit.*;
+
+@FixMethodOrder(NAME_ASCENDING)
+public class AlreadyReported_Test {
+
+ @Rest
+ public static class A {
+ @RestMethod public AlreadyReported getA1() { return new
AlreadyReported(); }
+ @RestMethod public AlreadyReported getA2() { return new
AlreadyReported("foo"); }
+ @RestMethod public AlreadyReported getA3() { return new
AlreadyReported().header("Foo","bar"); }
+ }
+
+ @Test
+ public void a01_basic() throws Exception {
+ MockRestClient client =
MockRestClient.createLax(A.class).build();
+
+ client.get("/a1")
+ .run()
+ .assertCode().is(208)
+ .assertBody().is("Already Reported");
+ client.get("/a2")
+ .run()
+ .assertCode().is(208)
+ .assertBody().is("foo");
+ client.get("/a3")
+ .run()
+ .assertCode().is(208)
+ .assertStringHeader("Foo").is("bar");
+ }
+}
diff --git
a/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/response/Continue_Test.java
b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/response/Continue_Test.java
new file mode 100644
index 0000000..3f535b1
--- /dev/null
+++
b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/response/Continue_Test.java
@@ -0,0 +1,48 @@
+//
***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file *
+// * distributed with this work for additional information regarding copyright
ownership. The ASF licenses this file *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance *
+// * with the License. You may obtain a copy of the License at
*
+// *
*
+// * http://www.apache.org/licenses/LICENSE-2.0
*
+// *
*
+// * Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied. See the License for the *
+// * specific language governing permissions and limitations under the
License. *
+//
***************************************************************************************************************************
+package org.apache.juneau.http.response;
+
+import static org.junit.runners.MethodSorters.*;
+
+import org.apache.juneau.rest.annotation.*;
+import org.apache.juneau.rest.mock2.*;
+import org.junit.*;
+
+@FixMethodOrder(NAME_ASCENDING)
+public class Continue_Test {
+
+ @Rest
+ public static class A {
+ @RestMethod public Continue getA1() { return new Continue(); }
+ @RestMethod public Continue getA2() { return new
Continue("foo"); }
+ @RestMethod public Continue getA3() { return new
Continue().header("Foo","bar"); }
+ }
+
+ @Test
+ public void a01_basic() throws Exception {
+ MockRestClient client =
MockRestClient.createLax(A.class).build();
+
+ client.get("/a1")
+ .run()
+ .assertCode().is(1100)
+ .assertBody().is("Continue");
+ client.get("/a2")
+ .run()
+ .assertCode().is(1100)
+ .assertBody().is("foo");
+ client.get("/a3")
+ .run()
+ .assertCode().is(1100)
+ .assertStringHeader("Foo").is("bar");
+ }
+}
diff --git
a/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/response/Created_Test.java
b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/response/Created_Test.java
new file mode 100644
index 0000000..7236ee2
--- /dev/null
+++
b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/response/Created_Test.java
@@ -0,0 +1,48 @@
+//
***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file *
+// * distributed with this work for additional information regarding copyright
ownership. The ASF licenses this file *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance *
+// * with the License. You may obtain a copy of the License at
*
+// *
*
+// * http://www.apache.org/licenses/LICENSE-2.0
*
+// *
*
+// * Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied. See the License for the *
+// * specific language governing permissions and limitations under the
License. *
+//
***************************************************************************************************************************
+package org.apache.juneau.http.response;
+
+import static org.junit.runners.MethodSorters.*;
+
+import org.apache.juneau.rest.annotation.*;
+import org.apache.juneau.rest.mock2.*;
+import org.junit.*;
+
+@FixMethodOrder(NAME_ASCENDING)
+public class Created_Test {
+
+ @Rest
+ public static class A {
+ @RestMethod public Created getA1() { return new Created(); }
+ @RestMethod public Created getA2() { return new Created("foo");
}
+ @RestMethod public Created getA3() { return new
Created().header("Foo","bar"); }
+ }
+
+ @Test
+ public void a01_basic() throws Exception {
+ MockRestClient client =
MockRestClient.createLax(A.class).build();
+
+ client.get("/a1")
+ .run()
+ .assertCode().is(201)
+ .assertBody().is("Created");
+ client.get("/a2")
+ .run()
+ .assertCode().is(201)
+ .assertBody().is("foo");
+ client.get("/a3")
+ .run()
+ .assertCode().is(201)
+ .assertStringHeader("Foo").is("bar");
+ }
+}
diff --git
a/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/response/EarlyHints_Test.java
b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/response/EarlyHints_Test.java
new file mode 100644
index 0000000..a8b2db3
--- /dev/null
+++
b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/response/EarlyHints_Test.java
@@ -0,0 +1,48 @@
+//
***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file *
+// * distributed with this work for additional information regarding copyright
ownership. The ASF licenses this file *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance *
+// * with the License. You may obtain a copy of the License at
*
+// *
*
+// * http://www.apache.org/licenses/LICENSE-2.0
*
+// *
*
+// * Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied. See the License for the *
+// * specific language governing permissions and limitations under the
License. *
+//
***************************************************************************************************************************
+package org.apache.juneau.http.response;
+
+import static org.junit.runners.MethodSorters.*;
+
+import org.apache.juneau.rest.annotation.*;
+import org.apache.juneau.rest.mock2.*;
+import org.junit.*;
+
+@FixMethodOrder(NAME_ASCENDING)
+public class EarlyHints_Test {
+
+ @Rest
+ public static class A {
+ @RestMethod public EarlyHints getA1() { return new
EarlyHints(); }
+ @RestMethod public EarlyHints getA2() { return new
EarlyHints("foo"); }
+ @RestMethod public EarlyHints getA3() { return new
EarlyHints().header("Foo","bar"); }
+ }
+
+ @Test
+ public void a01_basic() throws Exception {
+ MockRestClient client =
MockRestClient.createLax(A.class).build();
+
+ client.get("/a1")
+ .run()
+ .assertCode().is(1103)
+ .assertBody().is("Early Hints");
+ client.get("/a2")
+ .run()
+ .assertCode().is(1103)
+ .assertBody().is("foo");
+ client.get("/a3")
+ .run()
+ .assertCode().is(1103)
+ .assertStringHeader("Foo").is("bar");
+ }
+}
diff --git
a/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/response/Found_Test.java
b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/response/Found_Test.java
new file mode 100644
index 0000000..ae61fdd
--- /dev/null
+++
b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/response/Found_Test.java
@@ -0,0 +1,56 @@
+//
***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file *
+// * distributed with this work for additional information regarding copyright
ownership. The ASF licenses this file *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance *
+// * with the License. You may obtain a copy of the License at
*
+// *
*
+// * http://www.apache.org/licenses/LICENSE-2.0
*
+// *
*
+// * Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied. See the License for the *
+// * specific language governing permissions and limitations under the
License. *
+//
***************************************************************************************************************************
+package org.apache.juneau.http.response;
+
+import static org.junit.runners.MethodSorters.*;
+
+import java.net.*;
+
+import org.apache.juneau.rest.annotation.*;
+import org.apache.juneau.rest.mock2.*;
+import org.junit.*;
+
+@FixMethodOrder(NAME_ASCENDING)
+public class Found_Test {
+
+ @Rest
+ public static class A {
+ @RestMethod public Found getA1() { return new Found(); }
+ @RestMethod public Found getA2() { return new Found("foo"); }
+ @RestMethod public Found getA3() { return new
Found(URI.create("servlet:/foo")); }
+ @RestMethod public Found getA4() { return new
Found().header("Foo","bar"); }
+ }
+
+ @Test
+ public void a01_basic() throws Exception {
+ MockRestClient client =
MockRestClient.createLax(A.class).disableRedirectHandling().build();
+
+ client.get("/a1")
+ .run()
+ .assertCode().is(302)
+ .assertBody().is("Found");
+ client.get("/a2")
+ .run()
+ .assertCode().is(302)
+ .assertBody().is("foo");
+ client.get("/a3")
+ .run()
+ .assertCode().is(302)
+ .assertBody().is("Found")
+ .assertStringHeader("Location").is("/foo");
+ client.get("/a4")
+ .run()
+ .assertCode().is(302)
+ .assertStringHeader("Foo").is("bar");
+ }
+}
diff --git
a/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/response/IMUsed_Test.java
b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/response/IMUsed_Test.java
new file mode 100644
index 0000000..9c2cd3e
--- /dev/null
+++
b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/response/IMUsed_Test.java
@@ -0,0 +1,48 @@
+//
***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file *
+// * distributed with this work for additional information regarding copyright
ownership. The ASF licenses this file *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance *
+// * with the License. You may obtain a copy of the License at
*
+// *
*
+// * http://www.apache.org/licenses/LICENSE-2.0
*
+// *
*
+// * Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied. See the License for the *
+// * specific language governing permissions and limitations under the
License. *
+//
***************************************************************************************************************************
+package org.apache.juneau.http.response;
+
+import static org.junit.runners.MethodSorters.*;
+
+import org.apache.juneau.rest.annotation.*;
+import org.apache.juneau.rest.mock2.*;
+import org.junit.*;
+
+@FixMethodOrder(NAME_ASCENDING)
+public class IMUsed_Test {
+
+ @Rest
+ public static class A {
+ @RestMethod public IMUsed getA1() { return new IMUsed(); }
+ @RestMethod public IMUsed getA2() { return new IMUsed("foo"); }
+ @RestMethod public IMUsed getA3() { return new
IMUsed().header("Foo","bar"); }
+ }
+
+ @Test
+ public void a01_basic() throws Exception {
+ MockRestClient client =
MockRestClient.createLax(A.class).build();
+
+ client.get("/a1")
+ .run()
+ .assertCode().is(226)
+ .assertBody().is("IM Used");
+ client.get("/a2")
+ .run()
+ .assertCode().is(226)
+ .assertBody().is("foo");
+ client.get("/a3")
+ .run()
+ .assertCode().is(226)
+ .assertStringHeader("Foo").is("bar");
+ }
+}
diff --git
a/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/response/MovedPermanently_Test.java
b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/response/MovedPermanently_Test.java
new file mode 100644
index 0000000..1b9fbca
--- /dev/null
+++
b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/response/MovedPermanently_Test.java
@@ -0,0 +1,56 @@
+//
***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file *
+// * distributed with this work for additional information regarding copyright
ownership. The ASF licenses this file *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance *
+// * with the License. You may obtain a copy of the License at
*
+// *
*
+// * http://www.apache.org/licenses/LICENSE-2.0
*
+// *
*
+// * Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied. See the License for the *
+// * specific language governing permissions and limitations under the
License. *
+//
***************************************************************************************************************************
+package org.apache.juneau.http.response;
+
+import static org.junit.runners.MethodSorters.*;
+
+import java.net.*;
+
+import org.apache.juneau.rest.annotation.*;
+import org.apache.juneau.rest.mock2.*;
+import org.junit.*;
+
+@FixMethodOrder(NAME_ASCENDING)
+public class MovedPermanently_Test {
+
+ @Rest
+ public static class A {
+ @RestMethod public MovedPermanently getA1() { return new
MovedPermanently(); }
+ @RestMethod public MovedPermanently getA2() { return new
MovedPermanently("foo"); }
+ @RestMethod public MovedPermanently getA3() { return new
MovedPermanently(URI.create("servlet:/foo")); }
+ @RestMethod public MovedPermanently getA4() { return new
MovedPermanently().header("Foo","bar"); }
+ }
+
+ @Test
+ public void a01_basic() throws Exception {
+ MockRestClient client =
MockRestClient.createLax(A.class).disableRedirectHandling().build();
+
+ client.get("/a1")
+ .run()
+ .assertCode().is(301)
+ .assertBody().is("Moved Permanently");
+ client.get("/a2")
+ .run()
+ .assertCode().is(301)
+ .assertBody().is("foo");
+ client.get("/a3")
+ .run()
+ .assertCode().is(301)
+ .assertBody().is("Moved Permanently")
+ .assertStringHeader("Location").is("/foo");
+ client.get("/a4")
+ .run()
+ .assertCode().is(301)
+ .assertStringHeader("Foo").is("bar");
+ }
+}
diff --git
a/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/response/MultiStatus_Test.java
b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/response/MultiStatus_Test.java
new file mode 100644
index 0000000..366285f
--- /dev/null
+++
b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/response/MultiStatus_Test.java
@@ -0,0 +1,48 @@
+//
***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file *
+// * distributed with this work for additional information regarding copyright
ownership. The ASF licenses this file *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance *
+// * with the License. You may obtain a copy of the License at
*
+// *
*
+// * http://www.apache.org/licenses/LICENSE-2.0
*
+// *
*
+// * Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied. See the License for the *
+// * specific language governing permissions and limitations under the
License. *
+//
***************************************************************************************************************************
+package org.apache.juneau.http.response;
+
+import static org.junit.runners.MethodSorters.*;
+
+import org.apache.juneau.rest.annotation.*;
+import org.apache.juneau.rest.mock2.*;
+import org.junit.*;
+
+@FixMethodOrder(NAME_ASCENDING)
+public class MultiStatus_Test {
+
+ @Rest
+ public static class A {
+ @RestMethod public MultiStatus getA1() { return new
MultiStatus(); }
+ @RestMethod public MultiStatus getA2() { return new
MultiStatus("foo"); }
+ @RestMethod public MultiStatus getA3() { return new
MultiStatus().header("Foo","bar"); }
+ }
+
+ @Test
+ public void a01_basic() throws Exception {
+ MockRestClient client =
MockRestClient.createLax(A.class).build();
+
+ client.get("/a1")
+ .run()
+ .assertCode().is(207)
+ .assertBody().is("Multi-Status");
+ client.get("/a2")
+ .run()
+ .assertCode().is(207)
+ .assertBody().is("foo");
+ client.get("/a3")
+ .run()
+ .assertCode().is(207)
+ .assertStringHeader("Foo").is("bar");
+ }
+}
diff --git
a/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/response/MultipleChoices_Test.java
b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/response/MultipleChoices_Test.java
new file mode 100644
index 0000000..32fee61
--- /dev/null
+++
b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/response/MultipleChoices_Test.java
@@ -0,0 +1,48 @@
+//
***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file *
+// * distributed with this work for additional information regarding copyright
ownership. The ASF licenses this file *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance *
+// * with the License. You may obtain a copy of the License at
*
+// *
*
+// * http://www.apache.org/licenses/LICENSE-2.0
*
+// *
*
+// * Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied. See the License for the *
+// * specific language governing permissions and limitations under the
License. *
+//
***************************************************************************************************************************
+package org.apache.juneau.http.response;
+
+import static org.junit.runners.MethodSorters.*;
+
+import org.apache.juneau.rest.annotation.*;
+import org.apache.juneau.rest.mock2.*;
+import org.junit.*;
+
+@FixMethodOrder(NAME_ASCENDING)
+public class MultipleChoices_Test {
+
+ @Rest
+ public static class A {
+ @RestMethod public MultipleChoices getA1() { return new
MultipleChoices(); }
+ @RestMethod public MultipleChoices getA2() { return new
MultipleChoices("foo"); }
+ @RestMethod public MultipleChoices getA3() { return new
MultipleChoices().header("Foo","bar"); }
+ }
+
+ @Test
+ public void a01_basic() throws Exception {
+ MockRestClient client =
MockRestClient.createLax(A.class).build();
+
+ client.get("/a1")
+ .run()
+ .assertCode().is(300)
+ .assertBody().is("Multiple Choices");
+ client.get("/a2")
+ .run()
+ .assertCode().is(300)
+ .assertBody().is("foo");
+ client.get("/a3")
+ .run()
+ .assertCode().is(300)
+ .assertStringHeader("Foo").is("bar");
+ }
+}
diff --git
a/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/response/NoContent_Test.java
b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/response/NoContent_Test.java
new file mode 100644
index 0000000..95faf01
--- /dev/null
+++
b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/response/NoContent_Test.java
@@ -0,0 +1,46 @@
+//
***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file *
+// * distributed with this work for additional information regarding copyright
ownership. The ASF licenses this file *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance *
+// * with the License. You may obtain a copy of the License at
*
+// *
*
+// * http://www.apache.org/licenses/LICENSE-2.0
*
+// *
*
+// * Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied. See the License for the *
+// * specific language governing permissions and limitations under the
License. *
+//
***************************************************************************************************************************
+package org.apache.juneau.http.response;
+
+import static org.junit.runners.MethodSorters.*;
+
+import org.apache.juneau.rest.annotation.*;
+import org.apache.juneau.rest.mock2.*;
+import org.junit.*;
+
+@FixMethodOrder(NAME_ASCENDING)
+public class NoContent_Test {
+
+ @Rest
+ public static class A {
+ @RestMethod public NoContent getA1() { return new NoContent(); }
+ @RestMethod public NoContent getA2() { return new
NoContent("foo"); }
+ @RestMethod public NoContent getA3() { return new
NoContent().header("Foo","bar"); }
+ }
+
+ @Test
+ public void a01_basic() throws Exception {
+ MockRestClient client =
MockRestClient.createLax(A.class).build();
+
+ client.get("/a1")
+ .run()
+ .assertCode().is(204);
+ client.get("/a2")
+ .run()
+ .assertCode().is(204);
+ client.get("/a3")
+ .run()
+ .assertCode().is(204)
+ .assertStringHeader("Foo").is("bar");
+ }
+}
diff --git
a/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/response/NonAuthoritativeInformation_Test.java
b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/response/NonAuthoritativeInformation_Test.java
new file mode 100644
index 0000000..c2769fb
--- /dev/null
+++
b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/response/NonAuthoritativeInformation_Test.java
@@ -0,0 +1,48 @@
+//
***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file *
+// * distributed with this work for additional information regarding copyright
ownership. The ASF licenses this file *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance *
+// * with the License. You may obtain a copy of the License at
*
+// *
*
+// * http://www.apache.org/licenses/LICENSE-2.0
*
+// *
*
+// * Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied. See the License for the *
+// * specific language governing permissions and limitations under the
License. *
+//
***************************************************************************************************************************
+package org.apache.juneau.http.response;
+
+import static org.junit.runners.MethodSorters.*;
+
+import org.apache.juneau.rest.annotation.*;
+import org.apache.juneau.rest.mock2.*;
+import org.junit.*;
+
+@FixMethodOrder(NAME_ASCENDING)
+public class NonAuthoritativeInformation_Test {
+
+ @Rest
+ public static class A {
+ @RestMethod public NonAuthoritiveInformation getA1() { return
new NonAuthoritiveInformation(); }
+ @RestMethod public NonAuthoritiveInformation getA2() { return
new NonAuthoritiveInformation("foo"); }
+ @RestMethod public NonAuthoritiveInformation getA3() { return
new NonAuthoritiveInformation().header("Foo","bar"); }
+ }
+
+ @Test
+ public void a01_basic() throws Exception {
+ MockRestClient client =
MockRestClient.createLax(A.class).build();
+
+ client.get("/a1")
+ .run()
+ .assertCode().is(203)
+ .assertBody().is("Non-Authoritative Information");
+ client.get("/a2")
+ .run()
+ .assertCode().is(203)
+ .assertBody().is("foo");
+ client.get("/a3")
+ .run()
+ .assertCode().is(203)
+ .assertStringHeader("Foo").is("bar");
+ }
+}
diff --git
a/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/response/NotModified_Test.java
b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/response/NotModified_Test.java
new file mode 100644
index 0000000..cdba820
--- /dev/null
+++
b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/response/NotModified_Test.java
@@ -0,0 +1,46 @@
+//
***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file *
+// * distributed with this work for additional information regarding copyright
ownership. The ASF licenses this file *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance *
+// * with the License. You may obtain a copy of the License at
*
+// *
*
+// * http://www.apache.org/licenses/LICENSE-2.0
*
+// *
*
+// * Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied. See the License for the *
+// * specific language governing permissions and limitations under the
License. *
+//
***************************************************************************************************************************
+package org.apache.juneau.http.response;
+
+import static org.junit.runners.MethodSorters.*;
+
+import org.apache.juneau.rest.annotation.*;
+import org.apache.juneau.rest.mock2.*;
+import org.junit.*;
+
+@FixMethodOrder(NAME_ASCENDING)
+public class NotModified_Test {
+
+ @Rest
+ public static class A {
+ @RestMethod public NotModified getA1() { return new
NotModified(); }
+ @RestMethod public NotModified getA2() { return new
NotModified("foo"); }
+ @RestMethod public NotModified getA3() { return new
NotModified().header("Foo","bar"); }
+ }
+
+ @Test
+ public void a01_basic() throws Exception {
+ MockRestClient client =
MockRestClient.createLax(A.class).build();
+
+ client.get("/a1")
+ .run()
+ .assertCode().is(304);
+ client.get("/a2")
+ .run()
+ .assertCode().is(304);
+ client.get("/a3")
+ .run()
+ .assertCode().is(304)
+ .assertStringHeader("Foo").is("bar");
+ }
+}
diff --git
a/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/response/Ok_Test.java
b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/response/Ok_Test.java
new file mode 100644
index 0000000..1586c20
--- /dev/null
+++
b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/response/Ok_Test.java
@@ -0,0 +1,48 @@
+//
***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file *
+// * distributed with this work for additional information regarding copyright
ownership. The ASF licenses this file *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance *
+// * with the License. You may obtain a copy of the License at
*
+// *
*
+// * http://www.apache.org/licenses/LICENSE-2.0
*
+// *
*
+// * Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied. See the License for the *
+// * specific language governing permissions and limitations under the
License. *
+//
***************************************************************************************************************************
+package org.apache.juneau.http.response;
+
+import static org.junit.runners.MethodSorters.*;
+
+import org.apache.juneau.rest.annotation.*;
+import org.apache.juneau.rest.mock2.*;
+import org.junit.*;
+
+@FixMethodOrder(NAME_ASCENDING)
+public class Ok_Test {
+
+ @Rest
+ public static class A {
+ @RestMethod public Ok getA1() { return new Ok(); }
+ @RestMethod public Ok getA2() { return new Ok("foo"); }
+ @RestMethod public Ok getA3() { return new
Ok().header("Foo","bar"); }
+ }
+
+ @Test
+ public void a01_basic() throws Exception {
+ MockRestClient client =
MockRestClient.createLax(A.class).build();
+
+ client.get("/a1")
+ .run()
+ .assertCode().is(200)
+ .assertBody().is("OK");
+ client.get("/a2")
+ .run()
+ .assertCode().is(200)
+ .assertBody().is("foo");
+ client.get("/a3")
+ .run()
+ .assertCode().is(200)
+ .assertStringHeader("Foo").is("bar");
+ }
+}
diff --git
a/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/response/PartialContent_Test.java
b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/response/PartialContent_Test.java
new file mode 100644
index 0000000..d13f3c0
--- /dev/null
+++
b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/response/PartialContent_Test.java
@@ -0,0 +1,48 @@
+//
***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file *
+// * distributed with this work for additional information regarding copyright
ownership. The ASF licenses this file *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance *
+// * with the License. You may obtain a copy of the License at
*
+// *
*
+// * http://www.apache.org/licenses/LICENSE-2.0
*
+// *
*
+// * Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied. See the License for the *
+// * specific language governing permissions and limitations under the
License. *
+//
***************************************************************************************************************************
+package org.apache.juneau.http.response;
+
+import static org.junit.runners.MethodSorters.*;
+
+import org.apache.juneau.rest.annotation.*;
+import org.apache.juneau.rest.mock2.*;
+import org.junit.*;
+
+@FixMethodOrder(NAME_ASCENDING)
+public class PartialContent_Test {
+
+ @Rest
+ public static class A {
+ @RestMethod public PartialContent getA1() { return new
PartialContent(); }
+ @RestMethod public PartialContent getA2() { return new
PartialContent("foo"); }
+ @RestMethod public PartialContent getA3() { return new
PartialContent().header("Foo","bar"); }
+ }
+
+ @Test
+ public void a01_basic() throws Exception {
+ MockRestClient client =
MockRestClient.createLax(A.class).build();
+
+ client.get("/a1")
+ .run()
+ .assertCode().is(206)
+ .assertBody().is("Partial Content");
+ client.get("/a2")
+ .run()
+ .assertCode().is(206)
+ .assertBody().is("foo");
+ client.get("/a3")
+ .run()
+ .assertCode().is(206)
+ .assertStringHeader("Foo").is("bar");
+ }
+}
diff --git
a/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/response/PermanentRedirect_Test.java
b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/response/PermanentRedirect_Test.java
new file mode 100644
index 0000000..585d2ba
--- /dev/null
+++
b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/response/PermanentRedirect_Test.java
@@ -0,0 +1,56 @@
+//
***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file *
+// * distributed with this work for additional information regarding copyright
ownership. The ASF licenses this file *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance *
+// * with the License. You may obtain a copy of the License at
*
+// *
*
+// * http://www.apache.org/licenses/LICENSE-2.0
*
+// *
*
+// * Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied. See the License for the *
+// * specific language governing permissions and limitations under the
License. *
+//
***************************************************************************************************************************
+package org.apache.juneau.http.response;
+
+import static org.junit.runners.MethodSorters.*;
+
+import java.net.*;
+
+import org.apache.juneau.rest.annotation.*;
+import org.apache.juneau.rest.mock2.*;
+import org.junit.*;
+
+@FixMethodOrder(NAME_ASCENDING)
+public class PermanentRedirect_Test {
+
+ @Rest
+ public static class A {
+ @RestMethod public PermanentRedirect getA1() { return new
PermanentRedirect(); }
+ @RestMethod public PermanentRedirect getA2() { return new
PermanentRedirect("foo"); }
+ @RestMethod public PermanentRedirect getA3() { return new
PermanentRedirect(URI.create("servlet:/foo")); }
+ @RestMethod public PermanentRedirect getA4() { return new
PermanentRedirect().header("Foo","bar"); }
+ }
+
+ @Test
+ public void a01_basic() throws Exception {
+ MockRestClient client =
MockRestClient.createLax(A.class).disableRedirectHandling().build();
+
+ client.get("/a1")
+ .run()
+ .assertCode().is(308)
+ .assertBody().is("Permanent Redirect");
+ client.get("/a2")
+ .run()
+ .assertCode().is(308)
+ .assertBody().is("foo");
+ client.get("/a3")
+ .run()
+ .assertCode().is(308)
+ .assertBody().is("Permanent Redirect")
+ .assertStringHeader("Location").is("/foo");
+ client.get("/a4")
+ .run()
+ .assertCode().is(308)
+ .assertStringHeader("Foo").is("bar");
+ }
+}
diff --git
a/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/response/Processing_Test.java
b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/response/Processing_Test.java
new file mode 100644
index 0000000..ffe3362
--- /dev/null
+++
b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/response/Processing_Test.java
@@ -0,0 +1,48 @@
+//
***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file *
+// * distributed with this work for additional information regarding copyright
ownership. The ASF licenses this file *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance *
+// * with the License. You may obtain a copy of the License at
*
+// *
*
+// * http://www.apache.org/licenses/LICENSE-2.0
*
+// *
*
+// * Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied. See the License for the *
+// * specific language governing permissions and limitations under the
License. *
+//
***************************************************************************************************************************
+package org.apache.juneau.http.response;
+
+import static org.junit.runners.MethodSorters.*;
+
+import org.apache.juneau.rest.annotation.*;
+import org.apache.juneau.rest.mock2.*;
+import org.junit.*;
+
+@FixMethodOrder(NAME_ASCENDING)
+public class Processing_Test {
+
+ @Rest
+ public static class A {
+ @RestMethod public Processing getA1() { return new
Processing(); }
+ @RestMethod public Processing getA2() { return new
Processing("foo"); }
+ @RestMethod public Processing getA3() { return new
Processing().header("Foo","bar"); }
+ }
+
+ @Test
+ public void a01_basic() throws Exception {
+ MockRestClient client =
MockRestClient.createLax(A.class).build();
+
+ client.get("/a1")
+ .run()
+ .assertCode().is(1102)
+ .assertBody().is("Processing");
+ client.get("/a2")
+ .run()
+ .assertCode().is(1102)
+ .assertBody().is("foo");
+ client.get("/a3")
+ .run()
+ .assertCode().is(1102)
+ .assertStringHeader("Foo").is("bar");
+ }
+}
diff --git
a/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/response/ResetContent_Test.java
b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/response/ResetContent_Test.java
new file mode 100644
index 0000000..057e90f
--- /dev/null
+++
b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/response/ResetContent_Test.java
@@ -0,0 +1,46 @@
+//
***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file *
+// * distributed with this work for additional information regarding copyright
ownership. The ASF licenses this file *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance *
+// * with the License. You may obtain a copy of the License at
*
+// *
*
+// * http://www.apache.org/licenses/LICENSE-2.0
*
+// *
*
+// * Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied. See the License for the *
+// * specific language governing permissions and limitations under the
License. *
+//
***************************************************************************************************************************
+package org.apache.juneau.http.response;
+
+import static org.junit.runners.MethodSorters.*;
+
+import org.apache.juneau.rest.annotation.*;
+import org.apache.juneau.rest.mock2.*;
+import org.junit.*;
+
+@FixMethodOrder(NAME_ASCENDING)
+public class ResetContent_Test {
+
+ @Rest
+ public static class A {
+ @RestMethod public ResetContent getA1() { return new
ResetContent(); }
+ @RestMethod public ResetContent getA2() { return new
ResetContent("foo"); }
+ @RestMethod public ResetContent getA3() { return new
ResetContent().header("Foo","bar"); }
+ }
+
+ @Test
+ public void a01_basic() throws Exception {
+ MockRestClient client =
MockRestClient.createLax(A.class).build();
+
+ client.get("/a1")
+ .run()
+ .assertCode().is(205);
+ client.get("/a2")
+ .run()
+ .assertCode().is(205);
+ client.get("/a3")
+ .run()
+ .assertCode().is(205)
+ .assertStringHeader("Foo").is("bar");
+ }
+}
diff --git
a/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/response/SeeOther_Test.java
b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/response/SeeOther_Test.java
new file mode 100644
index 0000000..99d6851
--- /dev/null
+++
b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/response/SeeOther_Test.java
@@ -0,0 +1,56 @@
+//
***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file *
+// * distributed with this work for additional information regarding copyright
ownership. The ASF licenses this file *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance *
+// * with the License. You may obtain a copy of the License at
*
+// *
*
+// * http://www.apache.org/licenses/LICENSE-2.0
*
+// *
*
+// * Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied. See the License for the *
+// * specific language governing permissions and limitations under the
License. *
+//
***************************************************************************************************************************
+package org.apache.juneau.http.response;
+
+import static org.junit.runners.MethodSorters.*;
+
+import java.net.*;
+
+import org.apache.juneau.rest.annotation.*;
+import org.apache.juneau.rest.mock2.*;
+import org.junit.*;
+
+@FixMethodOrder(NAME_ASCENDING)
+public class SeeOther_Test {
+
+ @Rest
+ public static class A {
+ @RestMethod public SeeOther getA1() { return new SeeOther(); }
+ @RestMethod public SeeOther getA2() { return new
SeeOther("foo"); }
+ @RestMethod public SeeOther getA3() { return new
SeeOther(URI.create("servlet:/foo")); }
+ @RestMethod public SeeOther getA4() { return new
SeeOther().header("Foo","bar"); }
+ }
+
+ @Test
+ public void a01_basic() throws Exception {
+ MockRestClient client =
MockRestClient.createLax(A.class).disableRedirectHandling().build();
+
+ client.get("/a1")
+ .run()
+ .assertCode().is(303)
+ .assertBody().is("See Other");
+ client.get("/a2")
+ .run()
+ .assertCode().is(303)
+ .assertBody().is("foo");
+ client.get("/a3")
+ .run()
+ .assertCode().is(303)
+ .assertBody().is("See Other")
+ .assertStringHeader("Location").is("/foo");
+ client.get("/a4")
+ .run()
+ .assertCode().is(303)
+ .assertStringHeader("Foo").is("bar");
+ }
+}
diff --git
a/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/response/SwitchingProtocols_Test.java
b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/response/SwitchingProtocols_Test.java
new file mode 100644
index 0000000..02f25c2
--- /dev/null
+++
b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/response/SwitchingProtocols_Test.java
@@ -0,0 +1,48 @@
+//
***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file *
+// * distributed with this work for additional information regarding copyright
ownership. The ASF licenses this file *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance *
+// * with the License. You may obtain a copy of the License at
*
+// *
*
+// * http://www.apache.org/licenses/LICENSE-2.0
*
+// *
*
+// * Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied. See the License for the *
+// * specific language governing permissions and limitations under the
License. *
+//
***************************************************************************************************************************
+package org.apache.juneau.http.response;
+
+import static org.junit.runners.MethodSorters.*;
+
+import org.apache.juneau.rest.annotation.*;
+import org.apache.juneau.rest.mock2.*;
+import org.junit.*;
+
+@FixMethodOrder(NAME_ASCENDING)
+public class SwitchingProtocols_Test {
+
+ @Rest
+ public static class A {
+ @RestMethod public SwitchingProtocols getA1() { return new
SwitchingProtocols(); }
+ @RestMethod public SwitchingProtocols getA2() { return new
SwitchingProtocols("foo"); }
+ @RestMethod public SwitchingProtocols getA3() { return new
SwitchingProtocols().header("Foo","bar"); }
+ }
+
+ @Test
+ public void a01_basic() throws Exception {
+ MockRestClient client =
MockRestClient.createLax(A.class).build();
+
+ client.get("/a1")
+ .run()
+ .assertCode().is(1101)
+ .assertBody().is("Switching Protocols");
+ client.get("/a2")
+ .run()
+ .assertCode().is(1101)
+ .assertBody().is("foo");
+ client.get("/a3")
+ .run()
+ .assertCode().is(1101)
+ .assertStringHeader("Foo").is("bar");
+ }
+}
diff --git
a/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/response/TemporaryRedirect_Test.java
b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/response/TemporaryRedirect_Test.java
new file mode 100644
index 0000000..49db930
--- /dev/null
+++
b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/response/TemporaryRedirect_Test.java
@@ -0,0 +1,56 @@
+//
***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file *
+// * distributed with this work for additional information regarding copyright
ownership. The ASF licenses this file *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance *
+// * with the License. You may obtain a copy of the License at
*
+// *
*
+// * http://www.apache.org/licenses/LICENSE-2.0
*
+// *
*
+// * Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied. See the License for the *
+// * specific language governing permissions and limitations under the
License. *
+//
***************************************************************************************************************************
+package org.apache.juneau.http.response;
+
+import static org.junit.runners.MethodSorters.*;
+
+import java.net.*;
+
+import org.apache.juneau.rest.annotation.*;
+import org.apache.juneau.rest.mock2.*;
+import org.junit.*;
+
+@FixMethodOrder(NAME_ASCENDING)
+public class TemporaryRedirect_Test {
+
+ @Rest
+ public static class A {
+ @RestMethod public TemporaryRedirect getA1() { return new
TemporaryRedirect(); }
+ @RestMethod public TemporaryRedirect getA2() { return new
TemporaryRedirect("foo"); }
+ @RestMethod public TemporaryRedirect getA3() { return new
TemporaryRedirect(URI.create("servlet:/foo")); }
+ @RestMethod public TemporaryRedirect getA4() { return new
TemporaryRedirect().header("Foo","bar"); }
+ }
+
+ @Test
+ public void a01_basic() throws Exception {
+ MockRestClient client =
MockRestClient.createLax(A.class).disableRedirectHandling().build();
+
+ client.get("/a1")
+ .run()
+ .assertCode().is(307)
+ .assertBody().is("Temporary Redirect");
+ client.get("/a2")
+ .run()
+ .assertCode().is(307)
+ .assertBody().is("foo");
+ client.get("/a3")
+ .run()
+ .assertCode().is(307)
+ .assertBody().is("Temporary Redirect")
+ .assertStringHeader("Location").is("/foo");
+ client.get("/a4")
+ .run()
+ .assertCode().is(307)
+ .assertStringHeader("Foo").is("bar");
+ }
+}
\ No newline at end of file
diff --git
a/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/response/UseProxy_Test.java
b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/response/UseProxy_Test.java
new file mode 100644
index 0000000..6343dd7
--- /dev/null
+++
b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/response/UseProxy_Test.java
@@ -0,0 +1,48 @@
+//
***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file *
+// * distributed with this work for additional information regarding copyright
ownership. The ASF licenses this file *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance *
+// * with the License. You may obtain a copy of the License at
*
+// *
*
+// * http://www.apache.org/licenses/LICENSE-2.0
*
+// *
*
+// * Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied. See the License for the *
+// * specific language governing permissions and limitations under the
License. *
+//
***************************************************************************************************************************
+package org.apache.juneau.http.response;
+
+import static org.junit.runners.MethodSorters.*;
+
+import org.apache.juneau.rest.annotation.*;
+import org.apache.juneau.rest.mock2.*;
+import org.junit.*;
+
+@FixMethodOrder(NAME_ASCENDING)
+public class UseProxy_Test {
+
+ @Rest
+ public static class A {
+ @RestMethod public UseProxy getA1() { return new UseProxy(); }
+ @RestMethod public UseProxy getA2() { return new
UseProxy("foo"); }
+ @RestMethod public UseProxy getA3() { return new
UseProxy().header("Foo","bar"); }
+ }
+
+ @Test
+ public void a01_basic() throws Exception {
+ MockRestClient client =
MockRestClient.createLax(A.class).build();
+
+ client.get("/a1")
+ .run()
+ .assertCode().is(305)
+ .assertBody().is("Use Proxy");
+ client.get("/a2")
+ .run()
+ .assertCode().is(305)
+ .assertBody().is("foo");
+ client.get("/a3")
+ .run()
+ .assertCode().is(305)
+ .assertStringHeader("Foo").is("bar");
+ }
+}
diff --git
a/juneau-rest/juneau-rest-server-utest/src/test/java/org/apache/juneau/rest/BasicResponsesTest.java
b/juneau-rest/juneau-rest-server-utest/src/test/java/org/apache/juneau/rest/BasicResponsesTest.java
new file mode 100644
index 0000000..eff109e
--- /dev/null
+++
b/juneau-rest/juneau-rest-server-utest/src/test/java/org/apache/juneau/rest/BasicResponsesTest.java
@@ -0,0 +1,175 @@
+//
***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file *
+// * distributed with this work for additional information regarding copyright
ownership. The ASF licenses this file *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance *
+// * with the License. You may obtain a copy of the License at
*
+// *
*
+// * http://www.apache.org/licenses/LICENSE-2.0
*
+// *
*
+// * Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied. See the License for the *
+// * specific language governing permissions and limitations under the
License. *
+//
***************************************************************************************************************************
+package org.apache.juneau.rest;
+
+import static org.apache.juneau.rest.testutils.TestUtils.*;
+
+import static org.junit.Assert.*;
+import static org.junit.runners.MethodSorters.*;
+
+import org.apache.juneau.dto.swagger.*;
+import org.apache.juneau.rest.annotation.*;
+import org.apache.juneau.http.response.*;
+import org.junit.*;
+
+@FixMethodOrder(NAME_ASCENDING)
+public class BasicResponsesTest {
+
+
//-----------------------------------------------------------------------------------------------------------------
+ // Basic sanity tests
+
//-----------------------------------------------------------------------------------------------------------------
+
+ @Rest
+ public static class A {
+ @RestMethod public Accepted accepted() { return new Accepted();
}
+ @RestMethod public AlreadyReported alreadyReported() { return
new AlreadyReported(); }
+ @RestMethod(path="/continue") public Continue _continue() {
return new Continue(); }
+ @RestMethod public Created created() { return new Created(); }
+ @RestMethod public EarlyHints earlyHints() { return new
EarlyHints(); }
+ @RestMethod public Found found() { return new Found(); }
+ @RestMethod public IMUsed imUsed() { return new IMUsed(); }
+ @RestMethod public MovedPermanently movedPermanently() { return
new MovedPermanently(); }
+ @RestMethod public MultipleChoices multipleChoices() { return
new MultipleChoices(); }
+ @RestMethod public MultiStatus multiStatus() { return new
MultiStatus(); }
+ @RestMethod public NoContent noContent() { return new
NoContent(); }
+ @RestMethod public NonAuthoritiveInformation
nonAuthoritiveInformation() { return new NonAuthoritiveInformation(); }
+ @RestMethod public NotModified notModified() { return new
NotModified(); }
+ @RestMethod public Ok ok() { return new Ok(); }
+ @RestMethod public PartialContent partialContent() { return new
PartialContent(); }
+ @RestMethod public PermanentRedirect permanentRedirect() {
return new PermanentRedirect(); }
+ @RestMethod public Processing processing() { return new
Processing(); }
+ @RestMethod public ResetContent resetContent() { return new
ResetContent(); }
+ @RestMethod public SeeOther seeOther() { return new SeeOther();
}
+ @RestMethod public SwitchingProtocols switchingProtocols() {
return new SwitchingProtocols(); }
+ @RestMethod public TemporaryRedirect temporaryRedirect() {
return new TemporaryRedirect(); }
+ @RestMethod public UseProxy useProxy() { return new UseProxy();
}
+ }
+
+
+
//-----------------------------------------------------------------------------------------------------------------
+ // Test Swagger
+
//-----------------------------------------------------------------------------------------------------------------
+
+ static Swagger e = getSwagger(A.class);
+
+ @Test
+ public void e01_accepted() throws Exception {
+ ResponseInfo ri =
e.getPaths().get("/accepted").get("get").getResponse(Accepted.CODE);
+ assertEquals(Accepted.MESSAGE, ri.getDescription());
+ }
+ @Test
+ public void e02_alreadyReported() throws Exception {
+ ResponseInfo ri =
e.getPaths().get("/alreadyReported").get("get").getResponse(AlreadyReported.CODE);
+ assertEquals(AlreadyReported.MESSAGE, ri.getDescription());
+ }
+ @Test
+ public void e03_continue() throws Exception {
+ ResponseInfo ri =
e.getPaths().get("/continue").get("get").getResponse(Continue.CODE);
+ assertEquals(Continue.MESSAGE, ri.getDescription());
+ }
+ @Test
+ public void e04_created() throws Exception {
+ ResponseInfo ri =
e.getPaths().get("/created").get("get").getResponse(Created.CODE);
+ assertEquals(Created.MESSAGE, ri.getDescription());
+ }
+ @Test
+ public void e05_earlyHints() throws Exception {
+ ResponseInfo ri =
e.getPaths().get("/earlyHints").get("get").getResponse(EarlyHints.CODE);
+ assertEquals(EarlyHints.MESSAGE, ri.getDescription());
+ }
+ @Test
+ public void e06_found() throws Exception {
+ ResponseInfo ri =
e.getPaths().get("/found").get("get").getResponse(Found.CODE);
+ assertEquals(Found.MESSAGE, ri.getDescription());
+ }
+ @Test
+ public void e07_imUsed() throws Exception {
+ ResponseInfo ri =
e.getPaths().get("/imUsed").get("get").getResponse(IMUsed.CODE);
+ assertEquals(IMUsed.MESSAGE, ri.getDescription());
+ }
+ @Test
+ public void e08_movedPermanently() throws Exception {
+ ResponseInfo ri =
e.getPaths().get("/movedPermanently").get("get").getResponse(MovedPermanently.CODE);
+ assertEquals(MovedPermanently.MESSAGE, ri.getDescription());
+ }
+ @Test
+ public void e09_multipleChoices() throws Exception {
+ ResponseInfo ri =
e.getPaths().get("/multipleChoices").get("get").getResponse(MultipleChoices.CODE);
+ assertEquals(MultipleChoices.MESSAGE, ri.getDescription());
+ }
+ @Test
+ public void e10_multiStatus() throws Exception {
+ ResponseInfo ri =
e.getPaths().get("/multiStatus").get("get").getResponse(MultiStatus.CODE);
+ assertEquals(MultiStatus.MESSAGE, ri.getDescription());
+ }
+ @Test
+ public void e11_noContent() throws Exception {
+ ResponseInfo ri =
e.getPaths().get("/noContent").get("get").getResponse(NoContent.CODE);
+ assertEquals(NoContent.MESSAGE, ri.getDescription());
+ }
+ @Test
+ public void e12_nonAuthoritiveInformation() throws Exception {
+ ResponseInfo ri =
e.getPaths().get("/nonAuthoritiveInformation").get("get").getResponse(NonAuthoritiveInformation.CODE);
+ assertEquals(NonAuthoritiveInformation.MESSAGE,
ri.getDescription());
+ }
+ @Test
+ public void e13_notModified() throws Exception {
+ ResponseInfo ri =
e.getPaths().get("/notModified").get("get").getResponse(NotModified.CODE);
+ assertEquals(NotModified.MESSAGE, ri.getDescription());
+ }
+ @Test
+ public void e14_ok() throws Exception {
+ ResponseInfo ri =
e.getPaths().get("/ok").get("get").getResponse(Ok.CODE);
+ assertEquals(Ok.MESSAGE, ri.getDescription());
+ }
+ @Test
+ public void e15_partialContent() throws Exception {
+ ResponseInfo ri =
e.getPaths().get("/partialContent").get("get").getResponse(PartialContent.CODE);
+ assertEquals(PartialContent.MESSAGE, ri.getDescription());
+ }
+ @Test
+ public void e16_permanentRedirect() throws Exception {
+ ResponseInfo ri =
e.getPaths().get("/permanentRedirect").get("get").getResponse(PermanentRedirect.CODE);
+ assertEquals(PermanentRedirect.MESSAGE, ri.getDescription());
+ }
+ @Test
+ public void e17_processing() throws Exception {
+ ResponseInfo ri =
e.getPaths().get("/processing").get("get").getResponse(Processing.CODE);
+ assertEquals(Processing.MESSAGE, ri.getDescription());
+ }
+ @Test
+ public void e18_resetContent() throws Exception {
+ ResponseInfo ri =
e.getPaths().get("/resetContent").get("get").getResponse(ResetContent.CODE);
+ assertEquals(ResetContent.MESSAGE, ri.getDescription());
+ }
+ @Test
+ public void e19_seeOther() throws Exception {
+ ResponseInfo ri =
e.getPaths().get("/seeOther").get("get").getResponse(SeeOther.CODE);
+ assertEquals(SeeOther.MESSAGE, ri.getDescription());
+ }
+ @Test
+ public void e20_switchingProtocols() throws Exception {
+ ResponseInfo ri =
e.getPaths().get("/switchingProtocols").get("get").getResponse(SwitchingProtocols.CODE);
+ assertEquals(SwitchingProtocols.MESSAGE, ri.getDescription());
+ }
+ @Test
+ public void e21_temporaryRedirect() throws Exception {
+ ResponseInfo ri =
e.getPaths().get("/temporaryRedirect").get("get").getResponse(TemporaryRedirect.CODE);
+ assertEquals(TemporaryRedirect.MESSAGE, ri.getDescription());
+ }
+ @Test
+ public void e22_useProxy() throws Exception {
+ ResponseInfo ri =
e.getPaths().get("/useProxy").get("get").getResponse(UseProxy.CODE);
+ assertEquals(UseProxy.MESSAGE, ri.getDescription());
+ }
+}
diff --git
a/juneau-rest/juneau-rest-server-utest/src/test/java/org/apache/juneau/rest/responses/BasicTest.java
b/juneau-rest/juneau-rest-server-utest/src/test/java/org/apache/juneau/rest/responses/BasicTest.java
deleted file mode 100644
index 4a80e44..0000000
---
a/juneau-rest/juneau-rest-server-utest/src/test/java/org/apache/juneau/rest/responses/BasicTest.java
+++ /dev/null
@@ -1,578 +0,0 @@
-//
***************************************************************************************************************************
-// * Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file *
-// * distributed with this work for additional information regarding copyright
ownership. The ASF licenses this file *
-// * to you under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance *
-// * with the License. You may obtain a copy of the License at
*
-// *
*
-// * http://www.apache.org/licenses/LICENSE-2.0
*
-// *
*
-// * Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an *
-// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied. See the License for the *
-// * specific language governing permissions and limitations under the
License. *
-//
***************************************************************************************************************************
-package org.apache.juneau.rest.responses;
-
-import static org.junit.Assert.*;
-import static org.junit.runners.MethodSorters.*;
-import static org.apache.juneau.rest.testutils.TestUtils.*;
-
-import java.net.*;
-
-
-import org.apache.juneau.dto.swagger.*;
-import org.apache.juneau.json.*;
-import org.apache.juneau.rest.annotation.*;
-import org.apache.juneau.rest.mock2.*;
-import org.apache.juneau.http.response.*;
-import org.junit.*;
-
-@FixMethodOrder(NAME_ASCENDING)
-public class BasicTest {
-
-
//-----------------------------------------------------------------------------------------------------------------
- // Basic sanity tests
-
//-----------------------------------------------------------------------------------------------------------------
-
- @Rest
- public static class A {
- @RestMethod public Accepted accepted() { return new Accepted();
}
- @RestMethod public AlreadyReported alreadyReported() { return
new AlreadyReported(); }
- @RestMethod(path="/continue") public Continue _continue() {
return new Continue(); }
- @RestMethod public Created created() { return new Created(); }
- @RestMethod public EarlyHints earlyHints() { return new
EarlyHints(); }
- @RestMethod public Found found() { return new Found(); }
- @RestMethod public IMUsed imUsed() { return new IMUsed(); }
- @RestMethod public MovedPermanently movedPermanently() { return
new MovedPermanently(); }
- @RestMethod public MultipleChoices multipleChoices() { return
new MultipleChoices(); }
- @RestMethod public MultiStatus multiStatus() { return new
MultiStatus(); }
- @RestMethod public NoContent noContent() { return new
NoContent(); }
- @RestMethod public NonAuthoritiveInformation
nonAuthoritiveInformation() { return new NonAuthoritiveInformation(); }
- @RestMethod public NotModified notModified() { return new
NotModified(); }
- @RestMethod public Ok ok() { return new Ok(); }
- @RestMethod public PartialContent partialContent() { return new
PartialContent(); }
- @RestMethod public PermanentRedirect permanentRedirect() {
return new PermanentRedirect(); }
- @RestMethod public Processing processing() { return new
Processing(); }
- @RestMethod public ResetContent resetContent() { return new
ResetContent(); }
- @RestMethod public SeeOther seeOther() { return new SeeOther();
}
- @RestMethod public SwitchingProtocols switchingProtocols() {
return new SwitchingProtocols(); }
- @RestMethod public TemporaryRedirect temporaryRedirect() {
return new TemporaryRedirect(); }
- @RestMethod public UseProxy useProxy() { return new UseProxy();
}
- }
-
- static MockRestClient a =
MockRestClient.createLax(A.class).disableRedirectHandling().build();
-
- @Test
- public void a01_accepted() throws Exception {
- a.get("/accepted")
- .run()
- .assertCode().is(202)
- .assertBody().is("Accepted");
- }
- @Test
- public void a02_alreadyReported() throws Exception {
- a.get("/alreadyReported")
- .run()
- .assertCode().is(208)
- .assertBody().is("Already Reported");
- }
- @Test
- public void a03_continue() throws Exception {
- a.get("/continue")
- .run()
- .assertCode().is(1100)
- .assertBody().is("Continue");
- }
- @Test
- public void a04_created() throws Exception {
- a.get("/created")
- .run()
- .assertCode().is(201)
- .assertBody().is("Created");
- }
- @Test
- public void a05_earlyHints() throws Exception {
- a.get("/earlyHints")
- .run()
- .assertCode().is(1103)
- .assertBody().is("Early Hints");
- }
- @Test
- public void a06_found() throws Exception {
- a.get("/found")
- .run()
- .assertCode().is(302)
- .assertBody().is("Found");
- }
- @Test
- public void a07_imUsed() throws Exception {
- a.get("/imUsed")
- .run()
- .assertCode().is(226)
- .assertBody().is("IM Used");
- }
- @Test
- public void a08_movedPermanently() throws Exception {
- a.get("/movedPermanently")
- .run()
- .assertCode().is(301)
- .assertBody().is("Moved Permanently");
- }
- @Test
- public void a09_multipleChoices() throws Exception {
- a.get("/multipleChoices")
- .run()
- .assertCode().is(300)
- .assertBody().is("Multiple Choices");
- }
- @Test
- public void a10_multiStatus() throws Exception {
- a.get("/multiStatus")
- .run()
- .assertCode().is(207)
- .assertBody().is("Multi-Status");
- }
- @Test
- public void a11_noContent() throws Exception {
- a.get("/noContent")
- .run()
- .assertCode().is(204);
- }
- @Test
- public void a12_nonAuthoritiveInformation() throws Exception {
- a.get("/nonAuthoritiveInformation")
- .run()
- .assertCode().is(203)
- .assertBody().is("Non-Authoritative Information");
- }
- @Test
- public void a13_notModified() throws Exception {
- a.get("/notModified")
- .run()
- .assertCode().is(304);
- }
- @Test
- public void a14_ok() throws Exception {
- a.get("/ok")
- .run()
- .assertCode().is(200)
- .assertBody().is("OK");
- }
- @Test
- public void a15_partialContent() throws Exception {
- a.get("/partialContent")
- .run()
- .assertCode().is(206)
- .assertBody().is("Partial Content");
- }
- @Test
- public void a16_permanentRedirect() throws Exception {
- a.get("/permanentRedirect")
- .run()
- .assertCode().is(308)
- .assertBody().is("Permanent Redirect");
- }
- @Test
- public void a17_processing() throws Exception {
- a.get("/processing")
- .run()
- .assertCode().is(1102)
- .assertBody().is("Processing");
- }
- @Test
- public void a18_resetContent() throws Exception {
- a.get("/resetContent")
- .run()
- .assertCode().is(205);
- }
- @Test
- public void a19_seeOther() throws Exception {
- a.get("/seeOther")
- .run()
- .assertCode().is(303)
- .assertBody().is("See Other");
- }
- @Test
- public void a20_switchingProtocols() throws Exception {
- a.get("/switchingProtocols")
- .run()
- .assertCode().is(1101)
- .assertBody().is("Switching Protocols");
- }
- @Test
- public void a21_temporaryRedirect() throws Exception {
- a.get("/temporaryRedirect")
- .run()
- .assertCode().is(307)
- .assertBody().is("Temporary Redirect");
- }
- @Test
- public void a22_useProxy() throws Exception {
- a.get("/useProxy")
- .run()
- .assertCode().is(305)
- .assertBody().is("Use Proxy");
- }
-
-
//-----------------------------------------------------------------------------------------------------------------
- // Statuses with URIs.
-
//-----------------------------------------------------------------------------------------------------------------
-
- @Rest
- public static class B {
- @RestMethod public MovedPermanently movedPermanently() { return
new MovedPermanently(URI.create("servlet:/foo")); }
- @RestMethod public PermanentRedirect permanentRedirect() {
return new PermanentRedirect(URI.create("servlet:/foo")); }
- @RestMethod public SeeOther seeOther() { return new
SeeOther(URI.create("servlet:/foo")); }
- @RestMethod public TemporaryRedirect temporaryRedirect() {
return new TemporaryRedirect(URI.create("servlet:/foo")); }
- }
-
- static MockRestClient b =
MockRestClient.create(B.class).disableRedirectHandling().build();
-
- @Test
- public void b01_movedPermanently() throws Exception {
- b.get("/movedPermanently")
- .run()
- .assertCode().is(301)
- .assertBody().is("Moved
Permanently").assertStringHeader("Location").is("/foo");
- }
- @Test
- public void b02_permanentRedirect() throws Exception {
- b.get("/permanentRedirect")
- .run()
- .assertCode().is(308)
- .assertBody().is("Permanent
Redirect").assertStringHeader("Location").is("/foo");
- }
- @Test
- public void b03_seeOther() throws Exception {
- b.get("/seeOther")
- .run()
- .assertCode().is(303)
- .assertBody().is("See
Other").assertStringHeader("Location").is("/foo");
- }
- @Test
- public void b04_temporaryRedirect() throws Exception {
- b.get("/temporaryRedirect")
- .run()
- .assertCode().is(307)
- .assertBody().is("Temporary
Redirect").assertStringHeader("Location").is("/foo");
- }
-
-
//-----------------------------------------------------------------------------------------------------------------
- // Overridden messages
-
//-----------------------------------------------------------------------------------------------------------------
-
- @Rest
- public static class C {
- @RestMethod public Accepted accepted() { return new
Accepted("foo"); }
- @RestMethod public AlreadyReported alreadyReported() { return
new AlreadyReported("foo"); }
- @RestMethod(path="/continue") public Continue _continue() {
return new Continue("foo"); }
- @RestMethod public Created created() { return new
Created("foo"); }
- @RestMethod public EarlyHints earlyHints() { return new
EarlyHints("foo"); }
- @RestMethod public Found found() { return new Found("foo",
null); }
- @RestMethod public IMUsed imUsed() { return new IMUsed("foo"); }
- @RestMethod public MovedPermanently movedPermanently() { return
new MovedPermanently("foo", null); }
- @RestMethod public MultipleChoices multipleChoices() { return
new MultipleChoices("foo"); }
- @RestMethod public MultiStatus multiStatus() { return new
MultiStatus("foo"); }
- @RestMethod public NoContent noContent() { return new
NoContent("foo"); }
- @RestMethod public NonAuthoritiveInformation
nonAuthoritiveInformation() { return new NonAuthoritiveInformation("foo"); }
- @RestMethod public NotModified notModified() { return new
NotModified("foo"); }
- @RestMethod public Ok ok() { return new Ok("foo"); }
- @RestMethod public PartialContent partialContent() { return new
PartialContent("foo"); }
- @RestMethod public PermanentRedirect permanentRedirect() {
return new PermanentRedirect("foo", null); }
- @RestMethod public Processing processing() { return new
Processing("foo"); }
- @RestMethod public ResetContent resetContent() { return new
ResetContent("foo"); }
- @RestMethod public SeeOther seeOther() { return new
SeeOther("foo", null); }
- @RestMethod public SwitchingProtocols switchingProtocols() {
return new SwitchingProtocols("foo"); }
- @RestMethod public TemporaryRedirect temporaryRedirect() {
return new TemporaryRedirect("foo", null); }
- @RestMethod public UseProxy useProxy() { return new
UseProxy("foo"); }
- }
-
- static MockRestClient c =
MockRestClient.createLax(C.class).disableRedirectHandling().build();
-
- @Test
- public void c01_accepted() throws Exception {
- c.get("/accepted")
- .run()
- .assertCode().is(202)
- .assertBody().is("foo");
- }
- @Test
- public void c02_alreadyReported() throws Exception {
- c.get("/alreadyReported")
- .run()
- .assertCode().is(208)
- .assertBody().is("foo");
- }
- @Test
- public void c03_continue() throws Exception {
- c.get("/continue")
- .run()
- .assertCode().is(1100)
- .assertBody().is("foo");
- }
- @Test
- public void c04_created() throws Exception {
- c.get("/created")
- .run()
- .assertCode().is(201)
- .assertBody().is("foo");
- }
- @Test
- public void c05_earlyHints() throws Exception {
- c.get("/earlyHints")
- .run()
- .assertCode().is(1103)
- .assertBody().is("foo");
- }
- @Test
- public void c06_found() throws Exception {
- c.get("/found")
- .run()
- .assertCode().is(302)
- .assertBody().is("foo");
- }
- @Test
- public void c07_imUsed() throws Exception {
- c.get("/imUsed")
- .run()
- .assertCode().is(226)
- .assertBody().is("foo");
- }
- @Test
- public void c08_movedPermanently() throws Exception {
- c.get("/movedPermanently")
- .run()
- .assertCode().is(301)
- .assertBody().is("foo");
- }
- @Test
- public void c09_multipleChoices() throws Exception {
- c.get("/multipleChoices")
- .run()
- .assertCode().is(300)
- .assertBody().is("foo");
- }
- @Test
- public void c10_multiStatus() throws Exception {
- c.get("/multiStatus")
- .run()
- .assertCode().is(207)
- .assertBody().is("foo");
- }
- @Test
- public void c11_noContent() throws Exception {
- c.get("/noContent")
- .run()
- .assertCode().is(204);
- }
- @Test
- public void c12_nonAuthoritiveInformation() throws Exception {
- c.get("/nonAuthoritiveInformation")
- .run()
- .assertCode().is(203)
- .assertBody().is("foo");
- }
- @Test
- public void c13_notModified() throws Exception {
- c.get("/notModified")
- .run()
- .assertCode().is(304);
- }
- @Test
- public void c14_ok() throws Exception {
- c.get("/ok")
- .run()
- .assertCode().is(200)
- .assertBody().is("foo");
- }
- @Test
- public void c15_partialContent() throws Exception {
- c.get("/partialContent")
- .run()
- .assertCode().is(206)
- .assertBody().is("foo");
- }
- @Test
- public void c16_permanentRedirect() throws Exception {
- c.get("/permanentRedirect")
- .run()
- .assertCode().is(308)
- .assertBody().is("foo");
- }
- @Test
- public void c17_processing() throws Exception {
- c.get("/processing")
- .run()
- .assertCode().is(1102)
- .assertBody().is("foo");
- }
- @Test
- public void c18_resetContent() throws Exception {
- c.get("/resetContent")
- .run()
- .assertCode().is(205);
- }
- @Test
- public void c19_seeOther() throws Exception {
- c.get("/seeOther")
- .run()
- .assertCode().is(303)
- .assertBody().is("foo");
- }
- @Test
- public void c20_switchingProtocols() throws Exception {
- c.get("/switchingProtocols")
- .run()
- .assertCode().is(1101)
- .assertBody().is("foo");
- }
- @Test
- public void c21_temporaryRedirect() throws Exception {
- c.get("/temporaryRedirect")
- .run()
- .assertCode().is(307)
- .assertBody().is("foo");
- }
- @Test
- public void c22_useProxy() throws Exception {
- c.get("/useProxy")
- .run()
- .assertCode().is(305)
- .assertBody().is("foo");
- }
-
-
//-----------------------------------------------------------------------------------------------------------------
- // Should use Accept language for serialization.
-
//-----------------------------------------------------------------------------------------------------------------
-
- @Rest(serializers=SimpleJsonSerializer.class)
- public static class D {
- @RestMethod public Accepted accepted() { return new
Accepted("foo"); }
- }
-
- static MockRestClient d = MockRestClient.build(D.class);
-
- @Test
- public void d01_accepted() throws Exception {
- d.get("/accepted").json()
- .run()
- .assertCode().is(202)
- .assertBody().is("'foo'");
- }
-
-
//-----------------------------------------------------------------------------------------------------------------
- // Test Swagger
-
//-----------------------------------------------------------------------------------------------------------------
-
- static Swagger e = getSwagger(A.class);
-
- @Test
- public void e01_accepted() throws Exception {
- ResponseInfo ri =
e.getPaths().get("/accepted").get("get").getResponse(Accepted.CODE);
- assertEquals(Accepted.MESSAGE, ri.getDescription());
- }
- @Test
- public void e02_alreadyReported() throws Exception {
- ResponseInfo ri =
e.getPaths().get("/alreadyReported").get("get").getResponse(AlreadyReported.CODE);
- assertEquals(AlreadyReported.MESSAGE, ri.getDescription());
- }
- @Test
- public void e03_continue() throws Exception {
- ResponseInfo ri =
e.getPaths().get("/continue").get("get").getResponse(Continue.CODE);
- assertEquals(Continue.MESSAGE, ri.getDescription());
- }
- @Test
- public void e04_created() throws Exception {
- ResponseInfo ri =
e.getPaths().get("/created").get("get").getResponse(Created.CODE);
- assertEquals(Created.MESSAGE, ri.getDescription());
- }
- @Test
- public void e05_earlyHints() throws Exception {
- ResponseInfo ri =
e.getPaths().get("/earlyHints").get("get").getResponse(EarlyHints.CODE);
- assertEquals(EarlyHints.MESSAGE, ri.getDescription());
- }
- @Test
- public void e06_found() throws Exception {
- ResponseInfo ri =
e.getPaths().get("/found").get("get").getResponse(Found.CODE);
- assertEquals(Found.MESSAGE, ri.getDescription());
- }
- @Test
- public void e07_imUsed() throws Exception {
- ResponseInfo ri =
e.getPaths().get("/imUsed").get("get").getResponse(IMUsed.CODE);
- assertEquals(IMUsed.MESSAGE, ri.getDescription());
- }
- @Test
- public void e08_movedPermanently() throws Exception {
- ResponseInfo ri =
e.getPaths().get("/movedPermanently").get("get").getResponse(MovedPermanently.CODE);
- assertEquals(MovedPermanently.MESSAGE, ri.getDescription());
- }
- @Test
- public void e09_multipleChoices() throws Exception {
- ResponseInfo ri =
e.getPaths().get("/multipleChoices").get("get").getResponse(MultipleChoices.CODE);
- assertEquals(MultipleChoices.MESSAGE, ri.getDescription());
- }
- @Test
- public void e10_multiStatus() throws Exception {
- ResponseInfo ri =
e.getPaths().get("/multiStatus").get("get").getResponse(MultiStatus.CODE);
- assertEquals(MultiStatus.MESSAGE, ri.getDescription());
- }
- @Test
- public void e11_noContent() throws Exception {
- ResponseInfo ri =
e.getPaths().get("/noContent").get("get").getResponse(NoContent.CODE);
- assertEquals(NoContent.MESSAGE, ri.getDescription());
- }
- @Test
- public void e12_nonAuthoritiveInformation() throws Exception {
- ResponseInfo ri =
e.getPaths().get("/nonAuthoritiveInformation").get("get").getResponse(NonAuthoritiveInformation.CODE);
- assertEquals(NonAuthoritiveInformation.MESSAGE,
ri.getDescription());
- }
- @Test
- public void e13_notModified() throws Exception {
- ResponseInfo ri =
e.getPaths().get("/notModified").get("get").getResponse(NotModified.CODE);
- assertEquals(NotModified.MESSAGE, ri.getDescription());
- }
- @Test
- public void e14_ok() throws Exception {
- ResponseInfo ri =
e.getPaths().get("/ok").get("get").getResponse(Ok.CODE);
- assertEquals(Ok.MESSAGE, ri.getDescription());
- }
- @Test
- public void e15_partialContent() throws Exception {
- ResponseInfo ri =
e.getPaths().get("/partialContent").get("get").getResponse(PartialContent.CODE);
- assertEquals(PartialContent.MESSAGE, ri.getDescription());
- }
- @Test
- public void e16_permanentRedirect() throws Exception {
- ResponseInfo ri =
e.getPaths().get("/permanentRedirect").get("get").getResponse(PermanentRedirect.CODE);
- assertEquals(PermanentRedirect.MESSAGE, ri.getDescription());
- }
- @Test
- public void e17_processing() throws Exception {
- ResponseInfo ri =
e.getPaths().get("/processing").get("get").getResponse(Processing.CODE);
- assertEquals(Processing.MESSAGE, ri.getDescription());
- }
- @Test
- public void e18_resetContent() throws Exception {
- ResponseInfo ri =
e.getPaths().get("/resetContent").get("get").getResponse(ResetContent.CODE);
- assertEquals(ResetContent.MESSAGE, ri.getDescription());
- }
- @Test
- public void e19_seeOther() throws Exception {
- ResponseInfo ri =
e.getPaths().get("/seeOther").get("get").getResponse(SeeOther.CODE);
- assertEquals(SeeOther.MESSAGE, ri.getDescription());
- }
- @Test
- public void e20_switchingProtocols() throws Exception {
- ResponseInfo ri =
e.getPaths().get("/switchingProtocols").get("get").getResponse(SwitchingProtocols.CODE);
- assertEquals(SwitchingProtocols.MESSAGE, ri.getDescription());
- }
- @Test
- public void e21_temporaryRedirect() throws Exception {
- ResponseInfo ri =
e.getPaths().get("/temporaryRedirect").get("get").getResponse(TemporaryRedirect.CODE);
- assertEquals(TemporaryRedirect.MESSAGE, ri.getDescription());
- }
- @Test
- public void e22_useProxy() throws Exception {
- ResponseInfo ri =
e.getPaths().get("/useProxy").get("get").getResponse(UseProxy.CODE);
- assertEquals(UseProxy.MESSAGE, ri.getDescription());
- }
-}