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/07/15 23:50:11 UTC
[juneau] branch master updated: org.apache.http.exception tests.
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 ad55732 org.apache.http.exception tests.
ad55732 is described below
commit ad5573262974d597cae8e01f34828de6f5f2482d
Author: JamesBognar <ja...@salesforce.com>
AuthorDate: Wed Jul 15 19:50:06 2020 -0400
org.apache.http.exception tests.
---
.../apache/juneau/http/exception/BadRequest.java | 3 +-
.../org/apache/juneau/http/exception/Conflict.java | 3 +-
.../juneau/http/exception/ExpectationFailed.java | 3 +-
.../juneau/http/exception/FailedDependency.java | 3 +-
.../apache/juneau/http/exception/Forbidden.java | 3 +-
.../org/apache/juneau/http/exception/Gone.java | 3 +-
.../juneau/http/exception/HttpException.java | 20 ++--
.../http/exception/HttpVersionNotSupported.java | 3 +-
.../juneau/http/exception/InsufficientStorage.java | 3 +-
.../juneau/http/exception/InternalServerError.java | 3 +-
.../juneau/http/exception/LengthRequired.java | 3 +-
.../org/apache/juneau/http/exception/Locked.java | 3 +-
.../apache/juneau/http/exception/LoopDetected.java | 3 +-
.../juneau/http/exception/MethodNotAllowed.java | 3 +-
.../juneau/http/exception/MisdirectedRequest.java | 3 +-
.../exception/NetworkAuthenticationRequired.java | 3 +-
.../juneau/http/exception/NotAcceptable.java | 3 +-
.../apache/juneau/http/exception/NotExtended.java | 3 +-
.../org/apache/juneau/http/exception/NotFound.java | 3 +-
.../juneau/http/exception/NotImplemented.java | 3 +-
.../juneau/http/exception/PayloadTooLarge.java | 3 +-
.../juneau/http/exception/PreconditionFailed.java | 3 +-
.../http/exception/PreconditionRequired.java | 3 +-
.../juneau/http/exception/RangeNotSatisfiable.java | 3 +-
.../exception/RequestHeaderFieldsTooLarge.java | 3 +-
.../juneau/http/exception/ServiceUnavailable.java | 3 +-
.../juneau/http/exception/TooManyRequests.java | 3 +-
.../apache/juneau/http/exception/Unauthorized.java | 3 +-
.../http/exception/UnavailableForLegalReasons.java | 3 +-
.../juneau/http/exception/UnprocessableEntity.java | 3 +-
.../http/exception/UnsupportedMediaType.java | 3 +-
.../juneau/http/exception/UpgradeRequired.java | 3 +-
.../apache/juneau/http/exception/UriTooLong.java | 3 +-
.../http/exception/VariantAlsoNegotiates.java | 3 +-
.../juneau/http/exception/BadRequest_Test.java | 73 ++++++++++++++
.../juneau/http/exception/Conflict_Test.java | 73 ++++++++++++++
.../http/exception/ExpectationFailed_Test.java | 73 ++++++++++++++
.../http/exception/FailedDependency_Test.java | 73 ++++++++++++++
.../juneau/http/exception/Forbidden_Test.java | 73 ++++++++++++++
.../apache/juneau/http/exception/Gone_Test.java | 73 ++++++++++++++
.../juneau/http/exception/HttpException_Test.java | 110 +++++++++++++++++++++
.../exception/HttpVersionNotSupported_Test.java | 73 ++++++++++++++
.../http/exception/InsufficentStorage_Test.java | 73 ++++++++++++++
.../http/exception/InternalServerError_Test.java | 73 ++++++++++++++
.../juneau/http/exception/LengthRequired_Test.java | 73 ++++++++++++++
.../apache/juneau/http/exception/Locked_Test.java | 73 ++++++++++++++
.../juneau/http/exception/LoopDetected_Test.java | 73 ++++++++++++++
.../http/exception/MethodNotAllowed_Test.java | 73 ++++++++++++++
.../http/exception/MisdirectedRequest_Test.java | 73 ++++++++++++++
.../NetworkAuthenticationRequired_Test.java | 73 ++++++++++++++
.../juneau/http/exception/NotAcceptable_Test.java | 73 ++++++++++++++
.../juneau/http/exception/NotExtended_Test.java | 73 ++++++++++++++
.../juneau/http/exception/NotFound_Test.java | 73 ++++++++++++++
.../juneau/http/exception/NotImplemented_Test.java | 73 ++++++++++++++
.../http/exception/PayloadTooLarge_Test.java | 73 ++++++++++++++
.../http/exception/PreconditionFailed_Test.java | 73 ++++++++++++++
.../http/exception/PreconditionRequired_Test.java | 73 ++++++++++++++
.../http/exception/RangeNotSatisfiable_Test.java | 73 ++++++++++++++
.../RequestHeaderFieldsTooLarge_Test.java | 73 ++++++++++++++
.../http/exception/ServiceUnavailable_Test.java | 73 ++++++++++++++
.../http/exception/TooManyRequests_Test.java | 73 ++++++++++++++
.../juneau/http/exception/Unauthorized_Test.java | 73 ++++++++++++++
.../exception/UnavailableForLegalReasons_Test.java | 73 ++++++++++++++
.../http/exception/UnprocessableEntity_Test.java | 73 ++++++++++++++
.../http/exception/UnsupportedMediaType_Test.java | 73 ++++++++++++++
.../http/exception/UpgradeRequired_Test.java | 73 ++++++++++++++
.../juneau/http/exception/UriTooLong_Test.java | 73 ++++++++++++++
.../http/exception/VariantAlsoNegotiates_Test.java | 73 ++++++++++++++
68 files changed, 2563 insertions(+), 75 deletions(-)
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/BadRequest.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/BadRequest.java
index f7c570c..9a7bace 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/BadRequest.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/BadRequest.java
@@ -51,8 +51,7 @@ public class BadRequest extends HttpException {
* @param msg The message. Can be <jk>null</jk>.
*/
public BadRequest(String msg) {
- super(msg);
- setStatus(CODE);
+ this((Throwable)null, msg);
}
/**
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/Conflict.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/Conflict.java
index 00e8e7e..f18c0b5 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/Conflict.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/Conflict.java
@@ -51,8 +51,7 @@ public class Conflict extends HttpException {
* @param msg The message. Can be <jk>null</jk>.
*/
public Conflict(String msg) {
- super(msg);
- setStatus(CODE);
+ this((Throwable)null, msg);
}
/**
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/ExpectationFailed.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/ExpectationFailed.java
index fe8b2a3..555bded 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/ExpectationFailed.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/ExpectationFailed.java
@@ -51,8 +51,7 @@ public class ExpectationFailed extends HttpException {
* @param msg The message. Can be <jk>null</jk>.
*/
public ExpectationFailed(String msg) {
- super(msg);
- setStatus(CODE);
+ this((Throwable)null, msg);
}
/**
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/FailedDependency.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/FailedDependency.java
index f3fa4fd..cf62a03 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/FailedDependency.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/FailedDependency.java
@@ -51,8 +51,7 @@ public class FailedDependency extends HttpException {
* @param msg The message. Can be <jk>null</jk>.
*/
public FailedDependency(String msg) {
- super(msg);
- setStatus(CODE);
+ this((Throwable)null, msg);
}
/**
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/Forbidden.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/Forbidden.java
index 16d5b95..fcdb46b 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/Forbidden.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/Forbidden.java
@@ -52,8 +52,7 @@ public class Forbidden extends HttpException {
* @param msg The message. Can be <jk>null</jk>.
*/
public Forbidden(String msg) {
- super(msg);
- setStatus(CODE);
+ this((Throwable)null, msg);
}
/**
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/Gone.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/Gone.java
index 1c87253..6a3422b 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/Gone.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/Gone.java
@@ -55,8 +55,7 @@ public class Gone extends HttpException {
* @param msg The message. Can be <jk>null</jk>.
*/
public Gone(String msg) {
- super(msg);
- setStatus(CODE);
+ this((Throwable)null, msg);
}
/**
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/HttpException.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/HttpException.java
index c4e414d..d4331d8 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/HttpException.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/HttpException.java
@@ -31,6 +31,7 @@ import org.apache.juneau.internal.*;
* REST methods on subclasses of <c>RestServlet</c> can throw this exception to trigger an HTTP status other than the
* automatically-generated <c>404</c>, <c>405</c>, and <c>500</c> statuses.
*/
+@Response
public class HttpException extends BasicRuntimeException {
private static final long serialVersionUID = 1L;
@@ -57,13 +58,7 @@ public class HttpException extends BasicRuntimeException {
* @param msg The status message.
*/
public HttpException(String msg) {
- super((Throwable)null, msg);
- }
-
- private static String message(Throwable cause, String msg, Object...args) {
- if (msg == null && cause != null)
- return firstNonEmpty(cause.getLocalizedMessage(), cause.getClass().getName());
- return format(msg, args);
+ this((Throwable)null, 0, msg);
}
/**
@@ -101,9 +96,9 @@ public class HttpException extends BasicRuntimeException {
public Throwable getRootCause() {
Throwable t = this;
while(t != null) {
- t = t.getCause();
if (! (t instanceof HttpException || t instanceof InvocationTargetException))
return t;
+ t = t.getCause();
}
return null;
}
@@ -160,7 +155,7 @@ public class HttpException extends BasicRuntimeException {
* @param status The status code.
* @return This object (for method chaining).
*/
- protected HttpException setStatus(int status) {
+ public HttpException setStatus(int status) {
this.status = status;
return this;
}
@@ -170,6 +165,7 @@ public class HttpException extends BasicRuntimeException {
*
* @return The HTTP status code.
*/
+ @ResponseStatus
public int getStatus() {
return status;
}
@@ -198,6 +194,12 @@ public class HttpException extends BasicRuntimeException {
return headers;
}
+ private static String message(Throwable cause, String msg, Object...args) {
+ if (msg == null && cause != null)
+ return firstNonEmpty(cause.getLocalizedMessage(), cause.getClass().getName());
+ return format(msg, args);
+ }
+
// When serialized, just serialize the message itself.
@Override /* Object */
public String toString() {
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/HttpVersionNotSupported.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/HttpVersionNotSupported.java
index a2bd358..1fd16b8 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/HttpVersionNotSupported.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/HttpVersionNotSupported.java
@@ -51,8 +51,7 @@ public class HttpVersionNotSupported extends HttpException {
* @param msg The message. Can be <jk>null</jk>.
*/
public HttpVersionNotSupported(String msg) {
- super(msg);
- setStatus(CODE);
+ this((Throwable)null, msg);
}
/**
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/InsufficientStorage.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/InsufficientStorage.java
index e01f723..a8f4490 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/InsufficientStorage.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/InsufficientStorage.java
@@ -51,8 +51,7 @@ public class InsufficientStorage extends HttpException {
* @param msg The message. Can be <jk>null</jk>.
*/
public InsufficientStorage(String msg) {
- super(msg);
- setStatus(CODE);
+ this((Throwable)null, msg);
}
/**
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/InternalServerError.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/InternalServerError.java
index 4659883..689600f 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/InternalServerError.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/InternalServerError.java
@@ -51,8 +51,7 @@ public class InternalServerError extends HttpException {
* @param msg The message. Can be <jk>null</jk>.
*/
public InternalServerError(String msg) {
- super(msg);
- setStatus(CODE);
+ this((Throwable)null, msg);
}
/**
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/LengthRequired.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/LengthRequired.java
index 89759e1..8174db2 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/LengthRequired.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/LengthRequired.java
@@ -51,8 +51,7 @@ public class LengthRequired extends HttpException {
* @param msg The message. Can be <jk>null</jk>.
*/
public LengthRequired(String msg) {
- super(msg);
- setStatus(CODE);
+ this((Throwable)null, msg);
}
/**
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/Locked.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/Locked.java
index 1185c45..a3a1df2 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/Locked.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/Locked.java
@@ -51,8 +51,7 @@ public class Locked extends HttpException {
* @param msg The message. Can be <jk>null</jk>.
*/
public Locked(String msg) {
- super(msg);
- setStatus(CODE);
+ this((Throwable)null, msg);
}
/**
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/LoopDetected.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/LoopDetected.java
index bd0fc7d..2cb3263 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/LoopDetected.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/LoopDetected.java
@@ -51,8 +51,7 @@ public class LoopDetected extends HttpException {
* @param msg The message. Can be <jk>null</jk>.
*/
public LoopDetected(String msg) {
- super(msg);
- setStatus(CODE);
+ this((Throwable)null, msg);
}
/**
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/MethodNotAllowed.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/MethodNotAllowed.java
index 824ea75..e628484 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/MethodNotAllowed.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/MethodNotAllowed.java
@@ -51,8 +51,7 @@ public class MethodNotAllowed extends HttpException {
* @param msg The message. Can be <jk>null</jk>.
*/
public MethodNotAllowed(String msg) {
- super(msg);
- setStatus(CODE);
+ this((Throwable)null, msg);
}
/**
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/MisdirectedRequest.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/MisdirectedRequest.java
index bb6ec33..f1b2077 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/MisdirectedRequest.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/MisdirectedRequest.java
@@ -51,8 +51,7 @@ public class MisdirectedRequest extends HttpException {
* @param msg The message. Can be <jk>null</jk>.
*/
public MisdirectedRequest(String msg) {
- super(msg);
- setStatus(CODE);
+ this((Throwable)null, msg);
}
/**
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/NetworkAuthenticationRequired.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/NetworkAuthenticationRequired.java
index 6aa568c..4656cb1 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/NetworkAuthenticationRequired.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/NetworkAuthenticationRequired.java
@@ -52,8 +52,7 @@ public class NetworkAuthenticationRequired extends HttpException {
* @param msg The message. Can be <jk>null</jk>.
*/
public NetworkAuthenticationRequired(String msg) {
- super(msg);
- setStatus(CODE);
+ this((Throwable)null, msg);
}
/**
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/NotAcceptable.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/NotAcceptable.java
index 9aff129..8873f2f 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/NotAcceptable.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/NotAcceptable.java
@@ -51,8 +51,7 @@ public class NotAcceptable extends HttpException {
* @param msg The message. Can be <jk>null</jk>.
*/
public NotAcceptable(String msg) {
- super(msg);
- setStatus(CODE);
+ this((Throwable)null, msg);
}
/**
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/NotExtended.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/NotExtended.java
index 7ea74b1..70eaba0 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/NotExtended.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/NotExtended.java
@@ -51,8 +51,7 @@ public class NotExtended extends HttpException {
* @param msg The message. Can be <jk>null</jk>.
*/
public NotExtended(String msg) {
- super(msg);
- setStatus(CODE);
+ this((Throwable)null, msg);
}
/**
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/NotFound.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/NotFound.java
index 5bb0652..f8b223c 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/NotFound.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/NotFound.java
@@ -52,8 +52,7 @@ public class NotFound extends HttpException {
* @param msg The message. Can be <jk>null</jk>.
*/
public NotFound(String msg) {
- super(msg);
- setStatus(CODE);
+ this((Throwable)null, msg);
}
/**
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/NotImplemented.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/NotImplemented.java
index fae05fc..707adda 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/NotImplemented.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/NotImplemented.java
@@ -52,8 +52,7 @@ public class NotImplemented extends HttpException {
* @param msg The message. Can be <jk>null</jk>.
*/
public NotImplemented(String msg) {
- super(msg);
- setStatus(CODE);
+ this((Throwable)null, msg);
}
/**
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/PayloadTooLarge.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/PayloadTooLarge.java
index cd59237..4d182ce 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/PayloadTooLarge.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/PayloadTooLarge.java
@@ -51,8 +51,7 @@ public class PayloadTooLarge extends HttpException {
* @param msg The message. Can be <jk>null</jk>.
*/
public PayloadTooLarge(String msg) {
- super(msg);
- setStatus(CODE);
+ this((Throwable)null, msg);
}
/**
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/PreconditionFailed.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/PreconditionFailed.java
index f400dfe..d9a4b81 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/PreconditionFailed.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/PreconditionFailed.java
@@ -58,8 +58,7 @@ public class PreconditionFailed extends HttpException {
* @param msg The message. Can be <jk>null</jk>.
*/
public PreconditionFailed(String msg) {
- super(msg);
- setStatus(CODE);
+ this((Throwable)null, msg);
}
/**
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/PreconditionRequired.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/PreconditionRequired.java
index 3ec4228..ce99f67 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/PreconditionRequired.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/PreconditionRequired.java
@@ -52,8 +52,7 @@ public class PreconditionRequired extends HttpException {
* @param msg The message. Can be <jk>null</jk>.
*/
public PreconditionRequired(String msg) {
- super(msg);
- setStatus(CODE);
+ this((Throwable)null, msg);
}
/**
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/RangeNotSatisfiable.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/RangeNotSatisfiable.java
index 268ff8a..df13331 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/RangeNotSatisfiable.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/RangeNotSatisfiable.java
@@ -52,8 +52,7 @@ public class RangeNotSatisfiable extends HttpException {
* @param msg The message. Can be <jk>null</jk>.
*/
public RangeNotSatisfiable(String msg) {
- super(msg);
- setStatus(CODE);
+ this((Throwable)null, msg);
}
/**
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/RequestHeaderFieldsTooLarge.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/RequestHeaderFieldsTooLarge.java
index 4afff8e..0d35d60 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/RequestHeaderFieldsTooLarge.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/RequestHeaderFieldsTooLarge.java
@@ -51,8 +51,7 @@ public class RequestHeaderFieldsTooLarge extends HttpException {
* @param msg The message. Can be <jk>null</jk>.
*/
public RequestHeaderFieldsTooLarge(String msg) {
- super(msg);
- setStatus(CODE);
+ this((Throwable)null, msg);
}
/**
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/ServiceUnavailable.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/ServiceUnavailable.java
index 9aea30a..e267776 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/ServiceUnavailable.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/ServiceUnavailable.java
@@ -52,8 +52,7 @@ public class ServiceUnavailable extends HttpException {
* @param msg The message. Can be <jk>null</jk>.
*/
public ServiceUnavailable(String msg) {
- super(msg);
- setStatus(CODE);
+ this((Throwable)null, msg);
}
/**
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/TooManyRequests.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/TooManyRequests.java
index 298bdb2..b57bfe8 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/TooManyRequests.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/TooManyRequests.java
@@ -52,8 +52,7 @@ public class TooManyRequests extends HttpException {
* @param msg The message. Can be <jk>null</jk>.
*/
public TooManyRequests(String msg) {
- super(msg);
- setStatus(CODE);
+ this((Throwable)null, msg);
}
/**
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/Unauthorized.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/Unauthorized.java
index 4a59b9b..effbd0e 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/Unauthorized.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/Unauthorized.java
@@ -54,8 +54,7 @@ public class Unauthorized extends HttpException {
* @param msg The message. Can be <jk>null</jk>.
*/
public Unauthorized(String msg) {
- super(msg);
- setStatus(CODE);
+ this((Throwable)null, msg);
}
/**
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/UnavailableForLegalReasons.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/UnavailableForLegalReasons.java
index 42899e0..a745633 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/UnavailableForLegalReasons.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/UnavailableForLegalReasons.java
@@ -51,8 +51,7 @@ public class UnavailableForLegalReasons extends HttpException {
* @param msg The message. Can be <jk>null</jk>.
*/
public UnavailableForLegalReasons(String msg) {
- super(msg);
- setStatus(CODE);
+ this((Throwable)null, msg);
}
/**
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/UnprocessableEntity.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/UnprocessableEntity.java
index f9ebdb3..f109dc8 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/UnprocessableEntity.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/UnprocessableEntity.java
@@ -51,8 +51,7 @@ public class UnprocessableEntity extends HttpException {
* @param msg The message. Can be <jk>null</jk>.
*/
public UnprocessableEntity(String msg) {
- super(msg);
- setStatus(CODE);
+ this((Throwable)null, msg);
}
/**
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/UnsupportedMediaType.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/UnsupportedMediaType.java
index 1f20cf2..d653eae 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/UnsupportedMediaType.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/UnsupportedMediaType.java
@@ -52,8 +52,7 @@ public class UnsupportedMediaType extends HttpException {
* @param msg The message. Can be <jk>null</jk>.
*/
public UnsupportedMediaType(String msg) {
- super(msg);
- setStatus(CODE);
+ this((Throwable)null, msg);
}
/**
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/UpgradeRequired.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/UpgradeRequired.java
index 6585ed6..51c1cdc 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/UpgradeRequired.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/UpgradeRequired.java
@@ -51,8 +51,7 @@ public class UpgradeRequired extends HttpException {
* @param msg The message. Can be <jk>null</jk>.
*/
public UpgradeRequired(String msg) {
- super(msg);
- setStatus(CODE);
+ this((Throwable)null, msg);
}
/**
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/UriTooLong.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/UriTooLong.java
index 2646d0a..0e1838c 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/UriTooLong.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/UriTooLong.java
@@ -52,8 +52,7 @@ public class UriTooLong extends HttpException {
* @param msg The message. Can be <jk>null</jk>.
*/
public UriTooLong(String msg) {
- super(msg);
- setStatus(CODE);
+ this((Throwable)null, msg);
}
/**
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/VariantAlsoNegotiates.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/VariantAlsoNegotiates.java
index bb6cf44..76a2b24 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/VariantAlsoNegotiates.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/exception/VariantAlsoNegotiates.java
@@ -51,8 +51,7 @@ public class VariantAlsoNegotiates extends HttpException {
* @param msg The message. Can be <jk>null</jk>.
*/
public VariantAlsoNegotiates(String msg) {
- super(msg);
- setStatus(CODE);
+ this((Throwable)null, msg);
}
/**
diff --git a/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/BadRequest_Test.java b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/BadRequest_Test.java
new file mode 100644
index 0000000..1c5b6e9
--- /dev/null
+++ b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/BadRequest_Test.java
@@ -0,0 +1,73 @@
+// ***************************************************************************************************************************
+// * 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.exception;
+
+import static org.junit.runners.MethodSorters.*;
+
+import org.apache.juneau.rest.annotation.*;
+import org.apache.juneau.rest.client2.*;
+import org.apache.juneau.rest.mock2.*;
+import org.junit.*;
+
+@FixMethodOrder(NAME_ASCENDING)
+public class BadRequest_Test {
+
+ private static final int CODE = BadRequest.CODE;
+ private static final String MESSAGE = BadRequest.MESSAGE;
+
+ @Rest
+ public static class A {
+ @RestMethod
+ public void getF1() throws BadRequest {
+ throw new BadRequest();
+ }
+ @RestMethod
+ public void getF2() throws BadRequest {
+ throw new BadRequest("foo {0}", "bar");
+ }
+ @RestMethod
+ public void getF3() throws BadRequest {
+ throw new BadRequest(new RuntimeException("baz"));
+ }
+ @RestMethod
+ public void getF4() throws BadRequest {
+ throw new BadRequest(new RuntimeException("baz"), "foo {0}", "bar");
+ }
+ @RestMethod
+ public void getF5() throws BadRequest {
+ throw new BadRequest().header("Foo", "bar");
+ }
+ }
+
+ @Test
+ public void a01_basic() throws Exception {
+ RestClient c = MockRestClient.create(A.class).ignoreErrors().build();
+
+ c.get("/f1").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is(MESSAGE);
+ c.get("/f2").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("foo bar");
+ c.get("/f3").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("baz");
+ c.get("/f4").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("foo bar");
+ c.get("/f5").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is(MESSAGE)
+ .assertHeader("Foo").is("bar");
+ }
+}
diff --git a/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/Conflict_Test.java b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/Conflict_Test.java
new file mode 100644
index 0000000..b5a2130
--- /dev/null
+++ b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/Conflict_Test.java
@@ -0,0 +1,73 @@
+// ***************************************************************************************************************************
+// * 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.exception;
+
+import static org.junit.runners.MethodSorters.*;
+
+import org.apache.juneau.rest.annotation.*;
+import org.apache.juneau.rest.client2.*;
+import org.apache.juneau.rest.mock2.*;
+import org.junit.*;
+
+@FixMethodOrder(NAME_ASCENDING)
+public class Conflict_Test {
+
+ private static final int CODE = Conflict.CODE;
+ private static final String MESSAGE = Conflict.MESSAGE;
+
+ @Rest
+ public static class A {
+ @RestMethod
+ public void getF1() throws Conflict {
+ throw new Conflict();
+ }
+ @RestMethod
+ public void getF2() throws Conflict {
+ throw new Conflict("foo {0}", "bar");
+ }
+ @RestMethod
+ public void getF3() throws Conflict {
+ throw new Conflict(new RuntimeException("baz"));
+ }
+ @RestMethod
+ public void getF4() throws Conflict {
+ throw new Conflict(new RuntimeException("baz"), "foo {0}", "bar");
+ }
+ @RestMethod
+ public void getF5() throws Conflict {
+ throw new Conflict().header("Foo", "bar");
+ }
+ }
+
+ @Test
+ public void a01_basic() throws Exception {
+ RestClient c = MockRestClient.create(A.class).ignoreErrors().build();
+
+ c.get("/f1").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is(MESSAGE);
+ c.get("/f2").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("foo bar");
+ c.get("/f3").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("baz");
+ c.get("/f4").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("foo bar");
+ c.get("/f5").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is(MESSAGE)
+ .assertHeader("Foo").is("bar");
+ }
+}
diff --git a/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/ExpectationFailed_Test.java b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/ExpectationFailed_Test.java
new file mode 100644
index 0000000..4dd1470
--- /dev/null
+++ b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/ExpectationFailed_Test.java
@@ -0,0 +1,73 @@
+// ***************************************************************************************************************************
+// * 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.exception;
+
+import static org.junit.runners.MethodSorters.*;
+
+import org.apache.juneau.rest.annotation.*;
+import org.apache.juneau.rest.client2.*;
+import org.apache.juneau.rest.mock2.*;
+import org.junit.*;
+
+@FixMethodOrder(NAME_ASCENDING)
+public class ExpectationFailed_Test {
+
+ private static final int CODE = ExpectationFailed.CODE;
+ private static final String MESSAGE = ExpectationFailed.MESSAGE;
+
+ @Rest
+ public static class A {
+ @RestMethod
+ public void getF1() throws ExpectationFailed {
+ throw new ExpectationFailed();
+ }
+ @RestMethod
+ public void getF2() throws ExpectationFailed {
+ throw new ExpectationFailed("foo {0}", "bar");
+ }
+ @RestMethod
+ public void getF3() throws ExpectationFailed {
+ throw new ExpectationFailed(new RuntimeException("baz"));
+ }
+ @RestMethod
+ public void getF4() throws ExpectationFailed {
+ throw new ExpectationFailed(new RuntimeException("baz"), "foo {0}", "bar");
+ }
+ @RestMethod
+ public void getF5() throws ExpectationFailed {
+ throw new ExpectationFailed().header("Foo", "bar");
+ }
+ }
+
+ @Test
+ public void a01_basic() throws Exception {
+ RestClient c = MockRestClient.create(A.class).ignoreErrors().build();
+
+ c.get("/f1").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is(MESSAGE);
+ c.get("/f2").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("foo bar");
+ c.get("/f3").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("baz");
+ c.get("/f4").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("foo bar");
+ c.get("/f5").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is(MESSAGE)
+ .assertHeader("Foo").is("bar");
+ }
+}
diff --git a/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/FailedDependency_Test.java b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/FailedDependency_Test.java
new file mode 100644
index 0000000..56ef289
--- /dev/null
+++ b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/FailedDependency_Test.java
@@ -0,0 +1,73 @@
+// ***************************************************************************************************************************
+// * 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.exception;
+
+import static org.junit.runners.MethodSorters.*;
+
+import org.apache.juneau.rest.annotation.*;
+import org.apache.juneau.rest.client2.*;
+import org.apache.juneau.rest.mock2.*;
+import org.junit.*;
+
+@FixMethodOrder(NAME_ASCENDING)
+public class FailedDependency_Test {
+
+ private static final int CODE = FailedDependency.CODE;
+ private static final String MESSAGE = FailedDependency.MESSAGE;
+
+ @Rest
+ public static class A {
+ @RestMethod
+ public void getF1() throws FailedDependency {
+ throw new FailedDependency();
+ }
+ @RestMethod
+ public void getF2() throws FailedDependency {
+ throw new FailedDependency("foo {0}", "bar");
+ }
+ @RestMethod
+ public void getF3() throws FailedDependency {
+ throw new FailedDependency(new RuntimeException("baz"));
+ }
+ @RestMethod
+ public void getF4() throws FailedDependency {
+ throw new FailedDependency(new RuntimeException("baz"), "foo {0}", "bar");
+ }
+ @RestMethod
+ public void getF5() throws FailedDependency {
+ throw new FailedDependency().header("Foo", "bar");
+ }
+ }
+
+ @Test
+ public void a01_basic() throws Exception {
+ RestClient c = MockRestClient.create(A.class).ignoreErrors().build();
+
+ c.get("/f1").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is(MESSAGE);
+ c.get("/f2").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("foo bar");
+ c.get("/f3").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("baz");
+ c.get("/f4").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("foo bar");
+ c.get("/f5").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is(MESSAGE)
+ .assertHeader("Foo").is("bar");
+ }
+}
diff --git a/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/Forbidden_Test.java b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/Forbidden_Test.java
new file mode 100644
index 0000000..575e7f6
--- /dev/null
+++ b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/Forbidden_Test.java
@@ -0,0 +1,73 @@
+// ***************************************************************************************************************************
+// * 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.exception;
+
+import static org.junit.runners.MethodSorters.*;
+
+import org.apache.juneau.rest.annotation.*;
+import org.apache.juneau.rest.client2.*;
+import org.apache.juneau.rest.mock2.*;
+import org.junit.*;
+
+@FixMethodOrder(NAME_ASCENDING)
+public class Forbidden_Test {
+
+ private static final int CODE = Forbidden.CODE;
+ private static final String MESSAGE = Forbidden.MESSAGE;
+
+ @Rest
+ public static class A {
+ @RestMethod
+ public void getF1() throws Forbidden {
+ throw new Forbidden();
+ }
+ @RestMethod
+ public void getF2() throws Forbidden {
+ throw new Forbidden("foo {0}", "bar");
+ }
+ @RestMethod
+ public void getF3() throws Forbidden {
+ throw new Forbidden(new RuntimeException("baz"));
+ }
+ @RestMethod
+ public void getF4() throws Forbidden {
+ throw new Forbidden(new RuntimeException("baz"), "foo {0}", "bar");
+ }
+ @RestMethod
+ public void getF5() throws Forbidden {
+ throw new Forbidden().header("Foo", "bar");
+ }
+ }
+
+ @Test
+ public void a01_basic() throws Exception {
+ RestClient c = MockRestClient.create(A.class).ignoreErrors().build();
+
+ c.get("/f1").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is(MESSAGE);
+ c.get("/f2").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("foo bar");
+ c.get("/f3").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("baz");
+ c.get("/f4").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("foo bar");
+ c.get("/f5").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is(MESSAGE)
+ .assertHeader("Foo").is("bar");
+ }
+}
diff --git a/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/Gone_Test.java b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/Gone_Test.java
new file mode 100644
index 0000000..cf7aa3e
--- /dev/null
+++ b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/Gone_Test.java
@@ -0,0 +1,73 @@
+// ***************************************************************************************************************************
+// * 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.exception;
+
+import static org.junit.runners.MethodSorters.*;
+
+import org.apache.juneau.rest.annotation.*;
+import org.apache.juneau.rest.client2.*;
+import org.apache.juneau.rest.mock2.*;
+import org.junit.*;
+
+@FixMethodOrder(NAME_ASCENDING)
+public class Gone_Test {
+
+ private static final int CODE = Gone.CODE;
+ private static final String MESSAGE = Gone.MESSAGE;
+
+ @Rest
+ public static class A {
+ @RestMethod
+ public void getF1() throws Gone {
+ throw new Gone();
+ }
+ @RestMethod
+ public void getF2() throws Gone {
+ throw new Gone("foo {0}", "bar");
+ }
+ @RestMethod
+ public void getF3() throws Gone {
+ throw new Gone(new RuntimeException("baz"));
+ }
+ @RestMethod
+ public void getF4() throws Gone {
+ throw new Gone(new RuntimeException("baz"), "foo {0}", "bar");
+ }
+ @RestMethod
+ public void getF5() throws Gone {
+ throw new Gone().header("Foo", "bar");
+ }
+ }
+
+ @Test
+ public void a01_basic() throws Exception {
+ RestClient c = MockRestClient.create(A.class).ignoreErrors().build();
+
+ c.get("/f1").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is(MESSAGE);
+ c.get("/f2").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("foo bar");
+ c.get("/f3").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("baz");
+ c.get("/f4").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("foo bar");
+ c.get("/f5").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is(MESSAGE)
+ .assertHeader("Foo").is("bar");
+ }
+}
diff --git a/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/HttpException_Test.java b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/HttpException_Test.java
new file mode 100644
index 0000000..0326dd4
--- /dev/null
+++ b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/HttpException_Test.java
@@ -0,0 +1,110 @@
+// ***************************************************************************************************************************
+// * 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.exception;
+
+import static org.apache.juneau.assertions.Assertions.*;
+import static org.junit.runners.MethodSorters.*;
+
+import java.lang.reflect.*;
+
+import org.apache.juneau.rest.annotation.*;
+import org.apache.juneau.rest.client2.*;
+import org.apache.juneau.rest.mock2.*;
+import org.junit.*;
+
+@FixMethodOrder(NAME_ASCENDING)
+public class HttpException_Test {
+
+ @Rest
+ public static class A {
+ @RestMethod
+ public void getF1() throws HttpException {
+ throw new HttpException(new RuntimeException("foo"), 225, "bar {0}", "baz");
+ }
+ @RestMethod
+ public void getF2() throws HttpException {
+ throw new HttpException("foo").setStatus(225);
+ }
+ @RestMethod
+ public void getF3() throws HttpException {
+ throw new HttpException(new RuntimeException("baz"), 225);
+ }
+ @RestMethod
+ public void getF4() throws HttpException {
+ throw new HttpException(225, "bar {0}", "baz");
+ }
+ @RestMethod
+ public void getF5() throws HttpException {
+ throw new HttpException(null).setStatus(225).header("Foo", "bar");
+ }
+ }
+
+ @Test
+ public void a01_basic() throws Exception {
+ RestClient c = MockRestClient.create(A.class).ignoreErrors().build();
+
+ c.get("/f1").run()
+ .assertStatus().code().is(225)
+ .assertBody().is("bar baz");
+ c.get("/f2").run()
+ .assertStatus().code().is(225)
+ .assertBody().is("foo");
+ c.get("/f3").run()
+ .assertStatus().code().is(225)
+ .assertBody().is("baz");
+ c.get("/f4").run()
+ .assertStatus().code().is(225)
+ .assertBody().is("bar baz");
+ c.get("/f5").run()
+ .assertStatus().code().is(225)
+ .assertBody().is("")
+ .assertHeader("Foo").is("bar");
+ }
+
+ @Test
+ public void a02_getRootCause() throws Exception {
+ HttpException x = new HttpException(null);
+ assertObject(x.getRootCause()).doesNotExist();
+
+ x = new HttpException(new HttpException(100,"foo"),100);
+ assertObject(x.getRootCause()).doesNotExist();
+
+ x = new HttpException(new RuntimeException("foo"),100);
+ assertObject(x.getRootCause()).isType(RuntimeException.class);
+
+ x = new HttpException(new HttpException(new RuntimeException("foo"),100),100);
+ assertObject(x.getRootCause()).isType(RuntimeException.class);
+
+ x = new HttpException(new InvocationTargetException(new RuntimeException("foo")),100);
+ assertObject(x.getRootCause()).isType(RuntimeException.class);
+ }
+
+ @Test
+ public void a03_getFullStackMessage() throws Exception {
+ HttpException x = new HttpException(null);
+ assertString(x.getFullStackMessage(false)).is("");
+ assertString(x.getFullStackMessage(true)).is("");
+
+ x = new HttpException("foo<bar>&baz");
+ assertString(x.getFullStackMessage(false)).is("foo<bar>&baz");
+ assertString(x.getFullStackMessage(true)).is("foo bar baz");
+
+ x = new HttpException(new RuntimeException("foo<bar>&qux"), 100, "foo{0}","<bar>&baz");
+ assertString(x.getFullStackMessage(false)).is("foo<bar>&baz\nCaused by (RuntimeException): foo<bar>&qux");
+ assertString(x.getFullStackMessage(true)).is("foo bar baz\nCaused by (RuntimeException): foo bar qux");
+
+ x = new HttpException(new RuntimeException(), 100, "foo{0}","<bar>&baz");
+ assertString(x.getFullStackMessage(false)).is("foo<bar>&baz\nCaused by (RuntimeException)");
+ assertString(x.getFullStackMessage(true)).is("foo bar baz\nCaused by (RuntimeException)");
+ }
+}
diff --git a/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/HttpVersionNotSupported_Test.java b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/HttpVersionNotSupported_Test.java
new file mode 100644
index 0000000..8396dfb
--- /dev/null
+++ b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/HttpVersionNotSupported_Test.java
@@ -0,0 +1,73 @@
+// ***************************************************************************************************************************
+// * 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.exception;
+
+import static org.junit.runners.MethodSorters.*;
+
+import org.apache.juneau.rest.annotation.*;
+import org.apache.juneau.rest.client2.*;
+import org.apache.juneau.rest.mock2.*;
+import org.junit.*;
+
+@FixMethodOrder(NAME_ASCENDING)
+public class HttpVersionNotSupported_Test {
+
+ private static final int CODE = HttpVersionNotSupported.CODE;
+ private static final String MESSAGE = HttpVersionNotSupported.MESSAGE;
+
+ @Rest
+ public static class A {
+ @RestMethod
+ public void getF1() throws HttpVersionNotSupported {
+ throw new HttpVersionNotSupported();
+ }
+ @RestMethod
+ public void getF2() throws HttpVersionNotSupported {
+ throw new HttpVersionNotSupported("foo {0}", "bar");
+ }
+ @RestMethod
+ public void getF3() throws HttpVersionNotSupported {
+ throw new HttpVersionNotSupported(new RuntimeException("baz"));
+ }
+ @RestMethod
+ public void getF4() throws HttpVersionNotSupported {
+ throw new HttpVersionNotSupported(new RuntimeException("baz"), "foo {0}", "bar");
+ }
+ @RestMethod
+ public void getF5() throws HttpVersionNotSupported {
+ throw new HttpVersionNotSupported().header("Foo", "bar");
+ }
+ }
+
+ @Test
+ public void a01_basic() throws Exception {
+ RestClient c = MockRestClient.create(A.class).ignoreErrors().build();
+
+ c.get("/f1").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is(MESSAGE);
+ c.get("/f2").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("foo bar");
+ c.get("/f3").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("baz");
+ c.get("/f4").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("foo bar");
+ c.get("/f5").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is(MESSAGE)
+ .assertHeader("Foo").is("bar");
+ }
+}
diff --git a/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/InsufficentStorage_Test.java b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/InsufficentStorage_Test.java
new file mode 100644
index 0000000..d605c37
--- /dev/null
+++ b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/InsufficentStorage_Test.java
@@ -0,0 +1,73 @@
+// ***************************************************************************************************************************
+// * 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.exception;
+
+import static org.junit.runners.MethodSorters.*;
+
+import org.apache.juneau.rest.annotation.*;
+import org.apache.juneau.rest.client2.*;
+import org.apache.juneau.rest.mock2.*;
+import org.junit.*;
+
+@FixMethodOrder(NAME_ASCENDING)
+public class InsufficentStorage_Test {
+
+ private static final int CODE = InsufficientStorage.CODE;
+ private static final String MESSAGE = InsufficientStorage.MESSAGE;
+
+ @Rest
+ public static class A {
+ @RestMethod
+ public void getF1() throws InsufficientStorage {
+ throw new InsufficientStorage();
+ }
+ @RestMethod
+ public void getF2() throws InsufficientStorage {
+ throw new InsufficientStorage("foo {0}", "bar");
+ }
+ @RestMethod
+ public void getF3() throws InsufficientStorage {
+ throw new InsufficientStorage(new RuntimeException("baz"));
+ }
+ @RestMethod
+ public void getF4() throws InsufficientStorage {
+ throw new InsufficientStorage(new RuntimeException("baz"), "foo {0}", "bar");
+ }
+ @RestMethod
+ public void getF5() throws InsufficientStorage {
+ throw new InsufficientStorage().header("Foo", "bar");
+ }
+ }
+
+ @Test
+ public void a01_basic() throws Exception {
+ RestClient c = MockRestClient.create(A.class).ignoreErrors().build();
+
+ c.get("/f1").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is(MESSAGE);
+ c.get("/f2").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("foo bar");
+ c.get("/f3").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("baz");
+ c.get("/f4").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("foo bar");
+ c.get("/f5").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is(MESSAGE)
+ .assertHeader("Foo").is("bar");
+ }
+}
diff --git a/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/InternalServerError_Test.java b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/InternalServerError_Test.java
new file mode 100644
index 0000000..027abe6
--- /dev/null
+++ b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/InternalServerError_Test.java
@@ -0,0 +1,73 @@
+// ***************************************************************************************************************************
+// * 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.exception;
+
+import static org.junit.runners.MethodSorters.*;
+
+import org.apache.juneau.rest.annotation.*;
+import org.apache.juneau.rest.client2.*;
+import org.apache.juneau.rest.mock2.*;
+import org.junit.*;
+
+@FixMethodOrder(NAME_ASCENDING)
+public class InternalServerError_Test {
+
+ private static final int CODE = InternalServerError.CODE;
+ private static final String MESSAGE = InternalServerError.MESSAGE;
+
+ @Rest
+ public static class A {
+ @RestMethod
+ public void getF1() throws InternalServerError {
+ throw new InternalServerError();
+ }
+ @RestMethod
+ public void getF2() throws InternalServerError {
+ throw new InternalServerError("foo {0}", "bar");
+ }
+ @RestMethod
+ public void getF3() throws InternalServerError {
+ throw new InternalServerError(new RuntimeException("baz"));
+ }
+ @RestMethod
+ public void getF4() throws InternalServerError {
+ throw new InternalServerError(new RuntimeException("baz"), "foo {0}", "bar");
+ }
+ @RestMethod
+ public void getF5() throws InternalServerError {
+ throw new InternalServerError().header("Foo", "bar");
+ }
+ }
+
+ @Test
+ public void a01_basic() throws Exception {
+ RestClient c = MockRestClient.create(A.class).ignoreErrors().build();
+
+ c.get("/f1").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is(MESSAGE);
+ c.get("/f2").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("foo bar");
+ c.get("/f3").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("baz");
+ c.get("/f4").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("foo bar");
+ c.get("/f5").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is(MESSAGE)
+ .assertHeader("Foo").is("bar");
+ }
+}
diff --git a/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/LengthRequired_Test.java b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/LengthRequired_Test.java
new file mode 100644
index 0000000..0d9434e
--- /dev/null
+++ b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/LengthRequired_Test.java
@@ -0,0 +1,73 @@
+// ***************************************************************************************************************************
+// * 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.exception;
+
+import static org.junit.runners.MethodSorters.*;
+
+import org.apache.juneau.rest.annotation.*;
+import org.apache.juneau.rest.client2.*;
+import org.apache.juneau.rest.mock2.*;
+import org.junit.*;
+
+@FixMethodOrder(NAME_ASCENDING)
+public class LengthRequired_Test {
+
+ private static final int CODE = LengthRequired.CODE;
+ private static final String MESSAGE = LengthRequired.MESSAGE;
+
+ @Rest
+ public static class A {
+ @RestMethod
+ public void getF1() throws LengthRequired {
+ throw new LengthRequired();
+ }
+ @RestMethod
+ public void getF2() throws LengthRequired {
+ throw new LengthRequired("foo {0}", "bar");
+ }
+ @RestMethod
+ public void getF3() throws LengthRequired {
+ throw new LengthRequired(new RuntimeException("baz"));
+ }
+ @RestMethod
+ public void getF4() throws LengthRequired {
+ throw new LengthRequired(new RuntimeException("baz"), "foo {0}", "bar");
+ }
+ @RestMethod
+ public void getF5() throws LengthRequired {
+ throw new LengthRequired().header("Foo", "bar");
+ }
+ }
+
+ @Test
+ public void a01_basic() throws Exception {
+ RestClient c = MockRestClient.create(A.class).ignoreErrors().build();
+
+ c.get("/f1").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is(MESSAGE);
+ c.get("/f2").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("foo bar");
+ c.get("/f3").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("baz");
+ c.get("/f4").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("foo bar");
+ c.get("/f5").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is(MESSAGE)
+ .assertHeader("Foo").is("bar");
+ }
+}
diff --git a/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/Locked_Test.java b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/Locked_Test.java
new file mode 100644
index 0000000..65e3860
--- /dev/null
+++ b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/Locked_Test.java
@@ -0,0 +1,73 @@
+// ***************************************************************************************************************************
+// * 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.exception;
+
+import static org.junit.runners.MethodSorters.*;
+
+import org.apache.juneau.rest.annotation.*;
+import org.apache.juneau.rest.client2.*;
+import org.apache.juneau.rest.mock2.*;
+import org.junit.*;
+
+@FixMethodOrder(NAME_ASCENDING)
+public class Locked_Test {
+
+ private static final int CODE = Locked.CODE;
+ private static final String MESSAGE = Locked.MESSAGE;
+
+ @Rest
+ public static class A {
+ @RestMethod
+ public void getF1() throws Locked {
+ throw new Locked();
+ }
+ @RestMethod
+ public void getF2() throws Locked {
+ throw new Locked("foo {0}", "bar");
+ }
+ @RestMethod
+ public void getF3() throws Locked {
+ throw new Locked(new RuntimeException("baz"));
+ }
+ @RestMethod
+ public void getF4() throws Locked {
+ throw new Locked(new RuntimeException("baz"), "foo {0}", "bar");
+ }
+ @RestMethod
+ public void getF5() throws Locked {
+ throw new Locked().header("Foo", "bar");
+ }
+ }
+
+ @Test
+ public void a01_basic() throws Exception {
+ RestClient c = MockRestClient.create(A.class).ignoreErrors().build();
+
+ c.get("/f1").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is(MESSAGE);
+ c.get("/f2").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("foo bar");
+ c.get("/f3").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("baz");
+ c.get("/f4").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("foo bar");
+ c.get("/f5").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is(MESSAGE)
+ .assertHeader("Foo").is("bar");
+ }
+}
diff --git a/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/LoopDetected_Test.java b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/LoopDetected_Test.java
new file mode 100644
index 0000000..e2480ec
--- /dev/null
+++ b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/LoopDetected_Test.java
@@ -0,0 +1,73 @@
+// ***************************************************************************************************************************
+// * 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.exception;
+
+import static org.junit.runners.MethodSorters.*;
+
+import org.apache.juneau.rest.annotation.*;
+import org.apache.juneau.rest.client2.*;
+import org.apache.juneau.rest.mock2.*;
+import org.junit.*;
+
+@FixMethodOrder(NAME_ASCENDING)
+public class LoopDetected_Test {
+
+ private static final int CODE = LoopDetected.CODE;
+ private static final String MESSAGE = LoopDetected.MESSAGE;
+
+ @Rest
+ public static class A {
+ @RestMethod
+ public void getF1() throws LoopDetected {
+ throw new LoopDetected();
+ }
+ @RestMethod
+ public void getF2() throws LoopDetected {
+ throw new LoopDetected("foo {0}", "bar");
+ }
+ @RestMethod
+ public void getF3() throws LoopDetected {
+ throw new LoopDetected(new RuntimeException("baz"));
+ }
+ @RestMethod
+ public void getF4() throws LoopDetected {
+ throw new LoopDetected(new RuntimeException("baz"), "foo {0}", "bar");
+ }
+ @RestMethod
+ public void getF5() throws LoopDetected {
+ throw new LoopDetected().header("Foo", "bar");
+ }
+ }
+
+ @Test
+ public void a01_basic() throws Exception {
+ RestClient c = MockRestClient.create(A.class).ignoreErrors().build();
+
+ c.get("/f1").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is(MESSAGE);
+ c.get("/f2").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("foo bar");
+ c.get("/f3").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("baz");
+ c.get("/f4").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("foo bar");
+ c.get("/f5").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is(MESSAGE)
+ .assertHeader("Foo").is("bar");
+ }
+}
diff --git a/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/MethodNotAllowed_Test.java b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/MethodNotAllowed_Test.java
new file mode 100644
index 0000000..fbe4c25
--- /dev/null
+++ b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/MethodNotAllowed_Test.java
@@ -0,0 +1,73 @@
+// ***************************************************************************************************************************
+// * 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.exception;
+
+import static org.junit.runners.MethodSorters.*;
+
+import org.apache.juneau.rest.annotation.*;
+import org.apache.juneau.rest.client2.*;
+import org.apache.juneau.rest.mock2.*;
+import org.junit.*;
+
+@FixMethodOrder(NAME_ASCENDING)
+public class MethodNotAllowed_Test {
+
+ private static final int CODE = MethodNotAllowed.CODE;
+ private static final String MESSAGE = MethodNotAllowed.MESSAGE;
+
+ @Rest
+ public static class A {
+ @RestMethod
+ public void getF1() throws MethodNotAllowed {
+ throw new MethodNotAllowed();
+ }
+ @RestMethod
+ public void getF2() throws MethodNotAllowed {
+ throw new MethodNotAllowed("foo {0}", "bar");
+ }
+ @RestMethod
+ public void getF3() throws MethodNotAllowed {
+ throw new MethodNotAllowed(new RuntimeException("baz"));
+ }
+ @RestMethod
+ public void getF4() throws MethodNotAllowed {
+ throw new MethodNotAllowed(new RuntimeException("baz"), "foo {0}", "bar");
+ }
+ @RestMethod
+ public void getF5() throws MethodNotAllowed {
+ throw new MethodNotAllowed().header("Foo", "bar");
+ }
+ }
+
+ @Test
+ public void a01_basic() throws Exception {
+ RestClient c = MockRestClient.create(A.class).ignoreErrors().build();
+
+ c.get("/f1").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is(MESSAGE);
+ c.get("/f2").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("foo bar");
+ c.get("/f3").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("baz");
+ c.get("/f4").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("foo bar");
+ c.get("/f5").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is(MESSAGE)
+ .assertHeader("Foo").is("bar");
+ }
+}
diff --git a/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/MisdirectedRequest_Test.java b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/MisdirectedRequest_Test.java
new file mode 100644
index 0000000..de9be65
--- /dev/null
+++ b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/MisdirectedRequest_Test.java
@@ -0,0 +1,73 @@
+// ***************************************************************************************************************************
+// * 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.exception;
+
+import static org.junit.runners.MethodSorters.*;
+
+import org.apache.juneau.rest.annotation.*;
+import org.apache.juneau.rest.client2.*;
+import org.apache.juneau.rest.mock2.*;
+import org.junit.*;
+
+@FixMethodOrder(NAME_ASCENDING)
+public class MisdirectedRequest_Test {
+
+ private static final int CODE = MisdirectedRequest.CODE;
+ private static final String MESSAGE = MisdirectedRequest.MESSAGE;
+
+ @Rest
+ public static class A {
+ @RestMethod
+ public void getF1() throws MisdirectedRequest {
+ throw new MisdirectedRequest();
+ }
+ @RestMethod
+ public void getF2() throws MisdirectedRequest {
+ throw new MisdirectedRequest("foo {0}", "bar");
+ }
+ @RestMethod
+ public void getF3() throws MisdirectedRequest {
+ throw new MisdirectedRequest(new RuntimeException("baz"));
+ }
+ @RestMethod
+ public void getF4() throws MisdirectedRequest {
+ throw new MisdirectedRequest(new RuntimeException("baz"), "foo {0}", "bar");
+ }
+ @RestMethod
+ public void getF5() throws MisdirectedRequest {
+ throw new MisdirectedRequest().header("Foo", "bar");
+ }
+ }
+
+ @Test
+ public void a01_basic() throws Exception {
+ RestClient c = MockRestClient.create(A.class).ignoreErrors().build();
+
+ c.get("/f1").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is(MESSAGE);
+ c.get("/f2").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("foo bar");
+ c.get("/f3").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("baz");
+ c.get("/f4").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("foo bar");
+ c.get("/f5").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is(MESSAGE)
+ .assertHeader("Foo").is("bar");
+ }
+}
diff --git a/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/NetworkAuthenticationRequired_Test.java b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/NetworkAuthenticationRequired_Test.java
new file mode 100644
index 0000000..08ae920
--- /dev/null
+++ b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/NetworkAuthenticationRequired_Test.java
@@ -0,0 +1,73 @@
+// ***************************************************************************************************************************
+// * 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.exception;
+
+import static org.junit.runners.MethodSorters.*;
+
+import org.apache.juneau.rest.annotation.*;
+import org.apache.juneau.rest.client2.*;
+import org.apache.juneau.rest.mock2.*;
+import org.junit.*;
+
+@FixMethodOrder(NAME_ASCENDING)
+public class NetworkAuthenticationRequired_Test {
+
+ private static final int CODE = NetworkAuthenticationRequired.CODE;
+ private static final String MESSAGE = NetworkAuthenticationRequired.MESSAGE;
+
+ @Rest
+ public static class A {
+ @RestMethod
+ public void getF1() throws NetworkAuthenticationRequired {
+ throw new NetworkAuthenticationRequired();
+ }
+ @RestMethod
+ public void getF2() throws NetworkAuthenticationRequired {
+ throw new NetworkAuthenticationRequired("foo {0}", "bar");
+ }
+ @RestMethod
+ public void getF3() throws NetworkAuthenticationRequired {
+ throw new NetworkAuthenticationRequired(new RuntimeException("baz"));
+ }
+ @RestMethod
+ public void getF4() throws NetworkAuthenticationRequired {
+ throw new NetworkAuthenticationRequired(new RuntimeException("baz"), "foo {0}", "bar");
+ }
+ @RestMethod
+ public void getF5() throws NetworkAuthenticationRequired {
+ throw new NetworkAuthenticationRequired().header("Foo", "bar");
+ }
+ }
+
+ @Test
+ public void a01_basic() throws Exception {
+ RestClient c = MockRestClient.create(A.class).ignoreErrors().build();
+
+ c.get("/f1").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is(MESSAGE);
+ c.get("/f2").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("foo bar");
+ c.get("/f3").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("baz");
+ c.get("/f4").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("foo bar");
+ c.get("/f5").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is(MESSAGE)
+ .assertHeader("Foo").is("bar");
+ }
+}
diff --git a/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/NotAcceptable_Test.java b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/NotAcceptable_Test.java
new file mode 100644
index 0000000..7136487
--- /dev/null
+++ b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/NotAcceptable_Test.java
@@ -0,0 +1,73 @@
+// ***************************************************************************************************************************
+// * 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.exception;
+
+import static org.junit.runners.MethodSorters.*;
+
+import org.apache.juneau.rest.annotation.*;
+import org.apache.juneau.rest.client2.*;
+import org.apache.juneau.rest.mock2.*;
+import org.junit.*;
+
+@FixMethodOrder(NAME_ASCENDING)
+public class NotAcceptable_Test {
+
+ private static final int CODE = NotAcceptable.CODE;
+ private static final String MESSAGE = NotAcceptable.MESSAGE;
+
+ @Rest
+ public static class A {
+ @RestMethod
+ public void getF1() throws NotAcceptable {
+ throw new NotAcceptable();
+ }
+ @RestMethod
+ public void getF2() throws NotAcceptable {
+ throw new NotAcceptable("foo {0}", "bar");
+ }
+ @RestMethod
+ public void getF3() throws NotAcceptable {
+ throw new NotAcceptable(new RuntimeException("baz"));
+ }
+ @RestMethod
+ public void getF4() throws NotAcceptable {
+ throw new NotAcceptable(new RuntimeException("baz"), "foo {0}", "bar");
+ }
+ @RestMethod
+ public void getF5() throws NotAcceptable {
+ throw new NotAcceptable().header("Foo", "bar");
+ }
+ }
+
+ @Test
+ public void a01_basic() throws Exception {
+ RestClient c = MockRestClient.create(A.class).ignoreErrors().build();
+
+ c.get("/f1").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is(MESSAGE);
+ c.get("/f2").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("foo bar");
+ c.get("/f3").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("baz");
+ c.get("/f4").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("foo bar");
+ c.get("/f5").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is(MESSAGE)
+ .assertHeader("Foo").is("bar");
+ }
+}
diff --git a/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/NotExtended_Test.java b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/NotExtended_Test.java
new file mode 100644
index 0000000..7e39f5c
--- /dev/null
+++ b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/NotExtended_Test.java
@@ -0,0 +1,73 @@
+// ***************************************************************************************************************************
+// * 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.exception;
+
+import static org.junit.runners.MethodSorters.*;
+
+import org.apache.juneau.rest.annotation.*;
+import org.apache.juneau.rest.client2.*;
+import org.apache.juneau.rest.mock2.*;
+import org.junit.*;
+
+@FixMethodOrder(NAME_ASCENDING)
+public class NotExtended_Test {
+
+ private static final int CODE = NotExtended.CODE;
+ private static final String MESSAGE = NotExtended.MESSAGE;
+
+ @Rest
+ public static class A {
+ @RestMethod
+ public void getF1() throws NotExtended {
+ throw new NotExtended();
+ }
+ @RestMethod
+ public void getF2() throws NotExtended {
+ throw new NotExtended("foo {0}", "bar");
+ }
+ @RestMethod
+ public void getF3() throws NotExtended {
+ throw new NotExtended(new RuntimeException("baz"));
+ }
+ @RestMethod
+ public void getF4() throws NotExtended {
+ throw new NotExtended(new RuntimeException("baz"), "foo {0}", "bar");
+ }
+ @RestMethod
+ public void getF5() throws NotExtended {
+ throw new NotExtended().header("Foo", "bar");
+ }
+ }
+
+ @Test
+ public void a01_basic() throws Exception {
+ RestClient c = MockRestClient.create(A.class).ignoreErrors().build();
+
+ c.get("/f1").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is(MESSAGE);
+ c.get("/f2").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("foo bar");
+ c.get("/f3").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("baz");
+ c.get("/f4").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("foo bar");
+ c.get("/f5").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is(MESSAGE)
+ .assertHeader("Foo").is("bar");
+ }
+}
diff --git a/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/NotFound_Test.java b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/NotFound_Test.java
new file mode 100644
index 0000000..2e64dc5
--- /dev/null
+++ b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/NotFound_Test.java
@@ -0,0 +1,73 @@
+// ***************************************************************************************************************************
+// * 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.exception;
+
+import static org.junit.runners.MethodSorters.*;
+
+import org.apache.juneau.rest.annotation.*;
+import org.apache.juneau.rest.client2.*;
+import org.apache.juneau.rest.mock2.*;
+import org.junit.*;
+
+@FixMethodOrder(NAME_ASCENDING)
+public class NotFound_Test {
+
+ private static final int CODE = NotFound.CODE;
+ private static final String MESSAGE = NotFound.MESSAGE;
+
+ @Rest
+ public static class A {
+ @RestMethod
+ public void getF1() throws NotFound {
+ throw new NotFound();
+ }
+ @RestMethod
+ public void getF2() throws NotFound {
+ throw new NotFound("foo {0}", "bar");
+ }
+ @RestMethod
+ public void getF3() throws NotFound {
+ throw new NotFound(new RuntimeException("baz"));
+ }
+ @RestMethod
+ public void getF4() throws NotFound {
+ throw new NotFound(new RuntimeException("baz"), "foo {0}", "bar");
+ }
+ @RestMethod
+ public void getF5() throws NotFound {
+ throw new NotFound().header("Foo", "bar");
+ }
+ }
+
+ @Test
+ public void a01_basic() throws Exception {
+ RestClient c = MockRestClient.create(A.class).ignoreErrors().build();
+
+ c.get("/f1").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is(MESSAGE);
+ c.get("/f2").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("foo bar");
+ c.get("/f3").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("baz");
+ c.get("/f4").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("foo bar");
+ c.get("/f5").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is(MESSAGE)
+ .assertHeader("Foo").is("bar");
+ }
+}
diff --git a/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/NotImplemented_Test.java b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/NotImplemented_Test.java
new file mode 100644
index 0000000..1b68b78
--- /dev/null
+++ b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/NotImplemented_Test.java
@@ -0,0 +1,73 @@
+// ***************************************************************************************************************************
+// * 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.exception;
+
+import static org.junit.runners.MethodSorters.*;
+
+import org.apache.juneau.rest.annotation.*;
+import org.apache.juneau.rest.client2.*;
+import org.apache.juneau.rest.mock2.*;
+import org.junit.*;
+
+@FixMethodOrder(NAME_ASCENDING)
+public class NotImplemented_Test {
+
+ private static final int CODE = NotImplemented.CODE;
+ private static final String MESSAGE = NotImplemented.MESSAGE;
+
+ @Rest
+ public static class A {
+ @RestMethod
+ public void getF1() throws NotImplemented {
+ throw new NotImplemented();
+ }
+ @RestMethod
+ public void getF2() throws NotImplemented {
+ throw new NotImplemented("foo {0}", "bar");
+ }
+ @RestMethod
+ public void getF3() throws NotImplemented {
+ throw new NotImplemented(new RuntimeException("baz"));
+ }
+ @RestMethod
+ public void getF4() throws NotImplemented {
+ throw new NotImplemented(new RuntimeException("baz"), "foo {0}", "bar");
+ }
+ @RestMethod
+ public void getF5() throws NotImplemented {
+ throw new NotImplemented().header("Foo", "bar");
+ }
+ }
+
+ @Test
+ public void a01_basic() throws Exception {
+ RestClient c = MockRestClient.create(A.class).ignoreErrors().build();
+
+ c.get("/f1").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is(MESSAGE);
+ c.get("/f2").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("foo bar");
+ c.get("/f3").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("baz");
+ c.get("/f4").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("foo bar");
+ c.get("/f5").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is(MESSAGE)
+ .assertHeader("Foo").is("bar");
+ }
+}
diff --git a/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/PayloadTooLarge_Test.java b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/PayloadTooLarge_Test.java
new file mode 100644
index 0000000..24b7ac5
--- /dev/null
+++ b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/PayloadTooLarge_Test.java
@@ -0,0 +1,73 @@
+// ***************************************************************************************************************************
+// * 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.exception;
+
+import static org.junit.runners.MethodSorters.*;
+
+import org.apache.juneau.rest.annotation.*;
+import org.apache.juneau.rest.client2.*;
+import org.apache.juneau.rest.mock2.*;
+import org.junit.*;
+
+@FixMethodOrder(NAME_ASCENDING)
+public class PayloadTooLarge_Test {
+
+ private static final int CODE = PayloadTooLarge.CODE;
+ private static final String MESSAGE = PayloadTooLarge.MESSAGE;
+
+ @Rest
+ public static class A {
+ @RestMethod
+ public void getF1() throws PayloadTooLarge {
+ throw new PayloadTooLarge();
+ }
+ @RestMethod
+ public void getF2() throws PayloadTooLarge {
+ throw new PayloadTooLarge("foo {0}", "bar");
+ }
+ @RestMethod
+ public void getF3() throws PayloadTooLarge {
+ throw new PayloadTooLarge(new RuntimeException("baz"));
+ }
+ @RestMethod
+ public void getF4() throws PayloadTooLarge {
+ throw new PayloadTooLarge(new RuntimeException("baz"), "foo {0}", "bar");
+ }
+ @RestMethod
+ public void getF5() throws PayloadTooLarge {
+ throw new PayloadTooLarge().header("Foo", "bar");
+ }
+ }
+
+ @Test
+ public void a01_basic() throws Exception {
+ RestClient c = MockRestClient.create(A.class).ignoreErrors().build();
+
+ c.get("/f1").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is(MESSAGE);
+ c.get("/f2").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("foo bar");
+ c.get("/f3").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("baz");
+ c.get("/f4").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("foo bar");
+ c.get("/f5").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is(MESSAGE)
+ .assertHeader("Foo").is("bar");
+ }
+}
diff --git a/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/PreconditionFailed_Test.java b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/PreconditionFailed_Test.java
new file mode 100644
index 0000000..cf0c1bd
--- /dev/null
+++ b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/PreconditionFailed_Test.java
@@ -0,0 +1,73 @@
+// ***************************************************************************************************************************
+// * 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.exception;
+
+import static org.junit.runners.MethodSorters.*;
+
+import org.apache.juneau.rest.annotation.*;
+import org.apache.juneau.rest.client2.*;
+import org.apache.juneau.rest.mock2.*;
+import org.junit.*;
+
+@FixMethodOrder(NAME_ASCENDING)
+public class PreconditionFailed_Test {
+
+ private static final int CODE = PreconditionFailed.CODE;
+ private static final String MESSAGE = PreconditionFailed.MESSAGE;
+
+ @Rest
+ public static class A {
+ @RestMethod
+ public void getF1() throws PreconditionFailed {
+ throw new PreconditionFailed();
+ }
+ @RestMethod
+ public void getF2() throws PreconditionFailed {
+ throw new PreconditionFailed("foo {0}", "bar");
+ }
+ @RestMethod
+ public void getF3() throws PreconditionFailed {
+ throw new PreconditionFailed(new RuntimeException("baz"));
+ }
+ @RestMethod
+ public void getF4() throws PreconditionFailed {
+ throw new PreconditionFailed(new RuntimeException("baz"), "foo {0}", "bar");
+ }
+ @RestMethod
+ public void getF5() throws PreconditionFailed {
+ throw new PreconditionFailed().header("Foo", "bar");
+ }
+ }
+
+ @Test
+ public void a01_basic() throws Exception {
+ RestClient c = MockRestClient.create(A.class).ignoreErrors().build();
+
+ c.get("/f1").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is(MESSAGE);
+ c.get("/f2").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("foo bar");
+ c.get("/f3").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("baz");
+ c.get("/f4").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("foo bar");
+ c.get("/f5").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is(MESSAGE)
+ .assertHeader("Foo").is("bar");
+ }
+}
diff --git a/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/PreconditionRequired_Test.java b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/PreconditionRequired_Test.java
new file mode 100644
index 0000000..3ac50ff
--- /dev/null
+++ b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/PreconditionRequired_Test.java
@@ -0,0 +1,73 @@
+// ***************************************************************************************************************************
+// * 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.exception;
+
+import static org.junit.runners.MethodSorters.*;
+
+import org.apache.juneau.rest.annotation.*;
+import org.apache.juneau.rest.client2.*;
+import org.apache.juneau.rest.mock2.*;
+import org.junit.*;
+
+@FixMethodOrder(NAME_ASCENDING)
+public class PreconditionRequired_Test {
+
+ private static final int CODE = PreconditionRequired.CODE;
+ private static final String MESSAGE = PreconditionRequired.MESSAGE;
+
+ @Rest
+ public static class A {
+ @RestMethod
+ public void getF1() throws PreconditionRequired {
+ throw new PreconditionRequired();
+ }
+ @RestMethod
+ public void getF2() throws PreconditionRequired {
+ throw new PreconditionRequired("foo {0}", "bar");
+ }
+ @RestMethod
+ public void getF3() throws PreconditionRequired {
+ throw new PreconditionRequired(new RuntimeException("baz"));
+ }
+ @RestMethod
+ public void getF4() throws PreconditionRequired {
+ throw new PreconditionRequired(new RuntimeException("baz"), "foo {0}", "bar");
+ }
+ @RestMethod
+ public void getF5() throws PreconditionRequired {
+ throw new PreconditionRequired().header("Foo", "bar");
+ }
+ }
+
+ @Test
+ public void a01_basic() throws Exception {
+ RestClient c = MockRestClient.create(A.class).ignoreErrors().build();
+
+ c.get("/f1").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is(MESSAGE);
+ c.get("/f2").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("foo bar");
+ c.get("/f3").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("baz");
+ c.get("/f4").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("foo bar");
+ c.get("/f5").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is(MESSAGE)
+ .assertHeader("Foo").is("bar");
+ }
+}
diff --git a/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/RangeNotSatisfiable_Test.java b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/RangeNotSatisfiable_Test.java
new file mode 100644
index 0000000..adec57f
--- /dev/null
+++ b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/RangeNotSatisfiable_Test.java
@@ -0,0 +1,73 @@
+// ***************************************************************************************************************************
+// * 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.exception;
+
+import static org.junit.runners.MethodSorters.*;
+
+import org.apache.juneau.rest.annotation.*;
+import org.apache.juneau.rest.client2.*;
+import org.apache.juneau.rest.mock2.*;
+import org.junit.*;
+
+@FixMethodOrder(NAME_ASCENDING)
+public class RangeNotSatisfiable_Test {
+
+ private static final int CODE = RangeNotSatisfiable.CODE;
+ private static final String MESSAGE = RangeNotSatisfiable.MESSAGE;
+
+ @Rest
+ public static class A {
+ @RestMethod
+ public void getF1() throws RangeNotSatisfiable {
+ throw new RangeNotSatisfiable();
+ }
+ @RestMethod
+ public void getF2() throws RangeNotSatisfiable {
+ throw new RangeNotSatisfiable("foo {0}", "bar");
+ }
+ @RestMethod
+ public void getF3() throws RangeNotSatisfiable {
+ throw new RangeNotSatisfiable(new RuntimeException("baz"));
+ }
+ @RestMethod
+ public void getF4() throws RangeNotSatisfiable {
+ throw new RangeNotSatisfiable(new RuntimeException("baz"), "foo {0}", "bar");
+ }
+ @RestMethod
+ public void getF5() throws RangeNotSatisfiable {
+ throw new RangeNotSatisfiable().header("Foo", "bar");
+ }
+ }
+
+ @Test
+ public void a01_basic() throws Exception {
+ RestClient c = MockRestClient.create(A.class).ignoreErrors().build();
+
+ c.get("/f1").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is(MESSAGE);
+ c.get("/f2").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("foo bar");
+ c.get("/f3").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("baz");
+ c.get("/f4").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("foo bar");
+ c.get("/f5").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is(MESSAGE)
+ .assertHeader("Foo").is("bar");
+ }
+}
diff --git a/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/RequestHeaderFieldsTooLarge_Test.java b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/RequestHeaderFieldsTooLarge_Test.java
new file mode 100644
index 0000000..33f3978
--- /dev/null
+++ b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/RequestHeaderFieldsTooLarge_Test.java
@@ -0,0 +1,73 @@
+// ***************************************************************************************************************************
+// * 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.exception;
+
+import static org.junit.runners.MethodSorters.*;
+
+import org.apache.juneau.rest.annotation.*;
+import org.apache.juneau.rest.client2.*;
+import org.apache.juneau.rest.mock2.*;
+import org.junit.*;
+
+@FixMethodOrder(NAME_ASCENDING)
+public class RequestHeaderFieldsTooLarge_Test {
+
+ private static final int CODE = RequestHeaderFieldsTooLarge.CODE;
+ private static final String MESSAGE = RequestHeaderFieldsTooLarge.MESSAGE;
+
+ @Rest
+ public static class A {
+ @RestMethod
+ public void getF1() throws RequestHeaderFieldsTooLarge {
+ throw new RequestHeaderFieldsTooLarge();
+ }
+ @RestMethod
+ public void getF2() throws RequestHeaderFieldsTooLarge {
+ throw new RequestHeaderFieldsTooLarge("foo {0}", "bar");
+ }
+ @RestMethod
+ public void getF3() throws RequestHeaderFieldsTooLarge {
+ throw new RequestHeaderFieldsTooLarge(new RuntimeException("baz"));
+ }
+ @RestMethod
+ public void getF4() throws RequestHeaderFieldsTooLarge {
+ throw new RequestHeaderFieldsTooLarge(new RuntimeException("baz"), "foo {0}", "bar");
+ }
+ @RestMethod
+ public void getF5() throws RequestHeaderFieldsTooLarge {
+ throw new RequestHeaderFieldsTooLarge().header("Foo", "bar");
+ }
+ }
+
+ @Test
+ public void a01_basic() throws Exception {
+ RestClient c = MockRestClient.create(A.class).ignoreErrors().build();
+
+ c.get("/f1").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is(MESSAGE);
+ c.get("/f2").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("foo bar");
+ c.get("/f3").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("baz");
+ c.get("/f4").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("foo bar");
+ c.get("/f5").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is(MESSAGE)
+ .assertHeader("Foo").is("bar");
+ }
+}
diff --git a/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/ServiceUnavailable_Test.java b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/ServiceUnavailable_Test.java
new file mode 100644
index 0000000..3450cd9
--- /dev/null
+++ b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/ServiceUnavailable_Test.java
@@ -0,0 +1,73 @@
+// ***************************************************************************************************************************
+// * 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.exception;
+
+import static org.junit.runners.MethodSorters.*;
+
+import org.apache.juneau.rest.annotation.*;
+import org.apache.juneau.rest.client2.*;
+import org.apache.juneau.rest.mock2.*;
+import org.junit.*;
+
+@FixMethodOrder(NAME_ASCENDING)
+public class ServiceUnavailable_Test {
+
+ private static final int CODE = ServiceUnavailable.CODE;
+ private static final String MESSAGE = ServiceUnavailable.MESSAGE;
+
+ @Rest
+ public static class A {
+ @RestMethod
+ public void getF1() throws ServiceUnavailable {
+ throw new ServiceUnavailable();
+ }
+ @RestMethod
+ public void getF2() throws ServiceUnavailable {
+ throw new ServiceUnavailable("foo {0}", "bar");
+ }
+ @RestMethod
+ public void getF3() throws ServiceUnavailable {
+ throw new ServiceUnavailable(new RuntimeException("baz"));
+ }
+ @RestMethod
+ public void getF4() throws ServiceUnavailable {
+ throw new ServiceUnavailable(new RuntimeException("baz"), "foo {0}", "bar");
+ }
+ @RestMethod
+ public void getF5() throws ServiceUnavailable {
+ throw new ServiceUnavailable().header("Foo", "bar");
+ }
+ }
+
+ @Test
+ public void a01_basic() throws Exception {
+ RestClient c = MockRestClient.create(A.class).ignoreErrors().build();
+
+ c.get("/f1").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is(MESSAGE);
+ c.get("/f2").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("foo bar");
+ c.get("/f3").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("baz");
+ c.get("/f4").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("foo bar");
+ c.get("/f5").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is(MESSAGE)
+ .assertHeader("Foo").is("bar");
+ }
+}
diff --git a/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/TooManyRequests_Test.java b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/TooManyRequests_Test.java
new file mode 100644
index 0000000..3a60e84
--- /dev/null
+++ b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/TooManyRequests_Test.java
@@ -0,0 +1,73 @@
+// ***************************************************************************************************************************
+// * 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.exception;
+
+import static org.junit.runners.MethodSorters.*;
+
+import org.apache.juneau.rest.annotation.*;
+import org.apache.juneau.rest.client2.*;
+import org.apache.juneau.rest.mock2.*;
+import org.junit.*;
+
+@FixMethodOrder(NAME_ASCENDING)
+public class TooManyRequests_Test {
+
+ private static final int CODE = TooManyRequests.CODE;
+ private static final String MESSAGE = TooManyRequests.MESSAGE;
+
+ @Rest
+ public static class A {
+ @RestMethod
+ public void getF1() throws TooManyRequests {
+ throw new TooManyRequests();
+ }
+ @RestMethod
+ public void getF2() throws TooManyRequests {
+ throw new TooManyRequests("foo {0}", "bar");
+ }
+ @RestMethod
+ public void getF3() throws TooManyRequests {
+ throw new TooManyRequests(new RuntimeException("baz"));
+ }
+ @RestMethod
+ public void getF4() throws TooManyRequests {
+ throw new TooManyRequests(new RuntimeException("baz"), "foo {0}", "bar");
+ }
+ @RestMethod
+ public void getF5() throws TooManyRequests {
+ throw new TooManyRequests().header("Foo", "bar");
+ }
+ }
+
+ @Test
+ public void a01_basic() throws Exception {
+ RestClient c = MockRestClient.create(A.class).ignoreErrors().build();
+
+ c.get("/f1").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is(MESSAGE);
+ c.get("/f2").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("foo bar");
+ c.get("/f3").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("baz");
+ c.get("/f4").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("foo bar");
+ c.get("/f5").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is(MESSAGE)
+ .assertHeader("Foo").is("bar");
+ }
+}
diff --git a/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/Unauthorized_Test.java b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/Unauthorized_Test.java
new file mode 100644
index 0000000..a486b26
--- /dev/null
+++ b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/Unauthorized_Test.java
@@ -0,0 +1,73 @@
+// ***************************************************************************************************************************
+// * 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.exception;
+
+import static org.junit.runners.MethodSorters.*;
+
+import org.apache.juneau.rest.annotation.*;
+import org.apache.juneau.rest.client2.*;
+import org.apache.juneau.rest.mock2.*;
+import org.junit.*;
+
+@FixMethodOrder(NAME_ASCENDING)
+public class Unauthorized_Test {
+
+ private static final int CODE = Unauthorized.CODE;
+ private static final String MESSAGE = Unauthorized.MESSAGE;
+
+ @Rest
+ public static class A {
+ @RestMethod
+ public void getF1() throws Unauthorized {
+ throw new Unauthorized();
+ }
+ @RestMethod
+ public void getF2() throws Unauthorized {
+ throw new Unauthorized("foo {0}", "bar");
+ }
+ @RestMethod
+ public void getF3() throws Unauthorized {
+ throw new Unauthorized(new RuntimeException("baz"));
+ }
+ @RestMethod
+ public void getF4() throws Unauthorized {
+ throw new Unauthorized(new RuntimeException("baz"), "foo {0}", "bar");
+ }
+ @RestMethod
+ public void getF5() throws Unauthorized {
+ throw new Unauthorized().header("Foo", "bar");
+ }
+ }
+
+ @Test
+ public void a01_basic() throws Exception {
+ RestClient c = MockRestClient.create(A.class).ignoreErrors().build();
+
+ c.get("/f1").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is(MESSAGE);
+ c.get("/f2").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("foo bar");
+ c.get("/f3").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("baz");
+ c.get("/f4").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("foo bar");
+ c.get("/f5").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is(MESSAGE)
+ .assertHeader("Foo").is("bar");
+ }
+}
diff --git a/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/UnavailableForLegalReasons_Test.java b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/UnavailableForLegalReasons_Test.java
new file mode 100644
index 0000000..e3d9477
--- /dev/null
+++ b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/UnavailableForLegalReasons_Test.java
@@ -0,0 +1,73 @@
+// ***************************************************************************************************************************
+// * 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.exception;
+
+import static org.junit.runners.MethodSorters.*;
+
+import org.apache.juneau.rest.annotation.*;
+import org.apache.juneau.rest.client2.*;
+import org.apache.juneau.rest.mock2.*;
+import org.junit.*;
+
+@FixMethodOrder(NAME_ASCENDING)
+public class UnavailableForLegalReasons_Test {
+
+ private static final int CODE = UnavailableForLegalReasons.CODE;
+ private static final String MESSAGE = UnavailableForLegalReasons.MESSAGE;
+
+ @Rest
+ public static class A {
+ @RestMethod
+ public void getF1() throws UnavailableForLegalReasons {
+ throw new UnavailableForLegalReasons();
+ }
+ @RestMethod
+ public void getF2() throws UnavailableForLegalReasons {
+ throw new UnavailableForLegalReasons("foo {0}", "bar");
+ }
+ @RestMethod
+ public void getF3() throws UnavailableForLegalReasons {
+ throw new UnavailableForLegalReasons(new RuntimeException("baz"));
+ }
+ @RestMethod
+ public void getF4() throws UnavailableForLegalReasons {
+ throw new UnavailableForLegalReasons(new RuntimeException("baz"), "foo {0}", "bar");
+ }
+ @RestMethod
+ public void getF5() throws UnavailableForLegalReasons {
+ throw new UnavailableForLegalReasons().header("Foo", "bar");
+ }
+ }
+
+ @Test
+ public void a01_basic() throws Exception {
+ RestClient c = MockRestClient.create(A.class).ignoreErrors().build();
+
+ c.get("/f1").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is(MESSAGE);
+ c.get("/f2").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("foo bar");
+ c.get("/f3").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("baz");
+ c.get("/f4").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("foo bar");
+ c.get("/f5").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is(MESSAGE)
+ .assertHeader("Foo").is("bar");
+ }
+}
diff --git a/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/UnprocessableEntity_Test.java b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/UnprocessableEntity_Test.java
new file mode 100644
index 0000000..a326c07
--- /dev/null
+++ b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/UnprocessableEntity_Test.java
@@ -0,0 +1,73 @@
+// ***************************************************************************************************************************
+// * 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.exception;
+
+import static org.junit.runners.MethodSorters.*;
+
+import org.apache.juneau.rest.annotation.*;
+import org.apache.juneau.rest.client2.*;
+import org.apache.juneau.rest.mock2.*;
+import org.junit.*;
+
+@FixMethodOrder(NAME_ASCENDING)
+public class UnprocessableEntity_Test {
+
+ private static final int CODE = UnprocessableEntity.CODE;
+ private static final String MESSAGE = UnprocessableEntity.MESSAGE;
+
+ @Rest
+ public static class A {
+ @RestMethod
+ public void getF1() throws UnprocessableEntity {
+ throw new UnprocessableEntity();
+ }
+ @RestMethod
+ public void getF2() throws UnprocessableEntity {
+ throw new UnprocessableEntity("foo {0}", "bar");
+ }
+ @RestMethod
+ public void getF3() throws UnprocessableEntity {
+ throw new UnprocessableEntity(new RuntimeException("baz"));
+ }
+ @RestMethod
+ public void getF4() throws UnprocessableEntity {
+ throw new UnprocessableEntity(new RuntimeException("baz"), "foo {0}", "bar");
+ }
+ @RestMethod
+ public void getF5() throws UnprocessableEntity {
+ throw new UnprocessableEntity().header("Foo", "bar");
+ }
+ }
+
+ @Test
+ public void a01_basic() throws Exception {
+ RestClient c = MockRestClient.create(A.class).ignoreErrors().build();
+
+ c.get("/f1").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is(MESSAGE);
+ c.get("/f2").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("foo bar");
+ c.get("/f3").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("baz");
+ c.get("/f4").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("foo bar");
+ c.get("/f5").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is(MESSAGE)
+ .assertHeader("Foo").is("bar");
+ }
+}
diff --git a/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/UnsupportedMediaType_Test.java b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/UnsupportedMediaType_Test.java
new file mode 100644
index 0000000..9f73cf6
--- /dev/null
+++ b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/UnsupportedMediaType_Test.java
@@ -0,0 +1,73 @@
+// ***************************************************************************************************************************
+// * 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.exception;
+
+import static org.junit.runners.MethodSorters.*;
+
+import org.apache.juneau.rest.annotation.*;
+import org.apache.juneau.rest.client2.*;
+import org.apache.juneau.rest.mock2.*;
+import org.junit.*;
+
+@FixMethodOrder(NAME_ASCENDING)
+public class UnsupportedMediaType_Test {
+
+ private static final int CODE = UnsupportedMediaType.CODE;
+ private static final String MESSAGE = UnsupportedMediaType.MESSAGE;
+
+ @Rest
+ public static class A {
+ @RestMethod
+ public void getF1() throws UnsupportedMediaType {
+ throw new UnsupportedMediaType();
+ }
+ @RestMethod
+ public void getF2() throws UnsupportedMediaType {
+ throw new UnsupportedMediaType("foo {0}", "bar");
+ }
+ @RestMethod
+ public void getF3() throws UnsupportedMediaType {
+ throw new UnsupportedMediaType(new RuntimeException("baz"));
+ }
+ @RestMethod
+ public void getF4() throws UnsupportedMediaType {
+ throw new UnsupportedMediaType(new RuntimeException("baz"), "foo {0}", "bar");
+ }
+ @RestMethod
+ public void getF5() throws UnsupportedMediaType {
+ throw new UnsupportedMediaType().header("Foo", "bar");
+ }
+ }
+
+ @Test
+ public void a01_basic() throws Exception {
+ RestClient c = MockRestClient.create(A.class).ignoreErrors().build();
+
+ c.get("/f1").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is(MESSAGE);
+ c.get("/f2").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("foo bar");
+ c.get("/f3").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("baz");
+ c.get("/f4").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("foo bar");
+ c.get("/f5").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is(MESSAGE)
+ .assertHeader("Foo").is("bar");
+ }
+}
diff --git a/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/UpgradeRequired_Test.java b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/UpgradeRequired_Test.java
new file mode 100644
index 0000000..e2deb1b
--- /dev/null
+++ b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/UpgradeRequired_Test.java
@@ -0,0 +1,73 @@
+// ***************************************************************************************************************************
+// * 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.exception;
+
+import static org.junit.runners.MethodSorters.*;
+
+import org.apache.juneau.rest.annotation.*;
+import org.apache.juneau.rest.client2.*;
+import org.apache.juneau.rest.mock2.*;
+import org.junit.*;
+
+@FixMethodOrder(NAME_ASCENDING)
+public class UpgradeRequired_Test {
+
+ private static final int CODE = UpgradeRequired.CODE;
+ private static final String MESSAGE = UpgradeRequired.MESSAGE;
+
+ @Rest
+ public static class A {
+ @RestMethod
+ public void getF1() throws UpgradeRequired {
+ throw new UpgradeRequired();
+ }
+ @RestMethod
+ public void getF2() throws UpgradeRequired {
+ throw new UpgradeRequired("foo {0}", "bar");
+ }
+ @RestMethod
+ public void getF3() throws UpgradeRequired {
+ throw new UpgradeRequired(new RuntimeException("baz"));
+ }
+ @RestMethod
+ public void getF4() throws UpgradeRequired {
+ throw new UpgradeRequired(new RuntimeException("baz"), "foo {0}", "bar");
+ }
+ @RestMethod
+ public void getF5() throws UpgradeRequired {
+ throw new UpgradeRequired().header("Foo", "bar");
+ }
+ }
+
+ @Test
+ public void a01_basic() throws Exception {
+ RestClient c = MockRestClient.create(A.class).ignoreErrors().build();
+
+ c.get("/f1").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is(MESSAGE);
+ c.get("/f2").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("foo bar");
+ c.get("/f3").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("baz");
+ c.get("/f4").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("foo bar");
+ c.get("/f5").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is(MESSAGE)
+ .assertHeader("Foo").is("bar");
+ }
+}
diff --git a/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/UriTooLong_Test.java b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/UriTooLong_Test.java
new file mode 100644
index 0000000..a22bc67
--- /dev/null
+++ b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/UriTooLong_Test.java
@@ -0,0 +1,73 @@
+// ***************************************************************************************************************************
+// * 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.exception;
+
+import static org.junit.runners.MethodSorters.*;
+
+import org.apache.juneau.rest.annotation.*;
+import org.apache.juneau.rest.client2.*;
+import org.apache.juneau.rest.mock2.*;
+import org.junit.*;
+
+@FixMethodOrder(NAME_ASCENDING)
+public class UriTooLong_Test {
+
+ private static final int CODE = UriTooLong.CODE;
+ private static final String MESSAGE = UriTooLong.MESSAGE;
+
+ @Rest
+ public static class A {
+ @RestMethod
+ public void getF1() throws UriTooLong {
+ throw new UriTooLong();
+ }
+ @RestMethod
+ public void getF2() throws UriTooLong {
+ throw new UriTooLong("foo {0}", "bar");
+ }
+ @RestMethod
+ public void getF3() throws UriTooLong {
+ throw new UriTooLong(new RuntimeException("baz"));
+ }
+ @RestMethod
+ public void getF4() throws UriTooLong {
+ throw new UriTooLong(new RuntimeException("baz"), "foo {0}", "bar");
+ }
+ @RestMethod
+ public void getF5() throws UriTooLong {
+ throw new UriTooLong().header("Foo", "bar");
+ }
+ }
+
+ @Test
+ public void a01_basic() throws Exception {
+ RestClient c = MockRestClient.create(A.class).ignoreErrors().build();
+
+ c.get("/f1").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is(MESSAGE);
+ c.get("/f2").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("foo bar");
+ c.get("/f3").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("baz");
+ c.get("/f4").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("foo bar");
+ c.get("/f5").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is(MESSAGE)
+ .assertHeader("Foo").is("bar");
+ }
+}
diff --git a/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/VariantAlsoNegotiates_Test.java b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/VariantAlsoNegotiates_Test.java
new file mode 100644
index 0000000..ba06862
--- /dev/null
+++ b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/http/exception/VariantAlsoNegotiates_Test.java
@@ -0,0 +1,73 @@
+// ***************************************************************************************************************************
+// * 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.exception;
+
+import static org.junit.runners.MethodSorters.*;
+
+import org.apache.juneau.rest.annotation.*;
+import org.apache.juneau.rest.client2.*;
+import org.apache.juneau.rest.mock2.*;
+import org.junit.*;
+
+@FixMethodOrder(NAME_ASCENDING)
+public class VariantAlsoNegotiates_Test {
+
+ private static final int CODE = VariantAlsoNegotiates.CODE;
+ private static final String MESSAGE = VariantAlsoNegotiates.MESSAGE;
+
+ @Rest
+ public static class A {
+ @RestMethod
+ public void getF1() throws VariantAlsoNegotiates {
+ throw new VariantAlsoNegotiates();
+ }
+ @RestMethod
+ public void getF2() throws VariantAlsoNegotiates {
+ throw new VariantAlsoNegotiates("foo {0}", "bar");
+ }
+ @RestMethod
+ public void getF3() throws VariantAlsoNegotiates {
+ throw new VariantAlsoNegotiates(new RuntimeException("baz"));
+ }
+ @RestMethod
+ public void getF4() throws VariantAlsoNegotiates {
+ throw new VariantAlsoNegotiates(new RuntimeException("baz"), "foo {0}", "bar");
+ }
+ @RestMethod
+ public void getF5() throws VariantAlsoNegotiates {
+ throw new VariantAlsoNegotiates().header("Foo", "bar");
+ }
+ }
+
+ @Test
+ public void a01_basic() throws Exception {
+ RestClient c = MockRestClient.create(A.class).ignoreErrors().build();
+
+ c.get("/f1").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is(MESSAGE);
+ c.get("/f2").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("foo bar");
+ c.get("/f3").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("baz");
+ c.get("/f4").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is("foo bar");
+ c.get("/f5").run()
+ .assertStatus().code().is(CODE)
+ .assertBody().is(MESSAGE)
+ .assertHeader("Foo").is("bar");
+ }
+}