diff --git a/samples/standalone/kotlin/http-client/build.gradle.kts b/samples/standalone/kotlin/http-client/build.gradle.kts index 5a4e9c4e8d..c2f23f16ba 100644 --- a/samples/standalone/kotlin/http-client/build.gradle.kts +++ b/samples/standalone/kotlin/http-client/build.gradle.kts @@ -4,6 +4,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { id("org.springframework.boot") version "2.2.0.BUILD-SNAPSHOT" id("io.spring.dependency-management") version "1.0.7.RELEASE" + id("maven-publish") kotlin("jvm") version "1.3.41" kotlin("plugin.spring") version "1.3.41" } diff --git a/specs/spring-cloud-contract-spec-java/src/main/java/org/springframework/cloud/contract/spec/internal/Headers.java b/specs/spring-cloud-contract-spec-java/src/main/java/org/springframework/cloud/contract/spec/internal/Headers.java index 4e004bc7d5..e0936e34b7 100644 --- a/specs/spring-cloud-contract-spec-java/src/main/java/org/springframework/cloud/contract/spec/internal/Headers.java +++ b/specs/spring-cloud-contract-spec-java/src/main/java/org/springframework/cloud/contract/spec/internal/Headers.java @@ -42,10 +42,6 @@ public class Headers { private static final BiFunction SERVER_SIDE = (s, header) -> ContractUtils.convertTestSideRecursively(header); - private MediaTypes mediaTypes = new MediaTypes(); - - private MessagingHeaders messagingHeaders = new MessagingHeaders(); - private Set
entries = new LinkedHashSet<>(); public void header(Map singleHeader) { @@ -75,11 +71,11 @@ public class Headers { } public void contentType(String contentType) { - header(HttpHeaders.contentType(), matching(contentType)); + header(HttpHeaders.CONTENT_TYPE, matching(contentType)); } public void messagingContentType(String contentType) { - header(messagingHeaders.messagingContentType(), matching(contentType)); + header(MessagingHeaders.MESSAGING_CONTENT_TYPE, matching(contentType)); } /** @@ -144,22 +140,6 @@ public class Headers { return "Headers{" + "\nentries=" + entries + '}'; } - public MediaTypes getMediaTypes() { - return mediaTypes; - } - - public void setMediaTypes(MediaTypes mediaTypes) { - this.mediaTypes = mediaTypes; - } - - public MessagingHeaders getMessagingHeaders() { - return messagingHeaders; - } - - public void setMessagingHeaders(MessagingHeaders messagingHeaders) { - this.messagingHeaders = messagingHeaders; - } - public Set
getEntries() { return entries; } @@ -169,315 +149,315 @@ public class Headers { } public String messagingContentType() { - return messagingHeaders.messagingContentType(); + return MessagingHeaders.MESSAGING_CONTENT_TYPE; } public String accept() { - return HttpHeaders.accept(); + return HttpHeaders.ACCEPT; } public String acceptCharset() { - return HttpHeaders.acceptCharset(); + return HttpHeaders.ACCEPT_CHARSET; } public String acceptEncoding() { - return HttpHeaders.acceptEncoding(); + return HttpHeaders.ACCEPT_ENCODING; } public String acceptLanguage() { - return HttpHeaders.acceptLanguage(); + return HttpHeaders.ACCEPT_LANGUAGE; } public String acceptRanges() { - return HttpHeaders.acceptRanges(); + return HttpHeaders.ACCEPT_RANGES; } public String accessControlAllowCredentials() { - return HttpHeaders.accessControlAllowCredentials(); + return HttpHeaders.ACCESS_CONTROL_ALLOW_CREDENTIALS; } public String accessControlAllowHeaders() { - return HttpHeaders.accessControlAllowHeaders(); + return HttpHeaders.ACCESS_CONTROL_ALLOW_HEADERS; } public String accessControlAllowMethods() { - return HttpHeaders.accessControlAllowMethods(); + return HttpHeaders.ACCESS_CONTROL_ALLOW_METHODS; } public String accessControlAllowOrigin() { - return HttpHeaders.accessControlAllowOrigin(); + return HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN; } public String accessControlExposeHeaders() { - return HttpHeaders.accessControlExposeHeaders(); + return HttpHeaders.ACCESS_CONTROL_EXPOSE_HEADERS; } public String accessControlMaxAge() { - return HttpHeaders.accessControlMaxAge(); + return HttpHeaders.ACCESS_CONTROL_MAX_AGE; } public String accessControlRequestHeaders() { - return HttpHeaders.accessControlRequestHeaders(); + return HttpHeaders.ACCESS_CONTROL_REQUEST_HEADERS; } public String accessControlRequestMethod() { - return HttpHeaders.accessControlRequestMethod(); + return HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD; } public String age() { - return HttpHeaders.age(); + return HttpHeaders.AGE; } public String allow() { - return HttpHeaders.allow(); + return HttpHeaders.ALLOW; } public String authorization() { - return HttpHeaders.authorization(); + return HttpHeaders.AUTHORIZATION; } public String cacheControl() { - return HttpHeaders.cacheControl(); + return HttpHeaders.CACHE_CONTROL; } public String connection() { - return HttpHeaders.connection(); + return HttpHeaders.CONNECTION; } public String contentEncoding() { - return HttpHeaders.contentEncoding(); + return HttpHeaders.CONTENT_ENCODING; } public String contentDisposition() { - return HttpHeaders.contentDisposition(); + return HttpHeaders.CONTENT_DISPOSITION; } public String contentLanguage() { - return HttpHeaders.contentLanguage(); + return HttpHeaders.CONTENT_LANGUAGE; } public String contentLength() { - return HttpHeaders.contentLength(); + return HttpHeaders.CONTENT_LENGTH; } public String contentLocation() { - return HttpHeaders.contentLocation(); + return HttpHeaders.CONTENT_LOCATION; } public String contentRange() { - return HttpHeaders.contentRange(); + return HttpHeaders.CONTENT_RANGE; } public String contentType() { - return HttpHeaders.contentType(); + return HttpHeaders.CONTENT_TYPE; } public String cookie() { - return HttpHeaders.cookie(); + return HttpHeaders.COOKIE; } public String date() { - return HttpHeaders.date(); + return HttpHeaders.DATE; } public String etag() { - return HttpHeaders.etag(); + return HttpHeaders.ETAG; } public String expect() { - return HttpHeaders.expect(); + return HttpHeaders.EXPECT; } public String expires() { - return HttpHeaders.expires(); + return HttpHeaders.EXPIRES; } public String from() { - return HttpHeaders.from(); + return HttpHeaders.FROM; } public String host() { - return HttpHeaders.host(); + return HttpHeaders.HOST; } public String ifMatch() { - return HttpHeaders.ifMatch(); + return HttpHeaders.IF_MATCH; } public String ifModifiedSince() { - return HttpHeaders.ifModifiedSince(); + return HttpHeaders.IF_MODIFIED_SINCE; } public String ifNoneMatch() { - return HttpHeaders.ifNoneMatch(); + return HttpHeaders.IF_NONE_MATCH; } public String ifRange() { - return HttpHeaders.ifRange(); + return HttpHeaders.IF_RANGE; } public String ifUnmodifiedSince() { - return HttpHeaders.ifUnmodifiedSince(); + return HttpHeaders.IF_UNMODIFIED_SINCE; } public String lastModified() { - return HttpHeaders.lastModified(); + return HttpHeaders.LAST_MODIFIED; } public String link() { - return HttpHeaders.link(); + return HttpHeaders.LINK; } public String location() { - return HttpHeaders.location(); + return HttpHeaders.LOCATION; } public String max_forwards() { - return HttpHeaders.max_forwards(); + return HttpHeaders.MAX_FORWARDS; } public String origin() { - return HttpHeaders.origin(); + return HttpHeaders.ORIGIN; } public String pragma() { - return HttpHeaders.pragma(); + return HttpHeaders.PRAGMA; } public String proxyAuthenticate() { - return HttpHeaders.proxyAuthenticate(); + return HttpHeaders.PROXY_AUTHENTICATE; } public String proxyAuthorization() { - return HttpHeaders.proxyAuthorization(); + return HttpHeaders.PROXY_AUTHORIZATION; } public String range() { - return HttpHeaders.range(); + return HttpHeaders.RANGE; } public String referer() { - return HttpHeaders.referer(); + return HttpHeaders.REFERER; } public String retryAfter() { - return HttpHeaders.retryAfter(); + return HttpHeaders.RETRY_AFTER; } public String server() { - return HttpHeaders.server(); + return HttpHeaders.SERVER; } public String setCookie() { - return HttpHeaders.setCookie(); + return HttpHeaders.SET_COOKIE; } public String setCookie2() { - return HttpHeaders.setCookie2(); + return HttpHeaders.SET_COOKIE_2; } public String te() { - return HttpHeaders.te(); + return HttpHeaders.TE; } public String trailer() { - return HttpHeaders.trailer(); + return HttpHeaders.TRAILER; } public String transferEncoding() { - return HttpHeaders.transferEncoding(); + return HttpHeaders.TRANSFER_ENCODING; } public String upgrade() { - return HttpHeaders.upgrade(); + return HttpHeaders.UPGRADE; } public String user_agent() { - return HttpHeaders.user_agent(); + return HttpHeaders.USER_AGENT; } public String vary() { - return HttpHeaders.vary(); + return HttpHeaders.VARY; } public String via() { - return HttpHeaders.via(); + return HttpHeaders.VIA; } public String warning() { - return HttpHeaders.warning(); + return HttpHeaders.WARNING; } public String wwwAuthenticate() { - return HttpHeaders.wwwAuthenticate(); + return HttpHeaders.WWW_AUTHENTICATE; } public String allValue() { - return mediaTypes.allValue(); + return MediaTypes.ALL_VALUE; } public String applicationAtomXml() { - return mediaTypes.applicationAtomXml(); + return MediaTypes.APPLICATION_ATOM_XML; } public String applicationFormUrlencoded() { - return mediaTypes.applicationFormUrlencoded(); + return MediaTypes.APPLICATION_FORM_URLENCODED; } public String applicationJson() { - return mediaTypes.applicationJson(); + return MediaTypes.APPLICATION_JSON; } public String applicationJsonUtf8() { - return mediaTypes.applicationJsonUtf8(); + return MediaTypes.APPLICATION_JSON_UTF8; } public String applicationOctetStream() { - return mediaTypes.applicationOctetStream(); + return MediaTypes.APPLICATION_OCTET_STREAM; } public String applicationPdf() { - return mediaTypes.applicationPdf(); + return MediaTypes.APPLICATION_PDF; } public String applicationXhtmlXml() { - return mediaTypes.applicationXhtmlXml(); + return MediaTypes.APPLICATION_XHTML_XML; } public String applicationXml() { - return mediaTypes.applicationXml(); + return MediaTypes.APPLICATION_XML; } public String imageGif() { - return mediaTypes.imageGif(); + return MediaTypes.IMAGE_GIF; } public String imageJpeg() { - return mediaTypes.imageJpeg(); + return MediaTypes.IMAGE_JPEG; } public String imagePng() { - return mediaTypes.imagePng(); + return MediaTypes.IMAGE_PNG; } public String multipartFormData() { - return mediaTypes.multipartFormData(); + return MediaTypes.MULTIPART_FORM_DATA; } public String textHtml() { - return mediaTypes.textHtml(); + return MediaTypes.TEXT_HTML; } public String textMarkdown() { - return mediaTypes.textMarkdown(); + return MediaTypes.TEXT_MARKDOWN; } public String textPlain() { - return mediaTypes.textPlain(); + return MediaTypes.TEXT_PLAIN; } public String textXml() { - return mediaTypes.textXml(); + return MediaTypes.TEXT_XML; } } diff --git a/specs/spring-cloud-contract-spec-java/src/main/java/org/springframework/cloud/contract/spec/internal/HttpHeaders.java b/specs/spring-cloud-contract-spec-java/src/main/java/org/springframework/cloud/contract/spec/internal/HttpHeaders.java index a110b1dadf..f4c372910a 100644 --- a/specs/spring-cloud-contract-spec-java/src/main/java/org/springframework/cloud/contract/spec/internal/HttpHeaders.java +++ b/specs/spring-cloud-contract-spec-java/src/main/java/org/springframework/cloud/contract/spec/internal/HttpHeaders.java @@ -25,537 +25,1062 @@ package org.springframework.cloud.contract.spec.internal; */ public final class HttpHeaders { - public HttpHeaders() { - System.out.println("WARNING: HttpHeaders shouldn't be instantiated"); - } - /** * @return The HTTP {@code Accept} header field name. * @see Section 5.3.2 of * RFC 7231 */ - public static String accept() { - return "Accept"; - } + public static final String ACCEPT = "Accept"; /** * @return The HTTP {@code Accept-Charset} header field name. * @see Section 5.3.3 of * RFC 7231 */ - public static String acceptCharset() { - return "Accept-Charset"; - } + public static final String ACCEPT_CHARSET = "Accept-Charset"; /** * @return The HTTP {@code Accept-Encoding} header field name. * @see Section 5.3.4 of * RFC 7231 */ - public static String acceptEncoding() { - return "Accept-Encoding"; - } + public static final String ACCEPT_ENCODING = "Accept-Encoding"; /** * @return The HTTP {@code Accept-Language} header field name. * @see Section 5.3.5 of * RFC 7231 */ - public static String acceptLanguage() { - return "Accept-Language"; - } + public static final String ACCEPT_LANGUAGE = "Accept-Language"; /** * @return The HTTP {@code Accept-Ranges} header field name. * @see Section 5.3.5 of RFC * 7233 */ - public static String acceptRanges() { - return "Accept-Ranges"; - } + public static final String ACCEPT_RANGES = "Accept-Ranges"; /** * @return The CORS {@code Access-Control-Allow-Credentials} response header field * name. * @see CORS W3C recommendation */ - public static String accessControlAllowCredentials() { - return "Access-Control-Allow-Credentials"; - } + public static final String ACCESS_CONTROL_ALLOW_CREDENTIALS = "Access-Control-Allow-Credentials"; /** * @return The CORS {@code Access-Control-Allow-Headers} response header field name. * @see CORS W3C recommendation */ - public static String accessControlAllowHeaders() { - return "Access-Control-Allow-Headers"; - } + public static final String ACCESS_CONTROL_ALLOW_HEADERS = "Access-Control-Allow-Headers"; /** * @return The CORS {@code Access-Control-Allow-Methods} response header field name. * @see CORS W3C recommendation */ - public static String accessControlAllowMethods() { - return "Access-Control-Allow-Methods"; - } + public static final String ACCESS_CONTROL_ALLOW_METHODS = "Access-Control-Allow-Methods"; /** * @return The CORS {@code Access-Control-Allow-Origin} response header field name. * @see CORS W3C recommendation */ - public static String accessControlAllowOrigin() { - return "Access-Control-Allow-Origin"; - } + public static final String ACCESS_CONTROL_ALLOW_ORIGIN = "Access-Control-Allow-Origin"; /** * @return The CORS {@code Access-Control-Expose-Headers} response header field name. * @see CORS W3C recommendation */ - public static String accessControlExposeHeaders() { - return "Access-Control-Expose-Headers"; - } + public static final String ACCESS_CONTROL_EXPOSE_HEADERS = "Access-Control-Expose-Headers"; /** * @return The CORS {@code Access-Control-Max-Age} response header field name. * @see CORS W3C recommendation */ - public static String accessControlMaxAge() { - return "Access-Control-Max-Age"; - } + public static final String ACCESS_CONTROL_MAX_AGE = "Access-Control-Max-Age"; /** * @return The CORS {@code Access-Control-Request-Headers} request header field name. * @see CORS W3C recommendation */ - public static String accessControlRequestHeaders() { - return "Access-Control-Request-Headers"; - } + public static final String ACCESS_CONTROL_REQUEST_HEADERS = "Access-Control-Request-Headers"; /** * @return The CORS {@code Access-Control-Request-Method} request header field name. * @see CORS W3C recommendation */ - public static String accessControlRequestMethod() { - return "Access-Control-Request-Method"; - } + public static final String ACCESS_CONTROL_REQUEST_METHOD = "Access-Control-Request-Method"; /** * @return The HTTP {@code Age} header field name. * @see Section 5.1 of RFC * 7234 */ - public static String age() { - return "Age"; - } + public static final String AGE = "Age"; /** * @return The HTTP {@code Allow} header field name. * @see Section 7.4.1 of * RFC 7231 */ - public static String allow() { - return "Allow"; - } + public static final String ALLOW = "Allow"; /** * @return The HTTP {@code Authorization} header field name. * @see Section 4.2 of RFC * 7235 */ - public static String authorization() { - return "Authorization"; - } + public static final String AUTHORIZATION = "Authorization"; /** * @return The HTTP {@code Cache-Control} header field name. * @see Section 5.2 of RFC * 7234 */ - public static String cacheControl() { - return "Cache-Control"; - } + public static final String CACHE_CONTROL = "Cache-Control"; /** * @return The HTTP {@code Connection} header field name. * @see Section 6.1 of RFC * 7230 */ - public static String connection() { - return "Connection"; - } + public static final String CONNECTION = "Connection"; /** * @return The HTTP {@code Content-Encoding} header field name. * @see Section 3.1.2.2 * of RFC 7231 */ - public static String contentEncoding() { - return "Content-Encoding"; - } + public static final String CONTENT_ENCODING = "Content-Encoding"; /** * @return The HTTP {@code Content-Disposition} header field name * @see RFC 6266 */ - public static String contentDisposition() { - return "Content-Disposition"; - } + public static final String CONTENT_DISPOSITION = "Content-Disposition"; /** * @return The HTTP {@code Content-Language} header field name. * @see Section 3.1.3.2 * of RFC 7231 */ - public static String contentLanguage() { - return "Content-Language"; - } + public static final String CONTENT_LANGUAGE = "Content-Language"; /** * @return The HTTP {@code Content-Length} header field name. * @see Section 3.3.2 of * RFC 7230 */ - public static String contentLength() { - return "Content-Length"; - } + public static final String CONTENT_LENGTH = "Content-Length"; /** * @return The HTTP {@code Content-Location} header field name. * @see Section 3.1.4.2 * of RFC 7231 */ - public static String contentLocation() { - return "Content-Location"; - } + public static final String CONTENT_LOCATION = "Content-Location"; /** * @return The HTTP {@code Content-Range} header field name. * @see Section 4.2 of RFC * 7233 */ - public static String contentRange() { - return "Content-Range"; - } + public static final String CONTENT_RANGE = "Content-Range"; /** * @return The HTTP {@code Content-Type} header field name. * @see Section 3.1.1.5 * of RFC 7231 */ - public static String contentType() { - return "Content-Type"; - } + public static final String CONTENT_TYPE = "Content-Type"; /** * @return The HTTP {@code Cookie} header field name. * @see Section 4.3.4 of * RFC 2109 */ - public static String cookie() { - return "Cookie"; - } + public static final String COOKIE = "Cookie"; /** * @return The HTTP {@code Date} header field name. * @see Section 7.1.1.2 * of RFC 7231 */ - public static String date() { - return "Date"; - } + public static final String DATE = "Date"; /** * @return The HTTP {@code ETag} header field name. * @see Section 2.3 of RFC * 7232 */ - public static String etag() { - return "ETag"; - } + public static final String ETAG = "ETag"; /** * @return The HTTP {@code Expect} header field name. * @see Section 5.1.1 of * RFC 7231 */ - public static String expect() { - return "Expect"; - } + public static final String EXPECT = "Expect"; /** * @return The HTTP {@code Expires} header field name. * @see Section 5.3 of RFC * 7234 */ - public static String expires() { - return "Expires"; - } + public static final String EXPIRES = "Expires"; /** * @return The HTTP {@code From} header field name. * @see Section 5.5.1 of * RFC 7231 */ - public static String from() { - return "From"; - } + public static final String FROM = "From"; /** * @return The HTTP {@code Host} header field name. * @see Section 5.4 of RFC * 7230 */ - public static String host() { - return "Host"; - } + public static final String HOST = "Host"; /** * @return The HTTP {@code If-Match} header field name. * @see Section 3.1 of RFC * 7232 */ - public static String ifMatch() { - return "If-Match"; - } + public static final String IF_MATCH = "If-Match"; /** * @return The HTTP {@code If-Modified-Since} header field name. * @see Section 3.3 of RFC * 7232 */ - public static String ifModifiedSince() { - return "If-Modified-Since"; - } + public static final String IF_MODIFIED_SINCE = "If-Modified-Since"; /** * @return The HTTP {@code If-None-Match} header field name. * @see Section 3.2 of RFC * 7232 */ - public static String ifNoneMatch() { - return "If-None-Match"; - } + public static final String IF_NONE_MATCH = "If-None-Match"; /** * @return The HTTP {@code If-Range} header field name. * @see Section 3.2 of RFC * 7233 */ - public static String ifRange() { - return "If-Range"; - } + public static final String IF_RANGE = "If-Range"; /** * @return The HTTP {@code If-Unmodified-Since} header field name. * @see Section 3.4 of RFC * 7232 */ - public static String ifUnmodifiedSince() { - return "If-Unmodified-Since"; - } + public static final String IF_UNMODIFIED_SINCE = "If-Unmodified-Since"; /** * @return The HTTP {@code Last-Modified} header field name. * @see Section 2.2 of RFC * 7232 */ - public static String lastModified() { - return "Last-Modified"; - } + public static final String LAST_MODIFIED = "Last-Modified"; /** * @return The HTTP {@code Link} header field name. * @see RFC 5988 */ - public static String link() { - return "Link"; - } + public static final String LINK = "Link"; /** * @return The HTTP {@code Location} header field name. * @see Section 7.1.2 of * RFC 7231 */ - public static String location() { - return "Location"; - } + public static final String LOCATION = "Location"; /** * @return The HTTP {@code Max-Forwards} header field name. * @see Section 5.1.2 of * RFC 7231 */ - public static String max_forwards() { - return "Max-Forwards"; - } + public static final String MAX_FORWARDS = "Max-Forwards"; /** * @return The HTTP {@code Origin} header field name. * @see RFC 6454 */ - public static String origin() { - return "Origin"; - } + public static final String ORIGIN = "Origin"; /** * @return The HTTP {@code Pragma} header field name. * @see Section 5.4 of RFC * 7234 */ - public static String pragma() { - return "Pragma"; - } + public static final String PRAGMA = "Pragma"; /** * @return The HTTP {@code Proxy-Authenticate} header field name. * @see Section 4.3 of RFC * 7235 */ - public static String proxyAuthenticate() { - return "Proxy-Authenticate"; - } + public static final String PROXY_AUTHENTICATE = "Proxy-Authenticate"; /** * @return The HTTP {@code Proxy-Authorization} header field name. * @see Section 4.4 of RFC * 7235 */ - public static String proxyAuthorization() { - return "Proxy-Authorization"; - } + public static final String PROXY_AUTHORIZATION = "Proxy-Authorization"; /** * @return The HTTP {@code Range} header field name. * @see Section 3.1 of RFC * 7233 */ - public static String range() { - return "Range"; - } + public static final String RANGE = "Range"; /** * @return The HTTP {@code Referer} header field name. * @see Section 5.5.2 of * RFC 7231 */ - public static String referer() { - return "Referer"; - } + public static final String REFERER = "Referer"; /** * @return The HTTP {@code Retry-After} header field name. * @see Section 7.1.3 of * RFC 7231 */ - public static String retryAfter() { - return "Retry-After"; - } + public static final String RETRY_AFTER = "Retry-After"; /** * @return The HTTP {@code Server} header field name. * @see Section 7.4.2 of * RFC 7231 */ - public static String server() { - return "Server"; - } + public static final String SERVER = "Server"; /** * @return The HTTP {@code Set-Cookie} header field name. * @see Section 4.2.2 of * RFC 2109 */ - public static String setCookie() { - return "Set-Cookie"; - } + public static final String SET_COOKIE = "Set-Cookie"; /** * @return The HTTP {@code Set-Cookie2} header field name. * @see RFC 2965 */ - public static String setCookie2() { - return "Set-Cookie2"; - } + public static final String SET_COOKIE_2 = "Set-Cookie2"; /** * @return The HTTP {@code TE} header field name. * @see Section 4.3 of RFC * 7230 */ - public static String te() { - return "TE"; - } + public static final String TE = "TE"; /** * @return The HTTP {@code Trailer} header field name. * @see Section 4.4 of RFC * 7230 */ - public static String trailer() { - return "Trailer"; - } + public static final String TRAILER = "Trailer"; /** * @return The HTTP {@code Transfer-Encoding} header field name. * @see Section 3.3.1 of * RFC 7230 */ - public static String transferEncoding() { - return "Transfer-Encoding"; - } + public static final String TRANSFER_ENCODING = "Transfer-Encoding"; /** * @return The HTTP {@code Upgrade} header field name. * @see Section 6.7 of RFC * 7230 */ - public static String upgrade() { - return "Upgrade"; - } + public static final String UPGRADE = "Upgrade"; /** * @return The HTTP {@code User-Agent} header field name. * @see Section 5.5.3 of * RFC 7231 */ - public static String user_agent() { - return "User-Agent"; - } + public static final String USER_AGENT = "User-Agent"; /** * @return The HTTP {@code Vary} header field name. * @see Section 7.1.4 of * RFC 7231 */ - public static String vary() { - return "Vary"; - } + public static final String VARY = "Vary"; /** * @return The HTTP {@code Via} header field name. * @see Section 5.7.1 of * RFC 7230 */ - public static String via() { - return "Via"; - } + public static final String VIA = "Via"; /** * @return The HTTP {@code Warning} header field name. * @see Section 5.5 of RFC * 7234 */ - public static String warning() { - return "Warning"; - } + public static final String WARNING = "Warning"; /** * @return The HTTP {@code WWW-Authenticate} header field name. * @see Section 4.1 of RFC * 7235 */ - public static String wwwAuthenticate() { - return "WWW-Authenticate"; + public static final String WWW_AUTHENTICATE = "WWW-Authenticate"; + + /** + * @return The HTTP {@code Accept} header field name. + * @see Section 5.3.2 of + * RFC 7231 + * @deprecated Replaced by {@code HttpHeaders.ACCEPT}. + */ + @Deprecated + public String accept() { + return ACCEPT; + } + + /** + * @return The HTTP {@code Accept-Charset} header field name. + * @see Section 5.3.3 of + * RFC 7231 + * @deprecated Replaced by {@code HttpHeaders.ACCEPT_CHARSET}. + */ + @Deprecated + public String acceptCharset() { + return ACCEPT_CHARSET; + } + + /** + * @return The HTTP {@code Accept-Encoding} header field name. + * @see Section 5.3.4 of + * RFC 7231 + * @deprecated Replaced by {@code HttpHeaders.ACCEPT_ENCODING}. + */ + @Deprecated + public String acceptEncoding() { + return ACCEPT_ENCODING; + } + + /** + * @return The HTTP {@code Accept-Language} header field name. + * @see Section 5.3.5 of + * RFC 7231 + * @deprecated Replaced by {@code HttpHeaders.ACCEPT_LANGUAGE}. + */ + @Deprecated + public String acceptLanguage() { + return ACCEPT_LANGUAGE; + } + + /** + * @return The HTTP {@code Accept-Ranges} header field name. + * @see Section 5.3.5 of RFC + * 7233 + * @deprecated Replaced by {@code HttpHeaders.ACCEPT_RANGES}. + */ + @Deprecated + public String acceptRanges() { + return ACCEPT_RANGES; + } + + /** + * @return The CORS {@code Access-Control-Allow-Credentials} response header field + * name. + * @see CORS W3C recommendation + * @deprecated Replaced by {@code HttpHeaders.ACCESS_CONTROL_ALLOW_CREDENTIALS}. + */ + @Deprecated + public String accessControlAllowCredentials() { + return ACCESS_CONTROL_ALLOW_CREDENTIALS; + } + + /** + * @return The CORS {@code Access-Control-Allow-Headers} response header field name. + * @see CORS W3C recommendation + * @deprecated Replaced by {@code HttpHeaders.ACCESS_CONTROL_ALLOW_HEADERS}. + */ + @Deprecated + public String accessControlAllowHeaders() { + return ACCESS_CONTROL_ALLOW_HEADERS; + } + + /** + * @return The CORS {@code Access-Control-Allow-Methods} response header field name. + * @see CORS W3C recommendation + * @deprecated Replaced by {@code HttpHeaders.ACCESS_CONTROL_ALLOW_METHODS}. + */ + @Deprecated + public String accessControlAllowMethods() { + return ACCESS_CONTROL_ALLOW_METHODS; + } + + /** + * @return The CORS {@code Access-Control-Allow-Origin} response header field name. + * @see CORS W3C recommendation + * @deprecated Replaced by {@code HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN}. + */ + @Deprecated + public String accessControlAllowOrigin() { + return ACCESS_CONTROL_ALLOW_ORIGIN; + } + + /** + * @return The CORS {@code Access-Control-Expose-Headers} response header field name. + * @see CORS W3C recommendation + * @deprecated Replaced by {@code HttpHeaders.ACCESS_CONTROL_EXPOSE_HEADERS}. + */ + @Deprecated + public String accessControlExposeHeaders() { + return ACCESS_CONTROL_EXPOSE_HEADERS; + } + + /** + * @return The CORS {@code Access-Control-Max-Age} response header field name. + * @see CORS W3C recommendation + * @deprecated Replaced by {@code HttpHeaders.ACCESS_CONTROL_MAX_AGE}. + */ + @Deprecated + public String accessControlMaxAge() { + return ACCESS_CONTROL_MAX_AGE; + } + + /** + * @return The CORS {@code Access-Control-Request-Headers} request header field name. + * @see CORS W3C recommendation + * @deprecated Replaced by {@code HttpHeaders.ACCESS_CONTROL_REQUEST_HEADERS}. + */ + @Deprecated + public String accessControlRequestHeaders() { + return ACCESS_CONTROL_REQUEST_HEADERS; + } + + /** + * @return The CORS {@code Access-Control-Request-Method} request header field name. + * @see CORS W3C recommendation + * @deprecated Replaced by {@code HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD}. + */ + @Deprecated + public String accessControlRequestMethod() { + return ACCESS_CONTROL_REQUEST_METHOD; + } + + /** + * @return The HTTP {@code Age} header field name. + * @see Section 5.1 of RFC + * 7234 + * @deprecated Replaced by {@code HttpHeaders.AGE}. + */ + @Deprecated + public String age() { + return AGE; + } + + /** + * @return The HTTP {@code Allow} header field name. + * @see Section 7.4.1 of + * RFC 7231 + * @deprecated Replaced by {@code HttpHeaders.ALLOW}. + */ + @Deprecated + public String allow() { + return ALLOW; + } + + /** + * @return The HTTP {@code Authorization} header field name. + * @see Section 4.2 of RFC + * 7235 + * @deprecated Replaced by {@code HttpHeaders.AUTHORIZATION}. + */ + @Deprecated + public String authorization() { + return AUTHORIZATION; + } + + /** + * @return The HTTP {@code Cache-Control} header field name. + * @see Section 5.2 of RFC + * 7234 + * @deprecated Replaced by {@code HttpHeaders.CACHE_CONTROL}. + */ + @Deprecated + public String cacheControl() { + return CACHE_CONTROL; + } + + /** + * @return The HTTP {@code Connection} header field name. + * @see Section 6.1 of RFC + * 7230 + * @deprecated Replaced by {@code HttpHeaders.CONNECTION}. + */ + @Deprecated + public String connection() { + return CONNECTION; + } + + /** + * @return The HTTP {@code Content-Encoding} header field name. + * @see Section 3.1.2.2 + * of RFC 7231 + * @deprecated Replaced by {@code HttpHeaders.CONTENT_ENCODING}. + */ + @Deprecated + public String contentEncoding() { + return CONTENT_ENCODING; + } + + /** + * @return The HTTP {@code Content-Disposition} header field name + * @see RFC 6266 + * @deprecated Replaced by {@code HttpHeaders.CONTENT_DISPOSITION}. + */ + @Deprecated + public String contentDisposition() { + return CONTENT_DISPOSITION; + } + + /** + * @return The HTTP {@code Content-Language} header field name. + * @see Section 3.1.3.2 + * of RFC 7231 + * @deprecated Replaced by {@code HttpHeaders.CONTENT_LANGUAGE}. + */ + @Deprecated + public String contentLanguage() { + return CONTENT_LANGUAGE; + } + + /** + * @return The HTTP {@code Content-Length} header field name. + * @see Section 3.3.2 of + * RFC 7230 + * @deprecated Replaced by {@code HttpHeaders.CONTENT_LENGTH}. + */ + @Deprecated + public String contentLength() { + return CONTENT_LENGTH; + } + + /** + * @return The HTTP {@code Content-Location} header field name. + * @see Section 3.1.4.2 + * of RFC 7231 + * @deprecated Replaced by {@code HttpHeaders.CONTENT_LOCATION}. + */ + @Deprecated + public String contentLocation() { + return CONTENT_LOCATION; + } + + /** + * @return The HTTP {@code Content-Range} header field name. + * @see Section 4.2 of RFC + * 7233 + * @deprecated Replaced by {@code HttpHeaders.CONTENT_RANGE}. + */ + @Deprecated + public String contentRange() { + return CONTENT_RANGE; + } + + /** + * @return The HTTP {@code Content-Type} header field name. + * @see Section 3.1.1.5 + * of RFC 7231 + * @deprecated Replaced by {@code HttpHeaders.CONTENT_TYPE}. + */ + @Deprecated + public String contentType() { + return CONTENT_TYPE; + } + + /** + * @return The HTTP {@code Cookie} header field name. + * @see Section 4.3.4 of + * RFC 2109 + * @deprecated Replaced by {@code HttpHeaders.COOKIE}. + */ + @Deprecated + public String cookie() { + return COOKIE; + } + + /** + * @return The HTTP {@code Date} header field name. + * @see Section 7.1.1.2 + * of RFC 7231 + * @deprecated Replaced by {@code HttpHeaders.DATE}. + */ + @Deprecated + public String date() { + return DATE; + } + + /** + * @return The HTTP {@code ETag} header field name. + * @see Section 2.3 of RFC + * 7232 + * @deprecated Replaced by {@code HttpHeaders.ETAG}. + */ + @Deprecated + public String etag() { + return ETAG; + } + + /** + * @return The HTTP {@code Expect} header field name. + * @see Section 5.1.1 of + * RFC 7231 + * @deprecated Replaced by {@code HttpHeaders.EXPECT}. + */ + @Deprecated + public String expect() { + return EXPECT; + } + + /** + * @return The HTTP {@code Expires} header field name. + * @see Section 5.3 of RFC + * 7234 + * @deprecated Replaced by {@code HttpHeaders.EXPIRES}. + */ + @Deprecated + public String expires() { + return EXPIRES; + } + + /** + * @return The HTTP {@code From} header field name. + * @see Section 5.5.1 of + * RFC 7231 + * @deprecated Replaced by {@code HttpHeaders.FROM}. + */ + @Deprecated + public String from() { + return FROM; + } + + /** + * @return The HTTP {@code Host} header field name. + * @see Section 5.4 of RFC + * 7230 + * @deprecated Replaced by {@code HttpHeaders.HOST}. + */ + @Deprecated + public String host() { + return HOST; + } + + /** + * @return The HTTP {@code If-Match} header field name. + * @see Section 3.1 of RFC + * 7232 + * @deprecated Replaced by {@code HttpHeaders.IF_MATCH}. + */ + @Deprecated + public String ifMatch() { + return IF_MATCH; + } + + /** + * @return The HTTP {@code If-Modified-Since} header field name. + * @see Section 3.3 of RFC + * 7232 + * @deprecated Replaced by {@code HttpHeaders.IF_MODIFIED_SINCE}. + */ + @Deprecated + public String ifModifiedSince() { + return IF_MODIFIED_SINCE; + } + + /** + * @return The HTTP {@code If-None-Match} header field name. + * @see Section 3.2 of RFC + * 7232 + * @deprecated Replaced by {@code HttpHeaders.IF_NONE_MATCH}. + */ + @Deprecated + public String ifNoneMatch() { + return IF_NONE_MATCH; + } + + /** + * @return The HTTP {@code If-Range} header field name. + * @see Section 3.2 of RFC + * 7233 + * @deprecated Replaced by {@code HttpHeaders.IF_RANGE}. + */ + @Deprecated + public String ifRange() { + return IF_RANGE; + } + + /** + * @return The HTTP {@code If-Unmodified-Since} header field name. + * @see Section 3.4 of RFC + * 7232 + * @deprecated Replaced by {@code HttpHeaders.IF_UNMODIFIED_SINCE}. + */ + @Deprecated + public String ifUnmodifiedSince() { + return IF_UNMODIFIED_SINCE; + } + + /** + * @return The HTTP {@code Last-Modified} header field name. + * @see Section 2.2 of RFC + * 7232 + * @deprecated Replaced by {@code HttpHeaders.LAST_MODIFIED}. + */ + @Deprecated + public String lastModified() { + return LAST_MODIFIED; + } + + /** + * @return The HTTP {@code Link} header field name. + * @see RFC 5988 + * @deprecated Replaced by {@code HttpHeaders.LINK}. + */ + @Deprecated + public String link() { + return LINK; + } + + /** + * @return The HTTP {@code Location} header field name. + * @see Section 7.1.2 of + * RFC 7231 + * @deprecated Replaced by {@code HttpHeaders.LOCATION}. + */ + @Deprecated + public String location() { + return LOCATION; + } + + /** + * @return The HTTP {@code Max-Forwards} header field name. + * @see Section 5.1.2 of + * RFC 7231 + * @deprecated Replaced by {@code HttpHeaders.MAX_FORWARDS}. + */ + @Deprecated + public String max_forwards() { + return MAX_FORWARDS; + } + + /** + * @return The HTTP {@code Origin} header field name. + * @see RFC 6454 + * @deprecated Replaced by {@code HttpHeaders.ORIGIN}. + */ + @Deprecated + public String origin() { + return ORIGIN; + } + + /** + * @return The HTTP {@code Pragma} header field name. + * @see Section 5.4 of RFC + * 7234 + * @deprecated Replaced by {@code HttpHeaders.PRAGMA}. + */ + @Deprecated + public String pragma() { + return PRAGMA; + } + + /** + * @return The HTTP {@code Proxy-Authenticate} header field name. + * @see Section 4.3 of RFC + * 7235 + * @deprecated Replaced by {@code HttpHeaders.PROXY_AUTHENTICATE}. + */ + @Deprecated + public String proxyAuthenticate() { + return PROXY_AUTHENTICATE; + } + + /** + * @return The HTTP {@code Proxy-Authorization} header field name. + * @see Section 4.4 of RFC + * 7235 + * @deprecated Replaced by {@code HttpHeaders.PROXY_AUTHORIZATION}. + */ + @Deprecated + public String proxyAuthorization() { + return PROXY_AUTHORIZATION; + } + + /** + * @return The HTTP {@code Range} header field name. + * @see Section 3.1 of RFC + * 7233 + * @deprecated Replaced by {@code HttpHeaders.RANGE}. + */ + @Deprecated + public String range() { + return RANGE; + } + + /** + * @return The HTTP {@code Referer} header field name. + * @see Section 5.5.2 of + * RFC 7231 + * @deprecated Replaced by {@code HttpHeaders.REFERER}. + */ + @Deprecated + public String referer() { + return REFERER; + } + + /** + * @return The HTTP {@code Retry-After} header field name. + * @see Section 7.1.3 of + * RFC 7231 + * @deprecated Replaced by {@code HttpHeaders.RETRY_AFTER}. + */ + @Deprecated + public String retryAfter() { + return RETRY_AFTER; + } + + /** + * @return The HTTP {@code Server} header field name. + * @see Section 7.4.2 of + * RFC 7231 + * @deprecated Replaced by {@code HttpHeaders.server}. + */ + @Deprecated + public String server() { + return SERVER; + } + + /** + * @return The HTTP {@code Set-Cookie} header field name. + * @see Section 4.2.2 of + * RFC 2109 + * @deprecated Replaced by {@code HttpHeaders.SET_COOKIE}. + */ + @Deprecated + public String setCookie() { + return SET_COOKIE; + } + + /** + * @return The HTTP {@code Set-Cookie2} header field name. + * @see RFC 2965 + * @deprecated Replaced by {@code HttpHeaders.SET_COOKIE_2}. + */ + @Deprecated + public String setCookie2() { + return SET_COOKIE_2; + } + + /** + * @return The HTTP {@code TE} header field name. + * @see Section 4.3 of RFC + * 7230 + * @deprecated Replaced by {@code HttpHeaders.TE}. + */ + @Deprecated + public String te() { + return TE; + } + + /** + * @return The HTTP {@code Trailer} header field name. + * @see Section 4.4 of RFC + * 7230 + * @deprecated Replaced by {@code HttpHeaders.TRAILER}. + */ + @Deprecated + public String trailer() { + return TRAILER; + } + + /** + * @return The HTTP {@code Transfer-Encoding} header field name. + * @see Section 3.3.1 of + * RFC 7230 + * @deprecated Replaced by {@code HttpHeaders.TRANSFER_ENCODING}. + */ + @Deprecated + public String transferEncoding() { + return TRANSFER_ENCODING; + } + + /** + * @return The HTTP {@code Upgrade} header field name. + * @see Section 6.7 of RFC + * 7230 + * @deprecated Replaced by {@code HttpHeaders.UPGRADE}. + */ + @Deprecated + public String upgrade() { + return UPGRADE; + } + + /** + * @return The HTTP {@code User-Agent} header field name. + * @see Section 5.5.3 of + * RFC 7231 + * @deprecated Replaced by {@code HttpHeaders.USER_AGENT}. + */ + @Deprecated + public String user_agent() { + return USER_AGENT; + } + + /** + * @return The HTTP {@code Vary} header field name. + * @see Section 7.1.4 of + * RFC 7231 + * @deprecated Replaced by {@code HttpHeaders.VARY}. + */ + @Deprecated + public String vary() { + return VARY; + } + + /** + * @return The HTTP {@code Via} header field name. + * @see Section 5.7.1 of + * RFC 7230 + * @deprecated Replaced by {@code HttpHeaders.VIA}. + */ + @Deprecated + public String via() { + return VIA; + } + + /** + * @return The HTTP {@code Warning} header field name. + * @see Section 5.5 of RFC + * 7234 + * @deprecated Replaced by {@code HttpHeaders.WARNING}. + */ + @Deprecated + public String warning() { + return WARNING; + } + + /** + * @return The HTTP {@code WWW-Authenticate} header field name. + * @see Section 4.1 of RFC + * 7235 + * @deprecated Replaced by {@code HttpHeaders.WWW_AUTHENTICATE}. + */ + @Deprecated + public String wwwAuthenticate() { + return WWW_AUTHENTICATE; } } diff --git a/specs/spring-cloud-contract-spec-java/src/main/java/org/springframework/cloud/contract/spec/internal/HttpMethods.java b/specs/spring-cloud-contract-spec-java/src/main/java/org/springframework/cloud/contract/spec/internal/HttpMethods.java index 5a4b40e70c..7c25d00174 100644 --- a/specs/spring-cloud-contract-spec-java/src/main/java/org/springframework/cloud/contract/spec/internal/HttpMethods.java +++ b/specs/spring-cloud-contract-spec-java/src/main/java/org/springframework/cloud/contract/spec/internal/HttpMethods.java @@ -25,69 +25,134 @@ package org.springframework.cloud.contract.spec.internal; */ public final class HttpMethods { - public HttpMethods() { - System.out.println("WARNING: HttpMethods shouldn't be instantiated"); - } - /** * @return {@code GET}. */ - public static HttpMethod GET() { + public static String GET = "GET"; + + /** + * @return {@code HEAD}. + */ + public static String HEAD = "HEAD"; + + /** + * @return {@code POST}. + */ + public static String POST = "POST"; + + /** + * @return {@code PUT}. + */ + public static String PUT = "PUT"; + + /** + * @return {@code PATCH}. + */ + public static String PATCH = "PATCH"; + + /** + * @return {@code DELETE}. + */ + public static String DELETE = "DELETE"; + + /** + * @return {@code OPTIONS}. + */ + public static String OPTIONS = "OPTIONS"; + + /** + * @return {@code TRACE}. + */ + public static String TRACE = "TRACE"; + + /** + * @return {@code GET}. + * @deprecated Replaced by {@code HttpMethods.GET}. + */ + @Deprecated + public HttpMethod GET() { return HttpMethod.GET; } /** * @return {@code HEAD}. + * @deprecated Replaced by {@code HttpMethods.HEAD}. */ - public static HttpMethod HEAD() { + @Deprecated + public HttpMethod HEAD() { return HttpMethod.HEAD; } /** * @return {@code POST}. + * @deprecated Replaced by {@code HttpMethods.POST}. */ - public static HttpMethod POST() { + @Deprecated + public HttpMethod POST() { return HttpMethod.POST; } /** * @return {@code PUT}. + * @deprecated Replaced by {@code HttpMethods.PUT}. */ - public static HttpMethod PUT() { + @Deprecated + public HttpMethod PUT() { return HttpMethod.PUT; } /** * @return {@code PATCH}. + * @deprecated Replaced by {@code HttpMethods.PATCH}. */ - public static HttpMethod PATCH() { + @Deprecated + public HttpMethod PATCH() { return HttpMethod.PATCH; } /** * @return {@code DELETE}. + * @deprecated Replaced by {@code HttpMethods.DELETE}. */ - public static HttpMethod DELETE() { + @Deprecated + public HttpMethod DELETE() { return HttpMethod.DELETE; } /** * @return {@code OPTIONS}. + * @deprecated Replaced by {@code HttpMethods.OPTIONS}. */ - public static HttpMethod OPTIONS() { + @Deprecated + public HttpMethod OPTIONS() { return HttpMethod.OPTIONS; } /** * @return {@code TRACE}. + * @deprecated Replaced by {@code HttpMethods.TRACE}. */ - public static HttpMethod TRACE() { + @Deprecated + public HttpMethod TRACE() { return HttpMethod.TRACE; } public enum HttpMethod { - GET, HEAD, POST, PUT, PATCH, DELETE, OPTIONS, TRACE; + GET(HttpMethods.GET), HEAD(HttpMethods.HEAD), POST(HttpMethods.POST), PUT( + HttpMethods.PUT), PATCH(HttpMethods.PATCH), DELETE( + HttpMethods.DELETE), OPTIONS( + HttpMethods.OPTIONS), TRACE(HttpMethods.TRACE),; + + private final String methodName; + + HttpMethod(String methodName) { + this.methodName = methodName; + } + + public String getMethodName() { + return methodName; + } } diff --git a/specs/spring-cloud-contract-spec-java/src/main/java/org/springframework/cloud/contract/spec/internal/HttpStatus.java b/specs/spring-cloud-contract-spec-java/src/main/java/org/springframework/cloud/contract/spec/internal/HttpStatus.java index 3d2b196c30..ec8a468460 100644 --- a/specs/spring-cloud-contract-spec-java/src/main/java/org/springframework/cloud/contract/spec/internal/HttpStatus.java +++ b/specs/spring-cloud-contract-spec-java/src/main/java/org/springframework/cloud/contract/spec/internal/HttpStatus.java @@ -25,159 +25,663 @@ package org.springframework.cloud.contract.spec.internal; */ public final class HttpStatus { - public HttpStatus() { - System.out.println("WARNING: HttpStatus shouldn't be instantiated"); - } - /** * @return {@code 100 Continue}. * @see HTTP/1.1: * Semantics and Content, section 6.2.1 */ - public static int CONTINUE() { - return 100; - } + public static final int CONTINUE = 100; /** * @return {@code 101 Switching Protocols}. * @see HTTP/1.1: * Semantics and Content, section 6.2.2 */ - public static int SWITCHING_PROTOCOLS() { - return 101; - } + public static final int SWITCHING_PROTOCOLS = 101; /** * @return {@code 102 Processing}. * @see WebDAV */ - public static int PROCESSING() { - return 102; - } + public static final int PROCESSING = 102; /** * @return {@code 103 Checkpoint}. * @see * A proposal for supporting resumable POST/PUT HTTP requests in HTTP/1.0 */ - public static int CHECKPOINT() { - return 103; - } + public static final int CHECKPOINT = 103; /** * @return {@code 200 OK}. * @see HTTP/1.1: * Semantics and Content, section 6.3.1 */ - public static int OK() { - return 200; - } + public static final int OK = 200; /** * @return {@code 201 Created}. * @see HTTP/1.1: * Semantics and Content, section 6.3.2 */ - public static int CREATED() { - return 201; - } + public static final int CREATED = 201; /** * @return {@code 202 Accepted}. * @see HTTP/1.1: * Semantics and Content, section 6.3.3 */ - public static int ACCEPTED() { - return 202; - } + public static final int ACCEPTED = 202; /** * @return {@code 203 Non-Authoritative Information}. * @see HTTP/1.1: * Semantics and Content, section 6.3.4 */ - public static int NON_AUTHORITATIVE_INFORMATION() { - return 203; - } + public static final int NON_AUTHORITATIVE_INFORMATION = 203; /** * @return {@code 204 No Content}. * @see HTTP/1.1: * Semantics and Content, section 6.3.5 */ - public static int NO_CONTENT() { - return 204; - } + public static final int NO_CONTENT = 204; /** * @return {@code 205 Reset Content}. * @see HTTP/1.1: * Semantics and Content, section 6.3.6 */ - public static int RESET_CONTENT() { - return 205; - } + public static final int RESET_CONTENT = 205; /** * @return {@code 206 Partial Content}. * @see HTTP/1.1: Range * Requests, section 4.1 */ - public static int PARTIAL_CONTENT() { - return 206; - } + public static final int PARTIAL_CONTENT = 206; /** * @return {@code 207 Multi-Status}. * @see WebDAV */ - public static int MULTI_STATUS() { - return 207; - } + public static final int MULTI_STATUS = 207; /** * @return {@code 208 Already Reported}. * @see WebDAV Binding * Extensions */ - public static int ALREADY_REPORTED() { - return 208; - } + public static final int ALREADY_REPORTED = 208; /** * @return {@code 226 IM Used}. * @see Delta encoding in * HTTP */ - public static int IM_USED() { - return 226; - } + public static final int IM_USED = 226; /** * @return {@code 300 Multiple Choices}. * @see HTTP/1.1: * Semantics and Content, section 6.4.1 */ - public static int MULTIPLE_CHOICES() { - return 300; - } + public static final int MULTIPLE_CHOICES = 300; /** * @return {@code 301 Moved Permanently}. * @see HTTP/1.1: * Semantics and Content, section 6.4.2 */ - public static int MOVED_PERMANENTLY() { - return 301; - } + public static final int MOVED_PERMANENTLY = 301; /** * @return {@code 302 Found}. * @see HTTP/1.1: * Semantics and Content, section 6.4.3 */ - public static int FOUND() { - return 302; + public static final int FOUND = 302; + + /** + * @return {@code 302 Moved Temporarily}. + * @see HTTP/1.0, section + * 9.3 + * @deprecated in favor of {@link #FOUND} which will be returned from + */ + @Deprecated + public static final int MOVED_TEMPORARILY = 302; + + /** + * @return {@code 303 See Other}. + * @see HTTP/1.1: + * Semantics and Content, section 6.4.4 + */ + public static final int SEE_OTHER = 303; + + /** + * @return {@code 304 Not Modified}. + * @see HTTP/1.1: + * Conditional Requests, section 4.1 + */ + public static final int NOT_MODIFIED = 304; + + /** + * @return {@code 305 Use Proxy}. + * @see HTTP/1.1: + * Semantics and Content, section 6.4.5 + * @deprecated due to security concerns regarding in-band configuration of a proxy + */ + @Deprecated + public static final int USE_PROXY = 305; + + /** + * @return {@code 307 Temporary Redirect}. + * @see HTTP/1.1: + * Semantics and Content, section 6.4.7 + */ + public static final int TEMPORARY_REDIRECT = 307; + + /** + * @return {@code 308 Permanent Redirect}. + * @see RFC 7238 + */ + public static final int PERMANENT_REDIRECT = 308; + + /** + * @return {@code 400 Bad Request}. + * @see HTTP/1.1: + * Semantics and Content, section 6.5.1 + */ + public static final int BAD_REQUEST = 400; + + /** + * @return {@code 401 Unauthorized}. + * @see HTTP/1.1: + * Authentication, section 3.1 + */ + public static final int UNAUTHORIZED = 401; + + /** + * @return {@code 402 Payment Required}. + * @see HTTP/1.1: + * Semantics and Content, section 6.5.2 + */ + public static final int PAYMENT_REQUIRED = 402; + + /** + * @return {@code 403 Forbidden}. + * @see HTTP/1.1: + * Semantics and Content, section 6.5.3 + */ + public static final int FORBIDDEN = 403; + + /** + * @return {@code 404 Not Found}. + * @see HTTP/1.1: + * Semantics and Content, section 6.5.4 + */ + public static final int NOT_FOUND = 404; + + /** + * @return {@code 405 Method Not Allowed}. + * @see HTTP/1.1: + * Semantics and Content, section 6.5.5 + */ + public static final int METHOD_NOT_ALLOWED = 405; + + /** + * @return {@code 406 Not Acceptable}. + * @see HTTP/1.1: + * Semantics and Content, section 6.5.6 + */ + public static final int NOT_ACCEPTABLE = 406; + + /** + * @return {@code 407 Proxy Authentication Required}. + * @see HTTP/1.1: + * Authentication, section 3.2 + */ + public static final int PROXY_AUTHENTICATION_REQUIRED = 407; + + /** + * @return {@code 408 Request Timeout}. + * @see HTTP/1.1: + * Semantics and Content, section 6.5.7 + */ + public static final int REQUEST_TIMEOUT = 408; + + /** + * @return {@code 409 Conflict}. + * @see HTTP/1.1: + * Semantics and Content, section 6.5.8 + */ + public static final int CONFLICT = 409; + + /** + * @return {@code 410 Gone}. + * @see HTTP/1.1: + * Semantics and Content, section 6.5.9 + */ + public static final int GONE = 410; + + /** + * @return {@code 411 Length Required}. + * @see HTTP/1.1: + * Semantics and Content, section 6.5.10 + */ + public static final int LENGTH_REQUIRED = 411; + + /** + * @return {@code 412 Precondition failed}. + * @see HTTP/1.1: + * Conditional Requests, section 4.2 + */ + public static final int PRECONDITION_FAILED = 412; + + /** + * @return {@code 413 Payload Too Large}. + * @since 4.1* @see + * HTTP/1.1: Semantics and Content, section 6.5.11 + */ + public static final int PAYLOAD_TOO_LARGE = 413; + + /** + * @return {@code 413 Request Entity Too Large}. + * @see HTTP/1.1, + * section 10.4.14 + * @deprecated in favor of {@link #PAYLOAD_TOO_LARGE} which will be returned from + */ + @Deprecated + public static final int REQUEST_ENTITY_TOO_LARGE = 413; + + /** + * @return {@code 414 URI Too Long}. + * @since 4.1* @see + * HTTP/1.1: Semantics and Content, section 6.5.12 + */ + public static final int URI_TOO_LONG = 414; + + /** + * @return {@code 414 Request-URI Too Long}. + * @see HTTP/1.1, + * section 10.4.15 + * @deprecated in favor of {@link #URI_TOO_LONG} which will be returned from + */ + @Deprecated + public static final int REQUEST_URI_TOO_LONG = 414; + + /** + * @return {@code 415 Unsupported Media Type}. + * @see HTTP/1.1: + * Semantics and Content, section 6.5.13 + */ + public static final int UNSUPPORTED_MEDIA_TYPE = 415; + + /** + * @return {@code 416 Requested Range Not Satisfiable}. + * @see HTTP/1.1: Range + * Requests, section 4.4 + */ + public static final int REQUESTED_RANGE_NOT_SATISFIABLE = 416; + + /** + * @return {@code 417 Expectation Failed}. + * @see HTTP/1.1: + * Semantics and Content, section 6.5.14 + */ + public static final int EXPECTATION_FAILED = 417; + + /** + * @return {@code 418 I'm a teapot}. + * @see HTCPCP/1.0 + */ + public static final int I_AM_A_TEAPOT = 418; + + /** + * @return {@code 419 Insufficient Space}. + * @deprecated See WebDAV + * Draft Changes + */ + @Deprecated + public static final int INSUFFICIENT_SPACE_ON_RESOURCE = 419; + + /** + * @return {@code 420 Method Failure}. + * @deprecated See WebDAV + * Draft Changes + */ + @Deprecated + public static final int METHOD_FAILURE = 420; + + /** + * @return {@code 421 Destination Locked}. + * @deprecated See WebDAV + * Draft Changes + */ + @Deprecated + public static final int DESTINATION_LOCKED = 421; + + /** + * @return {@code 422 Unprocessable Entity}. + * @see WebDAV + */ + public static final int UNPROCESSABLE_ENTITY = 422; + + /** + * @return {@code 423 Locked}. + * @see WebDAV + */ + public static final int LOCKED = 423; + + /** + * @return {@code 424 Failed Dependency}. + * @see WebDAV + */ + public static final int FAILED_DEPENDENCY = 424; + + /** + * @return {@code 426 Upgrade Required}. + * @see Upgrading to TLS + * Within HTTP/1.1 + */ + public static final int UPGRADE_REQUIRED = 426; + + /** + * @return {@code 428 Precondition Required}. + * @see Additional HTTP Status + * Codes + */ + public static final int PRECONDITION_REQUIRED = 428; + + /** + * @return {@code 429 Too Many Requests}. + * @see Additional HTTP Status + * Codes + */ + public static final int TOO_MANY_REQUESTS = 429; + + /** + * @return {@code 431 Request Header Fields Too Large}. + * @see Additional HTTP Status + * Codes + */ + public static final int REQUEST_HEADER_FIELDS_TOO_LARGE = 431; + + /** + * @return {@code 451 Unavailable For Legal Reasons}. + * @see An + * HTTP Status Code to Report Legal Obstacles + */ + public static final int UNAVAILABLE_FOR_LEGAL_REASONS = 451; + + /** + * @return {@code 500 Internal Server Error}. + * @see HTTP/1.1: + * Semantics and Content, section 6.6.1 + */ + public static final int INTERNAL_SERVER_ERROR = 500; + + /** + * @return {@code 501 Not Implemented}. + * @see HTTP/1.1: + * Semantics and Content, section 6.6.2 + */ + public static final int NOT_IMPLEMENTED = 501; + + /** + * @return {@code 502 Bad Gateway}. + * @see HTTP/1.1: + * Semantics and Content, section 6.6.3 + */ + public static final int BAD_GATEWAY = 502; + + /** + * @return {@code 503 Service Unavailable}. + * @see HTTP/1.1: + * Semantics and Content, section 6.6.4 + */ + public static final int SERVICE_UNAVAILABLE = 503; + + /** + * @return {@code 504 Gateway Timeout}. + * @see HTTP/1.1: + * Semantics and Content, section 6.6.5 + */ + public static final int GATEWAY_TIMEOUT = 504; + + /** + * @return {@code 505 HTTP Version Not Supported}. + * @see HTTP/1.1: + * Semantics and Content, section 6.6.6 + */ + public static final int HTTP_VERSION_NOT_SUPPORTED = 505; + + /** + * @return {@code 506 Variant Also Negotiates} + * @see Transparent Content + * Negotiation + */ + public static final int VARIANT_ALSO_NEGOTIATES = 506; + + /** + * @return {@code 507 Insufficient Storage} + * @see WebDAV + */ + public static final int INSUFFICIENT_STORAGE = 507; + + /** + * @return {@code 508 Loop Detected} + * @see WebDAV Binding + * Extensions + */ + public static final int LOOP_DETECTED = 508; + + /** + * @return {@code 509 Bandwidth Limit Exceeded} + */ + public static final int BANDWIDTH_LIMIT_EXCEEDED = 509; + + /** + * @return {@code 510 Not Extended} + * @see HTTP Extension + * Framework + */ + public static final int NOT_EXTENDED = 510; + + /** + * @return {@code 511 Network Authentication Required}. + * @see Additional HTTP Status + * Codes + */ + public static final int NETWORK_AUTHENTICATION_REQUIRED = 511; + + /** + * @return {@code 100 Continue}. + * @see HTTP/1.1: + * Semantics and Content, section 6.2.1 + * @deprecated Replaced by {@code HttpStatus.CONTINUE}. + */ + @Deprecated + public int CONTINUE() { + return HttpStatus.CONTINUE; + } + + /** + * @return {@code 101 Switching Protocols}. + * @see HTTP/1.1: + * Semantics and Content, section 6.2.2 + * @deprecated Replaced by {@code HttpStatus.SWITCHING_PROTOCOLS}. + */ + @Deprecated + public int SWITCHING_PROTOCOLS() { + return HttpStatus.SWITCHING_PROTOCOLS; + } + + /** + * @return {@code 102 Processing}. + * @see WebDAV + * @deprecated Replaced by {@code HttpStatus.PROCESSING}. + */ + @Deprecated + public int PROCESSING() { + return HttpStatus.PROCESSING; + } + + /** + * @return {@code 103 Checkpoint}. + * @see + * A proposal for supporting resumable POST/PUT HTTP requests in HTTP/1.0 + * @deprecated Replaced by {@code HttpStatus.CHECKPOINT}. + */ + @Deprecated + public int CHECKPOINT() { + return HttpStatus.CHECKPOINT; + } + + /** + * @return {@code 200 OK}. + * @see HTTP/1.1: + * Semantics and Content, section 6.3.1 + * @deprecated Replaced by {@code HttpStatus.OK}. + */ + @Deprecated + public int OK() { + return HttpStatus.OK; + } + + /** + * @return {@code 201 Created}. + * @see HTTP/1.1: + * Semantics and Content, section 6.3.2 + * @deprecated Replaced by {@code HttpStatus.CREATED}. + */ + @Deprecated + public int CREATED() { + return HttpStatus.CREATED; + } + + /** + * @return {@code 202 Accepted}. + * @see HTTP/1.1: + * Semantics and Content, section 6.3.3 + * @deprecated Replaced by {@code HttpStatus.ACCEPTED}. + */ + @Deprecated + public int ACCEPTED() { + return HttpStatus.ACCEPTED; + } + + /** + * @return {@code 203 Non-Authoritative Information}. + * @see HTTP/1.1: + * Semantics and Content, section 6.3.4 + * @deprecated Replaced by {@code HttpStatus.NON_AUTHORITATIVE_INFORMATION}. + */ + @Deprecated + public int NON_AUTHORITATIVE_INFORMATION() { + return HttpStatus.NON_AUTHORITATIVE_INFORMATION; + } + + /** + * @return {@code 204 No Content}. + * @see HTTP/1.1: + * Semantics and Content, section 6.3.5 + * @deprecated Replaced by {@code HttpStatus.NO_CONTENT}. + */ + @Deprecated + public int NO_CONTENT() { + return HttpStatus.NO_CONTENT; + } + + /** + * @return {@code 205 Reset Content}. + * @see HTTP/1.1: + * Semantics and Content, section 6.3.6 + * @deprecated Replaced by {@code HttpStatus.RESET_CONTENT}. + */ + @Deprecated + public int RESET_CONTENT() { + return HttpStatus.RESET_CONTENT; + } + + /** + * @return {@code 206 Partial Content}. + * @see HTTP/1.1: Range + * Requests, section 4.1 + * @deprecated Replaced by {@code HttpStatus.PARTIAL_CONTENT}. + */ + @Deprecated + public int PARTIAL_CONTENT() { + return HttpStatus.PARTIAL_CONTENT; + } + + /** + * @return {@code 207 Multi-Status}. + * @see WebDAV + * @deprecated Replaced by {@code HttpStatus.MULTI_STATUS}. + */ + @Deprecated + public int MULTI_STATUS() { + return HttpStatus.MULTI_STATUS; + } + + /** + * @return {@code 208 Already Reported}. + * @see WebDAV Binding + * Extensions + * @deprecated Replaced by {@code HttpStatus.ALREADY_REPORTED}. + */ + @Deprecated + public int ALREADY_REPORTED() { + return HttpStatus.ALREADY_REPORTED; + } + + /** + * @return {@code 226 IM Used}. + * @see Delta encoding in + * HTTP + * @deprecated Replaced by {@code HttpStatus.IM_USED}. + */ + @Deprecated + public int IM_USED() { + return HttpStatus.IM_USED; + } + + /** + * @return {@code 300 Multiple Choices}. + * @see HTTP/1.1: + * Semantics and Content, section 6.4.1 + * @deprecated Replaced by {@code HttpStatus.MULTIPLE_CHOICES}. + */ + @Deprecated + public int MULTIPLE_CHOICES() { + return HttpStatus.MULTIPLE_CHOICES; + } + + /** + * @return {@code 301 Moved Permanently}. + * @see HTTP/1.1: + * Semantics and Content, section 6.4.2 + * @deprecated Replaced by {@code HttpStatus.MOVED_PERMANENTLY}. + */ + @Deprecated + public int MOVED_PERMANENTLY() { + return HttpStatus.MOVED_PERMANENTLY; + } + + /** + * @return {@code 302 Found}. + * @see HTTP/1.1: + * Semantics and Content, section 6.4.3 + * @deprecated Replaced by {@code HttpStatus.FOUND}. + */ + @Deprecated + public int FOUND() { + return HttpStatus.FOUND; } /** @@ -187,26 +691,30 @@ public final class HttpStatus { * @deprecated in favor of {@link #FOUND} which will be returned from */ @Deprecated - public static int MOVED_TEMPORARILY() { - return 302; + public int MOVED_TEMPORARILY() { + return HttpStatus.MOVED_TEMPORARILY; } /** * @return {@code 303 See Other}. * @see HTTP/1.1: * Semantics and Content, section 6.4.4 + * @deprecated Replaced by {@code HttpStatus.SEE_OTHER}. */ - public static int SEE_OTHER() { - return 303; + @Deprecated + public int SEE_OTHER() { + return HttpStatus.SEE_OTHER; } /** * @return {@code 304 Not Modified}. * @see HTTP/1.1: * Conditional Requests, section 4.1 + * @deprecated Replaced by {@code HttpStatus.NOT_MODIFIED}. */ - public static int NOT_MODIFIED() { - return 304; + @Deprecated + public int NOT_MODIFIED() { + return HttpStatus.NOT_MODIFIED; } /** @@ -216,151 +724,183 @@ public final class HttpStatus { * @deprecated due to security concerns regarding in-band configuration of a proxy */ @Deprecated - public static int USE_PROXY() { - return 305; + public int USE_PROXY() { + return HttpStatus.USE_PROXY; } /** * @return {@code 307 Temporary Redirect}. * @see HTTP/1.1: * Semantics and Content, section 6.4.7 + * @deprecated Replaced by {@code HttpStatus.TEMPORARY_REDIRECT}. */ - public static int TEMPORARY_REDIRECT() { - return 307; + @Deprecated + public int TEMPORARY_REDIRECT() { + return HttpStatus.TEMPORARY_REDIRECT; } /** * @return {@code 308 Permanent Redirect}. * @see RFC 7238 + * @deprecated Replaced by {@code HttpStatus.PERMANENT_REDIRECT}. */ - public static int PERMANENT_REDIRECT() { - return 308; + @Deprecated + public int PERMANENT_REDIRECT() { + return HttpStatus.PERMANENT_REDIRECT; } /** * @return {@code 400 Bad Request}. * @see HTTP/1.1: * Semantics and Content, section 6.5.1 + * @deprecated Replaced by {@code HttpStatus.BAD_REQUEST}. */ - public static int BAD_REQUEST() { - return 400; + @Deprecated + public int BAD_REQUEST() { + return HttpStatus.BAD_REQUEST; } /** * @return {@code 401 Unauthorized}. * @see HTTP/1.1: * Authentication, section 3.1 + * @deprecated Replaced by {@code HttpStatus.UNAUTHORIZED}. */ - public static int UNAUTHORIZED() { - return 401; + @Deprecated + public int UNAUTHORIZED() { + return HttpStatus.UNAUTHORIZED; } /** * @return {@code 402 Payment Required}. * @see HTTP/1.1: * Semantics and Content, section 6.5.2 + * @deprecated Replaced by {@code HttpStatus.PAYMENT_REQUIRED}. */ - public static int PAYMENT_REQUIRED() { - return 402; + @Deprecated + public int PAYMENT_REQUIRED() { + return HttpStatus.PAYMENT_REQUIRED; } /** * @return {@code 403 Forbidden}. * @see HTTP/1.1: * Semantics and Content, section 6.5.3 + * @deprecated Replaced by {@code HttpStatus.FORBIDDEN}. */ - public static int FORBIDDEN() { - return 403; + @Deprecated + public int FORBIDDEN() { + return HttpStatus.FORBIDDEN; } /** * @return {@code 404 Not Found}. * @see HTTP/1.1: * Semantics and Content, section 6.5.4 + * @deprecated Replaced by {@code HttpStatus.NOT_FOUND}. */ - public static int NOT_FOUND() { - return 404; + @Deprecated + public int NOT_FOUND() { + return HttpStatus.NOT_FOUND; } /** * @return {@code 405 Method Not Allowed}. * @see HTTP/1.1: * Semantics and Content, section 6.5.5 + * @deprecated Replaced by {@code HttpStatus.METHOD_NOT_ALLOWED}. */ - public static int METHOD_NOT_ALLOWED() { - return 405; + @Deprecated + public int METHOD_NOT_ALLOWED() { + return HttpStatus.METHOD_NOT_ALLOWED; } /** * @return {@code 406 Not Acceptable}. * @see HTTP/1.1: * Semantics and Content, section 6.5.6 + * @deprecated Replaced by {@code HttpStatus.NOT_ACCEPTABLE}. */ - public static int NOT_ACCEPTABLE() { - return 406; + @Deprecated + public int NOT_ACCEPTABLE() { + return HttpStatus.NOT_ACCEPTABLE; } /** * @return {@code 407 Proxy Authentication Required}. * @see HTTP/1.1: * Authentication, section 3.2 + * @deprecated Replaced by {@code HttpStatus.PROXY_AUTHENTICATION_REQUIRED}. */ - public static int PROXY_AUTHENTICATION_REQUIRED() { - return 407; + @Deprecated + public int PROXY_AUTHENTICATION_REQUIRED() { + return HttpStatus.PROXY_AUTHENTICATION_REQUIRED; } /** * @return {@code 408 Request Timeout}. * @see HTTP/1.1: * Semantics and Content, section 6.5.7 + * @deprecated Replaced by {@code HttpStatus.REQUEST_TIMEOUT}. */ - public static int REQUEST_TIMEOUT() { - return 408; + @Deprecated + public int REQUEST_TIMEOUT() { + return HttpStatus.REQUEST_TIMEOUT; } /** * @return {@code 409 Conflict}. * @see HTTP/1.1: * Semantics and Content, section 6.5.8 + * @deprecated Replaced by {@code HttpStatus.CONFLICT}. */ - public static int CONFLICT() { - return 409; + @Deprecated + public int CONFLICT() { + return HttpStatus.CONFLICT; } /** * @return {@code 410 Gone}. * @see HTTP/1.1: * Semantics and Content, section 6.5.9 + * @deprecated Replaced by {@code HttpStatus.GONE}. */ - public static int GONE() { - return 410; + @Deprecated + public int GONE() { + return HttpStatus.GONE; } /** * @return {@code 411 Length Required}. * @see HTTP/1.1: * Semantics and Content, section 6.5.10 + * @deprecated Replaced by {@code HttpStatus.LENGTH_REQUIRED}. */ - public static int LENGTH_REQUIRED() { - return 411; + @Deprecated + public int LENGTH_REQUIRED() { + return HttpStatus.LENGTH_REQUIRED; } /** * @return {@code 412 Precondition failed}. * @see HTTP/1.1: * Conditional Requests, section 4.2 + * @deprecated Replaced by {@code HttpStatus.PRECONDITION_FAILED}. */ - public static int PRECONDITION_FAILED() { - return 412; + @Deprecated + public int PRECONDITION_FAILED() { + return HttpStatus.PRECONDITION_FAILED; } /** * @return {@code 413 Payload Too Large}. * @since 4.1* @see * HTTP/1.1: Semantics and Content, section 6.5.11 + * @deprecated Replaced by {@code HttpStatus.PAYLOAD_TOO_LARGE}. */ - public static int PAYLOAD_TOO_LARGE() { - return 413; + @Deprecated + public int PAYLOAD_TOO_LARGE() { + return HttpStatus.PAYLOAD_TOO_LARGE; } /** @@ -370,17 +910,19 @@ public final class HttpStatus { * @deprecated in favor of {@link #PAYLOAD_TOO_LARGE} which will be returned from */ @Deprecated - public static int REQUEST_ENTITY_TOO_LARGE() { - return 413; + public int REQUEST_ENTITY_TOO_LARGE() { + return HttpStatus.REQUEST_ENTITY_TOO_LARGE; } /** * @return {@code 414 URI Too Long}. * @since 4.1* @see * HTTP/1.1: Semantics and Content, section 6.5.12 + * @deprecated Replaced by {@code HttpStatus.URI_TOO_LONG}. */ - public static int URI_TOO_LONG() { - return 414; + @Deprecated + public int URI_TOO_LONG() { + return HttpStatus.URI_TOO_LONG; } /** @@ -390,43 +932,51 @@ public final class HttpStatus { * @deprecated in favor of {@link #URI_TOO_LONG} which will be returned from */ @Deprecated - public static int REQUEST_URI_TOO_LONG() { - return 414; + public int REQUEST_URI_TOO_LONG() { + return HttpStatus.REQUEST_URI_TOO_LONG; } /** * @return {@code 415 Unsupported Media Type}. * @see HTTP/1.1: * Semantics and Content, section 6.5.13 + * @deprecated Replaced by {@code HttpStatus.UNSUPPORTED_MEDIA_TYPE}. */ - public static int UNSUPPORTED_MEDIA_TYPE() { - return 415; + @Deprecated + public int UNSUPPORTED_MEDIA_TYPE() { + return HttpStatus.UNSUPPORTED_MEDIA_TYPE; } /** * @return {@code 416 Requested Range Not Satisfiable}. * @see HTTP/1.1: Range * Requests, section 4.4 + * @deprecated Replaced by {@code HttpStatus.REQUESTED_RANGE_NOT_SATISFIABLE}. */ - public static int REQUESTED_RANGE_NOT_SATISFIABLE() { - return 416; + @Deprecated + public int REQUESTED_RANGE_NOT_SATISFIABLE() { + return HttpStatus.REQUESTED_RANGE_NOT_SATISFIABLE; } /** * @return {@code 417 Expectation Failed}. * @see HTTP/1.1: * Semantics and Content, section 6.5.14 + * @deprecated Replaced by {@code HttpStatus.EXPECTATION_FAILED}. */ - public static int EXPECTATION_FAILED() { - return 417; + @Deprecated + public int EXPECTATION_FAILED() { + return HttpStatus.EXPECTATION_FAILED; } /** * @return {@code 418 I'm a teapot}. * @see HTCPCP/1.0 + * @deprecated Replaced by {@code HttpStatus.I_AM_A_TEAPOT}. */ - public static int I_AM_A_TEAPOT() { - return 418; + @Deprecated + public int I_AM_A_TEAPOT() { + return HttpStatus.I_AM_A_TEAPOT; } /** @@ -436,8 +986,8 @@ public final class HttpStatus { * Draft Changes */ @Deprecated - public static int INSUFFICIENT_SPACE_ON_RESOURCE() { - return 419; + public int INSUFFICIENT_SPACE_ON_RESOURCE() { + return HttpStatus.INSUFFICIENT_SPACE_ON_RESOURCE; } /** @@ -447,8 +997,8 @@ public final class HttpStatus { * Draft Changes */ @Deprecated - public static int METHOD_FAILURE() { - return 420; + public int METHOD_FAILURE() { + return HttpStatus.METHOD_FAILURE; } /** @@ -458,68 +1008,82 @@ public final class HttpStatus { * Draft Changes */ @Deprecated - public static int DESTINATION_LOCKED() { - return 421; + public int DESTINATION_LOCKED() { + return HttpStatus.DESTINATION_LOCKED; } /** * @return {@code 422 Unprocessable Entity}. * @see WebDAV + * @deprecated Replaced by {@code HttpStatus.UNPROCESSABLE_ENTITY}. */ - public static int UNPROCESSABLE_ENTITY() { - return 422; + @Deprecated + public int UNPROCESSABLE_ENTITY() { + return HttpStatus.UNPROCESSABLE_ENTITY; } /** * @return {@code 423 Locked}. * @see WebDAV + * @deprecated Replaced by {@code HttpStatus.LOCKED}. */ - public static int LOCKED() { - return 423; + @Deprecated + public int LOCKED() { + return HttpStatus.LOCKED; } /** * @return {@code 424 Failed Dependency}. * @see WebDAV + * @deprecated Replaced by {@code HttpStatus.FAILED_DEPENDENCY}. */ - public static int FAILED_DEPENDENCY() { - return 424; + @Deprecated + public int FAILED_DEPENDENCY() { + return HttpStatus.FAILED_DEPENDENCY; } /** * @return {@code 426 Upgrade Required}. * @see Upgrading to TLS * Within HTTP/1.1 + * @deprecated Replaced by {@code HttpStatus.UPGRADE_REQUIRED}. */ - public static int UPGRADE_REQUIRED() { - return 426; + @Deprecated + public int UPGRADE_REQUIRED() { + return HttpStatus.UPGRADE_REQUIRED; } /** * @return {@code 428 Precondition Required}. * @see Additional HTTP Status * Codes + * @deprecated Replaced by {@code HttpStatus.PRECONDITION_REQUIRED}. */ - public static int PRECONDITION_REQUIRED() { - return 428; + @Deprecated + public int PRECONDITION_REQUIRED() { + return HttpStatus.PRECONDITION_REQUIRED; } /** * @return {@code 429 Too Many Requests}. * @see Additional HTTP Status * Codes + * @deprecated Replaced by {@code HttpStatus.TOO_MANY_REQUESTS}. */ - public static int TOO_MANY_REQUESTS() { - return 429; + @Deprecated + public int TOO_MANY_REQUESTS() { + return HttpStatus.TOO_MANY_REQUESTS; } /** * @return {@code 431 Request Header Fields Too Large}. * @see Additional HTTP Status * Codes + * @deprecated Replaced by {@code HttpStatus.REQUEST_HEADER_FIELDS_TOO_LARGE}. */ - public static int REQUEST_HEADER_FIELDS_TOO_LARGE() { - return 431; + @Deprecated + public int REQUEST_HEADER_FIELDS_TOO_LARGE() { + return HttpStatus.REQUEST_HEADER_FIELDS_TOO_LARGE; } /** @@ -527,114 +1091,140 @@ public final class HttpStatus { * @see An * HTTP Status Code to Report Legal Obstacles + * @deprecated Replaced by {@code HttpStatus.UNAVAILABLE_FOR_LEGAL_REASONS}. */ - public static int UNAVAILABLE_FOR_LEGAL_REASONS() { - return 451; + @Deprecated + public int UNAVAILABLE_FOR_LEGAL_REASONS() { + return HttpStatus.UNAVAILABLE_FOR_LEGAL_REASONS; } /** * @return {@code 500 Internal Server Error}. * @see HTTP/1.1: * Semantics and Content, section 6.6.1 + * @deprecated Replaced by {@code HttpStatus.INTERNAL_SERVER_ERROR}. */ - public static int INTERNAL_SERVER_ERROR() { - return 500; + @Deprecated + public int INTERNAL_SERVER_ERROR() { + return HttpStatus.INTERNAL_SERVER_ERROR; } /** * @return {@code 501 Not Implemented}. * @see HTTP/1.1: * Semantics and Content, section 6.6.2 + * @deprecated Replaced by {@code HttpStatus.NOT_IMPLEMENTED}. */ - public static int NOT_IMPLEMENTED() { - return 501; + @Deprecated + public int NOT_IMPLEMENTED() { + return HttpStatus.NOT_IMPLEMENTED; } /** * @return {@code 502 Bad Gateway}. * @see HTTP/1.1: * Semantics and Content, section 6.6.3 + * @deprecated Replaced by {@code HttpStatus.BAD_GATEWAY}. */ - public static int BAD_GATEWAY() { - return 502; + @Deprecated + public int BAD_GATEWAY() { + return HttpStatus.BAD_GATEWAY; } /** * @return {@code 503 Service Unavailable}. * @see HTTP/1.1: * Semantics and Content, section 6.6.4 + * @deprecated Replaced by {@code HttpStatus.SERVICE_UNAVAILABLE}. */ - public static int SERVICE_UNAVAILABLE() { - return 503; + @Deprecated + public int SERVICE_UNAVAILABLE() { + return HttpStatus.SERVICE_UNAVAILABLE; } /** * @return {@code 504 Gateway Timeout}. * @see HTTP/1.1: * Semantics and Content, section 6.6.5 + * @deprecated Replaced by {@code HttpStatus.GATEWAY_TIMEOUT}. */ - public static int GATEWAY_TIMEOUT() { - return 504; + @Deprecated + public int GATEWAY_TIMEOUT() { + return HttpStatus.GATEWAY_TIMEOUT; } /** * @return {@code 505 HTTP Version Not Supported}. * @see HTTP/1.1: * Semantics and Content, section 6.6.6 + * @deprecated Replaced by {@code HttpStatus.HTTP_VERSION_NOT_SUPPORTED}. */ - public static int HTTP_VERSION_NOT_SUPPORTED() { - return 505; + @Deprecated + public int HTTP_VERSION_NOT_SUPPORTED() { + return HttpStatus.HTTP_VERSION_NOT_SUPPORTED; } /** * @return {@code 506 Variant Also Negotiates} * @see Transparent Content * Negotiation + * @deprecated Replaced by {@code HttpStatus.VARIANT_ALSO_NEGOTIATES}. */ - public static int VARIANT_ALSO_NEGOTIATES() { - return 506; + @Deprecated + public int VARIANT_ALSO_NEGOTIATES() { + return HttpStatus.VARIANT_ALSO_NEGOTIATES; } /** * @return {@code 507 Insufficient Storage} * @see WebDAV + * @deprecated Replaced by {@code HttpStatus.INSUFFICIENT_STORAGE}. */ - public static int INSUFFICIENT_STORAGE() { - return 507; + @Deprecated + public int INSUFFICIENT_STORAGE() { + return HttpStatus.INSUFFICIENT_STORAGE; } /** * @return {@code 508 Loop Detected} * @see WebDAV Binding * Extensions + * @deprecated Replaced by {@code HttpStatus.LOOP_DETECTED}. */ - public static int LOOP_DETECTED() { - return 508; + @Deprecated + public int LOOP_DETECTED() { + return HttpStatus.LOOP_DETECTED; } /** * @return {@code 509 Bandwidth Limit Exceeded} + * @deprecated Replaced by {@code HttpStatus.BANDWIDTH_LIMIT_EXCEEDED}. */ - public static int BANDWIDTH_LIMIT_EXCEEDED() { - return 509; + @Deprecated + public int BANDWIDTH_LIMIT_EXCEEDED() { + return HttpStatus.BANDWIDTH_LIMIT_EXCEEDED; } /** * @return {@code 510 Not Extended} * @see HTTP Extension * Framework + * @deprecated Replaced by {@code HttpStatus.NOT_EXTENDED}. */ - public static int NOT_EXTENDED() { - return 510; + @Deprecated + public int NOT_EXTENDED() { + return HttpStatus.NOT_EXTENDED; } /** * @return {@code 511 Network Authentication Required}. * @see Additional HTTP Status * Codes + * @deprecated Replaced by {@code HttpStatus.NETWORK_AUTHENTICATION_REQUIRED}. */ - public static int NETWORK_AUTHENTICATION_REQUIRED() { - return 511; + @Deprecated + public int NETWORK_AUTHENTICATION_REQUIRED() { + return HttpStatus.NETWORK_AUTHENTICATION_REQUIRED; } } diff --git a/specs/spring-cloud-contract-spec-java/src/main/java/org/springframework/cloud/contract/spec/internal/MediaTypes.java b/specs/spring-cloud-contract-spec-java/src/main/java/org/springframework/cloud/contract/spec/internal/MediaTypes.java index 75443daba7..26a28d2dbc 100644 --- a/specs/spring-cloud-contract-spec-java/src/main/java/org/springframework/cloud/contract/spec/internal/MediaTypes.java +++ b/specs/spring-cloud-contract-spec-java/src/main/java/org/springframework/cloud/contract/spec/internal/MediaTypes.java @@ -20,76 +20,265 @@ package org.springframework.cloud.contract.spec.internal; * Contains most commonly used media types. * * @author Marcin Grzejszczak + * @author Tim Ysewyn * @since 1.0.2 */ public class MediaTypes { + /** + * Public constant for that includes all media ranges (i.e. "*/*"). + * @return {@code */*} + */ + public static final String ALL_VALUE = "*/*"; + + /** + * Public constant for {@code application/atom+xml}. + * @return {@code application/atom+xml} + */ + public static final String APPLICATION_ATOM_XML = "application/atom+xml"; + + /** + * Public constant for {@code application/x-www-form-urlencoded}. + * @return {@code application/x-www-form-urlencoded} + */ + public static final String APPLICATION_FORM_URLENCODED = "application/x-www-form-urlencoded"; + + /** + * Public constant for {@code application/json}. + * @return {@code application/json} + */ + public static final String APPLICATION_JSON = "application/json"; + + /** + * Public constant for {@code application/json;charset=UTF-8}. + * @return {@code application/json;charset=UTF-8} + */ + public static final String APPLICATION_JSON_UTF8 = APPLICATION_JSON + + ";charset=UTF-8"; + + /** + * Public constant for {@code application/octet-stream}. + * @return {@code application/octet-stream} + */ + public static final String APPLICATION_OCTET_STREAM = "application/octet-stream"; + + /** + * Public constant for {@code application/pdf}. + * @return {@code application/pdf} + */ + public static final String APPLICATION_PDF = "application/pdf"; + + /** + * Public constant for {@code application/xhtml+xml}. + * @return {@code application/xhtml+xml} + */ + public static final String APPLICATION_XHTML_XML = "application/xhtml+xml"; + + /** + * Public constant for {@code application/xml}. + * @return {@code application/xml} + */ + public static final String APPLICATION_XML = "application/xml"; + + /** + * Public constant for {@code image/gif}. + * @return {@code image/gif} + */ + public static final String IMAGE_GIF = "image/gif"; + + /** + * Public constant for {@code image/jpeg}. + * @return {@code image/jpeg} + */ + public static final String IMAGE_JPEG = "image/jpeg"; + + /** + * Public constant for {@code image/png}. + * @return {@code image/png} + */ + public static final String IMAGE_PNG = "image/png"; + + /** + * Public constant for {@code multipart/form-data}. + * @return {@code multipart/form-data} + */ + public static final String MULTIPART_FORM_DATA = "multipart/form-data"; + + /** + * Public constant for {@code text/html}. + * @return {@code text/html} + */ + public static final String TEXT_HTML = "text/html"; + + /** + * Public constant for {@code text/markdown}. + * @return {@code text/markdown} + */ + public static final String TEXT_MARKDOWN = "text/markdown"; + + /** + * Public constant for {@code text/plain}. + * @return {@code text/plain} + */ + public static final String TEXT_PLAIN = "text/plain"; + + /** + * Public constant for {@code text/xml}. + * @return {@code text/xml} + */ + public static final String TEXT_XML = "text/xml"; + + /** + * @deprecated Replaced by {@code MediaTypes.ALL_VALUE}. + * @return {@code MediaTypes.ALL_VALUE} + */ + @Deprecated public String allValue() { - return "*/*"; + return ALL_VALUE; } + /** + * @deprecated Replaced by {@code MediaTypes.APPLICATION_ATOM_XML}. + * @return {@code MediaTypes.APPLICATION_ATOM_XML} + */ + @Deprecated public String applicationAtomXml() { - return "application/atom+xml"; + return APPLICATION_ATOM_XML; } + /** + * @deprecated Replaced by {@code MediaTypes.APPLICATION_FORM_URLENCODED}. + * @return {@code MediaTypes.APPLICATION_FORM_URLENCODED} + */ + @Deprecated public String applicationFormUrlencoded() { - return "application/x-www-form-urlencoded"; + return APPLICATION_FORM_URLENCODED; } + /** + * @deprecated Replaced by {@code MediaTypes.APPLICATION_JSON}. + * @return {@code MediaTypes.APPLICATION_JSON} + */ + @Deprecated public String applicationJson() { - return "application/json"; + return APPLICATION_JSON; } + /** + * @deprecated Replaced by {@code MediaTypes.APPLICATION_JSON_UTF8}. + * @return {@code MediaTypes.APPLICATION_JSON_UTF8} + */ + @Deprecated public String applicationJsonUtf8() { - return applicationJson() + ";charset=UTF-8"; + return APPLICATION_JSON_UTF8; } + /** + * @deprecated Replaced by {@code MediaTypes.APPLICATION_OCTET_STREAM}. + * @return {@code MediaTypes.APPLICATION_OCTET_STREAM} + */ + @Deprecated public String applicationOctetStream() { - return "application/octet-stream"; + return APPLICATION_OCTET_STREAM; } + /** + * @deprecated Replaced by {@code MediaTypes.APPLICATION_PDF}. + * @return {@code MediaTypes.APPLICATION_PDF} + */ + @Deprecated public String applicationPdf() { - return "application/pdf"; + return APPLICATION_PDF; } + /** + * @deprecated Replaced by {@code MediaTypes.APPLICATION_XHTML_XML}. + * @return {@code MediaTypes.APPLICATION_XHTML_XML} + */ + @Deprecated public String applicationXhtmlXml() { - return "application/xhtml+xml"; + return APPLICATION_XHTML_XML; } + /** + * @deprecated Replaced by {@code MediaTypes.APPLICATION_XML}. + * @return {@code MediaTypes.APPLICATION_XML} + */ + @Deprecated public String applicationXml() { - return "application/xml"; + return APPLICATION_XML; } + /** + * @deprecated Replaced by {@code MediaTypes.IMAGE_GIF}. + * @return {@code MediaTypes.IMAGE_GIF} + */ + @Deprecated public String imageGif() { - return "image/gif"; + return IMAGE_GIF; } + /** + * @deprecated Replaced by {@code MediaTypes.IMAGE_JPEG}. + * @return {@code MediaTypes.IMAGE_JPEG} + */ + @Deprecated public String imageJpeg() { - return "image/jpeg"; + return IMAGE_JPEG; } + /** + * @deprecated Replaced by {@code MediaTypes.IMAGE_PNG}. + * @return {@code MediaTypes.IMAGE_PNG} + */ + @Deprecated public String imagePng() { - return "image/png"; + return IMAGE_PNG; } + /** + * @deprecated Replaced by {@code MediaTypes.MULTIPART_FORM_DATA}. + * @return {@code MediaTypes.MULTIPART_FORM_DATA} + */ + @Deprecated public String multipartFormData() { - return "multipart/form-data"; + return MULTIPART_FORM_DATA; } + /** + * @deprecated Replaced by {@code MediaTypes.TEXT_HTML}. + * @return {@code MediaTypes.TEXT_HTML} + */ + @Deprecated public String textHtml() { - return "text/html"; + return TEXT_HTML; } + /** + * @deprecated Replaced by {@code MediaTypes.TEXT_MARKDOWN}. + * @return {@code MediaTypes.TEXT_MARKDOWN} + */ + @Deprecated public String textMarkdown() { - return "text/markdown"; + return TEXT_MARKDOWN; } + /** + * @deprecated Replaced by {@code MediaTypes.TEXT_PLAIN}. + * @return {@code MediaTypes.TEXT_PLAIN} + */ + @Deprecated public String textPlain() { - return "text/plain"; + return TEXT_PLAIN; } + /** + * @deprecated Replaced by {@code MediaTypes.TEXT_XML}. + * @return {@code MediaTypes.TEXT_XML} + */ + @Deprecated public String textXml() { - return "text/xml"; + return TEXT_XML; } } diff --git a/specs/spring-cloud-contract-spec-java/src/main/java/org/springframework/cloud/contract/spec/internal/MessagingHeaders.java b/specs/spring-cloud-contract-spec-java/src/main/java/org/springframework/cloud/contract/spec/internal/MessagingHeaders.java index c0d9fe9456..2e41d6728e 100644 --- a/specs/spring-cloud-contract-spec-java/src/main/java/org/springframework/cloud/contract/spec/internal/MessagingHeaders.java +++ b/specs/spring-cloud-contract-spec-java/src/main/java/org/springframework/cloud/contract/spec/internal/MessagingHeaders.java @@ -20,6 +20,7 @@ package org.springframework.cloud.contract.spec.internal; * Contains most commonly used messaging headers. * * @author Marcin Grzejszczak + * @author Tim Ysewyn * @since 1.1.2 */ public class MessagingHeaders { @@ -28,8 +29,16 @@ public class MessagingHeaders { * The Content Type of a message. * @return messaging content type */ + public static final String MESSAGING_CONTENT_TYPE = "contentType"; + + /** + * The Content Type of a message. + * @return messaging content type + * @deprecated Replaced by {@code MessagingHeaders.MESSAGING_CONTENT_TYPE}. + */ + @Deprecated public String messagingContentType() { - return "contentType"; + return MESSAGING_CONTENT_TYPE; } } diff --git a/specs/spring-cloud-contract-spec-java/src/main/java/org/springframework/cloud/contract/spec/internal/Request.java b/specs/spring-cloud-contract-spec-java/src/main/java/org/springframework/cloud/contract/spec/internal/Request.java index ccc35f4acf..45c3439d8a 100644 --- a/specs/spring-cloud-contract-spec-java/src/main/java/org/springframework/cloud/contract/spec/internal/Request.java +++ b/specs/spring-cloud-contract-spec-java/src/main/java/org/springframework/cloud/contract/spec/internal/Request.java @@ -82,9 +82,11 @@ public class Request extends Common implements RegexCreatingProperty { /* HTTP STATUS CODES */ - val CONTINUE = code(HttpStatus.CONTINUE()) + val CONTINUE = code(HttpStatus.CONTINUE) - val SWITCHING_PROTOCOLS = code(HttpStatus.SWITCHING_PROTOCOLS()) + val SWITCHING_PROTOCOLS = code(HttpStatus.SWITCHING_PROTOCOLS) - val PROCESSING = code(HttpStatus.PROCESSING()) + val PROCESSING = code(HttpStatus.PROCESSING) - val CHECKPOINT = code(HttpStatus.CHECKPOINT()) + val CHECKPOINT = code(HttpStatus.CHECKPOINT) - val OK = code(HttpStatus.OK()) + val OK = code(HttpStatus.OK) - val CREATED = code(HttpStatus.CREATED()) + val CREATED = code(HttpStatus.CREATED) - val ACCEPTED = code(HttpStatus.ACCEPTED()) + val ACCEPTED = code(HttpStatus.ACCEPTED) - val NON_AUTHORITATIVE_INFORMATION = code(HttpStatus.NON_AUTHORITATIVE_INFORMATION()) + val NON_AUTHORITATIVE_INFORMATION = code(HttpStatus.NON_AUTHORITATIVE_INFORMATION) - val NO_CONTENT = code(HttpStatus.NO_CONTENT()) + val NO_CONTENT = code(HttpStatus.NO_CONTENT) - val RESET_CONTENT = code(HttpStatus.RESET_CONTENT()) + val RESET_CONTENT = code(HttpStatus.RESET_CONTENT) - val PARTIAL_CONTENT = code(HttpStatus.PARTIAL_CONTENT()) + val PARTIAL_CONTENT = code(HttpStatus.PARTIAL_CONTENT) - val MULTI_STATUS = code(HttpStatus.MULTI_STATUS()) + val MULTI_STATUS = code(HttpStatus.MULTI_STATUS) - val ALREADY_REPORTED = code(HttpStatus.ALREADY_REPORTED()) + val ALREADY_REPORTED = code(HttpStatus.ALREADY_REPORTED) - val IM_USED = code(HttpStatus.IM_USED()) + val IM_USED = code(HttpStatus.IM_USED) - val MULTIPLE_CHOICES = code(HttpStatus.MULTIPLE_CHOICES()) + val MULTIPLE_CHOICES = code(HttpStatus.MULTIPLE_CHOICES) - val MOVED_PERMANENTLY = code(HttpStatus.MOVED_PERMANENTLY()) + val MOVED_PERMANENTLY = code(HttpStatus.MOVED_PERMANENTLY) - val FOUND = code(HttpStatus.FOUND()) + val FOUND = code(HttpStatus.FOUND) - val SEE_OTHER = code(HttpStatus.SEE_OTHER()) + val SEE_OTHER = code(HttpStatus.SEE_OTHER) - val NOT_MODIFIED = code(HttpStatus.NOT_MODIFIED()) + val NOT_MODIFIED = code(HttpStatus.NOT_MODIFIED) - val TEMPORARY_REDIRECT = code(HttpStatus.TEMPORARY_REDIRECT()) + val TEMPORARY_REDIRECT = code(HttpStatus.TEMPORARY_REDIRECT) - val PERMANENT_REDIRECT = code(HttpStatus.PERMANENT_REDIRECT()) + val PERMANENT_REDIRECT = code(HttpStatus.PERMANENT_REDIRECT) - val BAD_REQUEST = code(HttpStatus.BAD_REQUEST()) + val BAD_REQUEST = code(HttpStatus.BAD_REQUEST) - val UNAUTHORIZED = code(HttpStatus.UNAUTHORIZED()) + val UNAUTHORIZED = code(HttpStatus.UNAUTHORIZED) - val PAYMENT_REQUIRED = code(HttpStatus.PAYMENT_REQUIRED()) + val PAYMENT_REQUIRED = code(HttpStatus.PAYMENT_REQUIRED) - val FORBIDDEN = code(HttpStatus.FORBIDDEN()) + val FORBIDDEN = code(HttpStatus.FORBIDDEN) - val NOT_FOUND = code(HttpStatus.NOT_FOUND()) + val NOT_FOUND = code(HttpStatus.NOT_FOUND) - val METHOD_NOT_ALLOWED = code(HttpStatus.METHOD_NOT_ALLOWED()) + val METHOD_NOT_ALLOWED = code(HttpStatus.METHOD_NOT_ALLOWED) - val NOT_ACCEPTABLE = code(HttpStatus.NOT_ACCEPTABLE()) + val NOT_ACCEPTABLE = code(HttpStatus.NOT_ACCEPTABLE) - val PROXY_AUTHENTICATION_REQUIRED = code(HttpStatus.PROXY_AUTHENTICATION_REQUIRED()) + val PROXY_AUTHENTICATION_REQUIRED = code(HttpStatus.PROXY_AUTHENTICATION_REQUIRED) - val REQUEST_TIMEOUT = code(HttpStatus.REQUEST_TIMEOUT()) + val REQUEST_TIMEOUT = code(HttpStatus.REQUEST_TIMEOUT) - val CONFLICT = code(HttpStatus.CONFLICT()) + val CONFLICT = code(HttpStatus.CONFLICT) - val GONE = code(HttpStatus.GONE()) + val GONE = code(HttpStatus.GONE) - val LENGTH_REQUIRED = code(HttpStatus.LENGTH_REQUIRED()) + val LENGTH_REQUIRED = code(HttpStatus.LENGTH_REQUIRED) - val PRECONDITION_FAILED = code(HttpStatus.PRECONDITION_FAILED()) + val PRECONDITION_FAILED = code(HttpStatus.PRECONDITION_FAILED) - val PAYLOAD_TOO_LARGE = code(HttpStatus.PAYLOAD_TOO_LARGE()) + val PAYLOAD_TOO_LARGE = code(HttpStatus.PAYLOAD_TOO_LARGE) - val UNSUPPORTED_MEDIA_TYPE = code(HttpStatus.UNSUPPORTED_MEDIA_TYPE()) + val UNSUPPORTED_MEDIA_TYPE = code(HttpStatus.UNSUPPORTED_MEDIA_TYPE) - val REQUESTED_RANGE_NOT_SATISFIABLE = code(HttpStatus.REQUESTED_RANGE_NOT_SATISFIABLE()) + val REQUESTED_RANGE_NOT_SATISFIABLE = code(HttpStatus.REQUESTED_RANGE_NOT_SATISFIABLE) - val EXPECTATION_FAILED = code(HttpStatus.EXPECTATION_FAILED()) + val EXPECTATION_FAILED = code(HttpStatus.EXPECTATION_FAILED) - val I_AM_A_TEAPOT = code(HttpStatus.I_AM_A_TEAPOT()) + val I_AM_A_TEAPOT = code(HttpStatus.I_AM_A_TEAPOT) - val UNPROCESSABLE_ENTITY = code(HttpStatus.UNPROCESSABLE_ENTITY()) + val UNPROCESSABLE_ENTITY = code(HttpStatus.UNPROCESSABLE_ENTITY) - val LOCKED = code(HttpStatus.LOCKED()) + val LOCKED = code(HttpStatus.LOCKED) - val FAILED_DEPENDENCY = code(HttpStatus.FAILED_DEPENDENCY()) + val FAILED_DEPENDENCY = code(HttpStatus.FAILED_DEPENDENCY) - val UPGRADE_REQUIRED = code(HttpStatus.UPGRADE_REQUIRED()) + val UPGRADE_REQUIRED = code(HttpStatus.UPGRADE_REQUIRED) - val PRECONDITION_REQUIRED = code(HttpStatus.PRECONDITION_REQUIRED()) + val PRECONDITION_REQUIRED = code(HttpStatus.PRECONDITION_REQUIRED) - val TOO_MANY_REQUESTS = code(HttpStatus.TOO_MANY_REQUESTS()) + val TOO_MANY_REQUESTS = code(HttpStatus.TOO_MANY_REQUESTS) - val REQUEST_HEADER_FIELDS_TOO_LARGE = code(HttpStatus.REQUEST_HEADER_FIELDS_TOO_LARGE()) + val REQUEST_HEADER_FIELDS_TOO_LARGE = code(HttpStatus.REQUEST_HEADER_FIELDS_TOO_LARGE) - val UNAVAILABLE_FOR_LEGAL_REASONS = code(HttpStatus.UNAVAILABLE_FOR_LEGAL_REASONS()) + val UNAVAILABLE_FOR_LEGAL_REASONS = code(HttpStatus.UNAVAILABLE_FOR_LEGAL_REASONS) - val INTERNAL_SERVER_ERROR = code(HttpStatus.INTERNAL_SERVER_ERROR()) + val INTERNAL_SERVER_ERROR = code(HttpStatus.INTERNAL_SERVER_ERROR) - val NOT_IMPLEMENTED = code(HttpStatus.NOT_IMPLEMENTED()) + val NOT_IMPLEMENTED = code(HttpStatus.NOT_IMPLEMENTED) - val BAD_GATEWAY = code(HttpStatus.BAD_GATEWAY()) + val BAD_GATEWAY = code(HttpStatus.BAD_GATEWAY) - val SERVICE_UNAVAILABLE = code(HttpStatus.SERVICE_UNAVAILABLE()) + val SERVICE_UNAVAILABLE = code(HttpStatus.SERVICE_UNAVAILABLE) - val GATEWAY_TIMEOUT = code(HttpStatus.GATEWAY_TIMEOUT()) + val GATEWAY_TIMEOUT = code(HttpStatus.GATEWAY_TIMEOUT) - val HTTP_VERSION_NOT_SUPPORTED = code(HttpStatus.HTTP_VERSION_NOT_SUPPORTED()) + val HTTP_VERSION_NOT_SUPPORTED = code(HttpStatus.HTTP_VERSION_NOT_SUPPORTED) - val VARIANT_ALSO_NEGOTIATES = code(HttpStatus.VARIANT_ALSO_NEGOTIATES()) + val VARIANT_ALSO_NEGOTIATES = code(HttpStatus.VARIANT_ALSO_NEGOTIATES) - val INSUFFICIENT_STORAGE = code(HttpStatus.INSUFFICIENT_STORAGE()) + val INSUFFICIENT_STORAGE = code(HttpStatus.INSUFFICIENT_STORAGE) - val LOOP_DETECTED = code(HttpStatus.LOOP_DETECTED()) + val LOOP_DETECTED = code(HttpStatus.LOOP_DETECTED) - val BANDWIDTH_LIMIT_EXCEEDED = code(HttpStatus.BANDWIDTH_LIMIT_EXCEEDED()) + val BANDWIDTH_LIMIT_EXCEEDED = code(HttpStatus.BANDWIDTH_LIMIT_EXCEEDED) - val NOT_EXTENDED = code(HttpStatus.NOT_EXTENDED()) + val NOT_EXTENDED = code(HttpStatus.NOT_EXTENDED) - val NETWORK_AUTHENTICATION_REQUIRED = code(HttpStatus.NETWORK_AUTHENTICATION_REQUIRED()) + val NETWORK_AUTHENTICATION_REQUIRED = code(HttpStatus.NETWORK_AUTHENTICATION_REQUIRED) /* HELPER FUNCTIONS */ diff --git a/specs/spring-cloud-contract-spec/src/test/groovy/org/springframework/cloud/contract/spec/internal/HttpStatusTests.java b/specs/spring-cloud-contract-spec/src/test/groovy/org/springframework/cloud/contract/spec/internal/HttpStatusTests.java index 95f4c64f44..b70d222ffe 100644 --- a/specs/spring-cloud-contract-spec/src/test/groovy/org/springframework/cloud/contract/spec/internal/HttpStatusTests.java +++ b/specs/spring-cloud-contract-spec/src/test/groovy/org/springframework/cloud/contract/spec/internal/HttpStatusTests.java @@ -27,337 +27,458 @@ public class HttpStatusTests { @Test public void CONTINUE() { - BDDAssertions.then(HttpStatus.CONTINUE()).isEqualTo(100); + BDDAssertions.then(HttpStatus.CONTINUE).isEqualTo(100); + BDDAssertions.then(new HttpStatus().CONTINUE()).isEqualTo(HttpStatus.CONTINUE); } @Test public void SWITCHING_PROTOCOLS() { - BDDAssertions.then(HttpStatus.SWITCHING_PROTOCOLS()).isEqualTo(101); + BDDAssertions.then(HttpStatus.SWITCHING_PROTOCOLS).isEqualTo(101); + BDDAssertions.then(new HttpStatus().SWITCHING_PROTOCOLS()) + .isEqualTo(HttpStatus.SWITCHING_PROTOCOLS); } @Test public void PROCESSING() { - BDDAssertions.then(HttpStatus.PROCESSING()).isEqualTo(102); + BDDAssertions.then(HttpStatus.PROCESSING).isEqualTo(102); + BDDAssertions.then(new HttpStatus().PROCESSING()) + .isEqualTo(HttpStatus.PROCESSING); } @Test public void CHECKPOINT() { - BDDAssertions.then(HttpStatus.CHECKPOINT()).isEqualTo(103); + BDDAssertions.then(HttpStatus.CHECKPOINT).isEqualTo(103); + BDDAssertions.then(new HttpStatus().CHECKPOINT()) + .isEqualTo(HttpStatus.CHECKPOINT); } @Test public void OK() { - BDDAssertions.then(HttpStatus.OK()).isEqualTo(200); + BDDAssertions.then(HttpStatus.OK).isEqualTo(200); + BDDAssertions.then(new HttpStatus().OK()).isEqualTo(HttpStatus.OK); } @Test public void CREATED() { - BDDAssertions.then(HttpStatus.CREATED()).isEqualTo(201); + BDDAssertions.then(HttpStatus.CREATED).isEqualTo(201); + BDDAssertions.then(new HttpStatus().CREATED()).isEqualTo(HttpStatus.CREATED); } @Test public void ACCEPTED() { - BDDAssertions.then(HttpStatus.ACCEPTED()).isEqualTo(202); + BDDAssertions.then(HttpStatus.ACCEPTED).isEqualTo(202); + BDDAssertions.then(new HttpStatus().ACCEPTED()).isEqualTo(HttpStatus.ACCEPTED); } @Test public void NON_AUTHORITATIVE_INFORMATION() { - BDDAssertions.then(HttpStatus.NON_AUTHORITATIVE_INFORMATION()).isEqualTo(203); + BDDAssertions.then(HttpStatus.NON_AUTHORITATIVE_INFORMATION).isEqualTo(203); + BDDAssertions.then(new HttpStatus().NON_AUTHORITATIVE_INFORMATION()) + .isEqualTo(HttpStatus.NON_AUTHORITATIVE_INFORMATION); } @Test public void NO_CONTENT() { - BDDAssertions.then(HttpStatus.NO_CONTENT()).isEqualTo(204); + BDDAssertions.then(HttpStatus.NO_CONTENT).isEqualTo(204); + BDDAssertions.then(new HttpStatus().NO_CONTENT()) + .isEqualTo(HttpStatus.NO_CONTENT); } @Test public void RESET_CONTENT() { - BDDAssertions.then(HttpStatus.RESET_CONTENT()).isEqualTo(205); + BDDAssertions.then(HttpStatus.RESET_CONTENT).isEqualTo(205); + BDDAssertions.then(new HttpStatus().RESET_CONTENT()) + .isEqualTo(HttpStatus.RESET_CONTENT); } @Test public void PARTIAL_CONTENT() { - BDDAssertions.then(HttpStatus.PARTIAL_CONTENT()).isEqualTo(206); + BDDAssertions.then(HttpStatus.PARTIAL_CONTENT).isEqualTo(206); + BDDAssertions.then(new HttpStatus().PARTIAL_CONTENT()) + .isEqualTo(HttpStatus.PARTIAL_CONTENT); } @Test public void MULTI_STATUS() { - BDDAssertions.then(HttpStatus.MULTI_STATUS()).isEqualTo(207); + BDDAssertions.then(HttpStatus.MULTI_STATUS).isEqualTo(207); + BDDAssertions.then(new HttpStatus().MULTI_STATUS()) + .isEqualTo(HttpStatus.MULTI_STATUS); } @Test public void ALREADY_REPORTED() { - BDDAssertions.then(HttpStatus.ALREADY_REPORTED()).isEqualTo(208); + BDDAssertions.then(HttpStatus.ALREADY_REPORTED).isEqualTo(208); + BDDAssertions.then(new HttpStatus().ALREADY_REPORTED()) + .isEqualTo(HttpStatus.ALREADY_REPORTED); } @Test public void IM_USED() { - BDDAssertions.then(HttpStatus.IM_USED()).isEqualTo(226); + BDDAssertions.then(HttpStatus.IM_USED).isEqualTo(226); + BDDAssertions.then(new HttpStatus().IM_USED()).isEqualTo(HttpStatus.IM_USED); } @Test public void MULTIPLE_CHOICES() { - BDDAssertions.then(HttpStatus.MULTIPLE_CHOICES()).isEqualTo(300); + BDDAssertions.then(HttpStatus.MULTIPLE_CHOICES).isEqualTo(300); + BDDAssertions.then(new HttpStatus().MULTIPLE_CHOICES()) + .isEqualTo(HttpStatus.MULTIPLE_CHOICES); } @Test public void MOVED_PERMANENTLY() { - BDDAssertions.then(HttpStatus.MOVED_PERMANENTLY()).isEqualTo(301); + BDDAssertions.then(HttpStatus.MOVED_PERMANENTLY).isEqualTo(301); + BDDAssertions.then(new HttpStatus().MOVED_PERMANENTLY()) + .isEqualTo(HttpStatus.MOVED_PERMANENTLY); } @Test public void FOUND() { - BDDAssertions.then(HttpStatus.FOUND()).isEqualTo(302); + BDDAssertions.then(HttpStatus.FOUND).isEqualTo(302); + BDDAssertions.then(new HttpStatus().FOUND()).isEqualTo(HttpStatus.FOUND); } @Test public void MOVED_TEMPORARILY() { - BDDAssertions.then(HttpStatus.MOVED_TEMPORARILY()).isEqualTo(302); + BDDAssertions.then(HttpStatus.MOVED_TEMPORARILY).isEqualTo(302); + BDDAssertions.then(new HttpStatus().MOVED_TEMPORARILY()) + .isEqualTo(HttpStatus.MOVED_TEMPORARILY); } @Test public void SEE_OTHER() { - BDDAssertions.then(HttpStatus.SEE_OTHER()).isEqualTo(303); + BDDAssertions.then(HttpStatus.SEE_OTHER).isEqualTo(303); + BDDAssertions.then(new HttpStatus().SEE_OTHER()).isEqualTo(HttpStatus.SEE_OTHER); } @Test public void NOT_MODIFIED() { - BDDAssertions.then(HttpStatus.NOT_MODIFIED()).isEqualTo(304); + BDDAssertions.then(HttpStatus.NOT_MODIFIED).isEqualTo(304); + BDDAssertions.then(new HttpStatus().NOT_MODIFIED()) + .isEqualTo(HttpStatus.NOT_MODIFIED); } @Test public void USE_PROXY() { - BDDAssertions.then(HttpStatus.USE_PROXY()).isEqualTo(305); + BDDAssertions.then(HttpStatus.USE_PROXY).isEqualTo(305); + BDDAssertions.then(new HttpStatus().USE_PROXY()).isEqualTo(HttpStatus.USE_PROXY); } @Test public void TEMPORARY_REDIRECT() { - BDDAssertions.then(HttpStatus.TEMPORARY_REDIRECT()).isEqualTo(307); + BDDAssertions.then(HttpStatus.TEMPORARY_REDIRECT).isEqualTo(307); + BDDAssertions.then(new HttpStatus().TEMPORARY_REDIRECT()) + .isEqualTo(HttpStatus.TEMPORARY_REDIRECT); } @Test public void PERMANENT_REDIRECT() { - BDDAssertions.then(HttpStatus.PERMANENT_REDIRECT()).isEqualTo(308); + BDDAssertions.then(HttpStatus.PERMANENT_REDIRECT).isEqualTo(308); + BDDAssertions.then(new HttpStatus().PERMANENT_REDIRECT()) + .isEqualTo(HttpStatus.PERMANENT_REDIRECT); } @Test public void BAD_REQUEST() { - BDDAssertions.then(HttpStatus.BAD_REQUEST()).isEqualTo(400); + BDDAssertions.then(HttpStatus.BAD_REQUEST).isEqualTo(400); + BDDAssertions.then(new HttpStatus().BAD_REQUEST()) + .isEqualTo(HttpStatus.BAD_REQUEST); } @Test public void UNAUTHORIZED() { - BDDAssertions.then(HttpStatus.UNAUTHORIZED()).isEqualTo(401); + BDDAssertions.then(HttpStatus.UNAUTHORIZED).isEqualTo(401); + BDDAssertions.then(new HttpStatus().UNAUTHORIZED()) + .isEqualTo(HttpStatus.UNAUTHORIZED); } @Test public void PAYMENT_REQUIRED() { - BDDAssertions.then(HttpStatus.PAYMENT_REQUIRED()).isEqualTo(402); + BDDAssertions.then(HttpStatus.PAYMENT_REQUIRED).isEqualTo(402); + BDDAssertions.then(new HttpStatus().PAYMENT_REQUIRED()) + .isEqualTo(HttpStatus.PAYMENT_REQUIRED); } @Test public void FORBIDDEN() { - BDDAssertions.then(HttpStatus.FORBIDDEN()).isEqualTo(403); + BDDAssertions.then(HttpStatus.FORBIDDEN).isEqualTo(403); + BDDAssertions.then(new HttpStatus().FORBIDDEN()).isEqualTo(HttpStatus.FORBIDDEN); } @Test public void NOT_FOUND() { - BDDAssertions.then(HttpStatus.NOT_FOUND()).isEqualTo(404); + BDDAssertions.then(HttpStatus.NOT_FOUND).isEqualTo(404); + BDDAssertions.then(new HttpStatus().NOT_FOUND()).isEqualTo(HttpStatus.NOT_FOUND); } @Test public void METHOD_NOT_ALLOWED() { - BDDAssertions.then(HttpStatus.METHOD_NOT_ALLOWED()).isEqualTo(405); + BDDAssertions.then(HttpStatus.METHOD_NOT_ALLOWED).isEqualTo(405); + BDDAssertions.then(new HttpStatus().METHOD_NOT_ALLOWED()) + .isEqualTo(HttpStatus.METHOD_NOT_ALLOWED); } @Test public void NOT_ACCEPTABLE() { - BDDAssertions.then(HttpStatus.NOT_ACCEPTABLE()).isEqualTo(406); + BDDAssertions.then(HttpStatus.NOT_ACCEPTABLE).isEqualTo(406); + BDDAssertions.then(new HttpStatus().NOT_ACCEPTABLE()) + .isEqualTo(HttpStatus.NOT_ACCEPTABLE); } @Test public void PROXY_AUTHENTICATION_REQUIRED() { - BDDAssertions.then(HttpStatus.PROXY_AUTHENTICATION_REQUIRED()).isEqualTo(407); + BDDAssertions.then(HttpStatus.PROXY_AUTHENTICATION_REQUIRED).isEqualTo(407); + BDDAssertions.then(new HttpStatus().PROXY_AUTHENTICATION_REQUIRED()) + .isEqualTo(HttpStatus.PROXY_AUTHENTICATION_REQUIRED); } @Test public void REQUEST_TIMEOUT() { - BDDAssertions.then(HttpStatus.REQUEST_TIMEOUT()).isEqualTo(408); + BDDAssertions.then(HttpStatus.REQUEST_TIMEOUT).isEqualTo(408); + BDDAssertions.then(new HttpStatus().REQUEST_TIMEOUT()) + .isEqualTo(HttpStatus.REQUEST_TIMEOUT); } @Test public void CONFLICT() { - BDDAssertions.then(HttpStatus.CONFLICT()).isEqualTo(409); + BDDAssertions.then(HttpStatus.CONFLICT).isEqualTo(409); + BDDAssertions.then(new HttpStatus().CONFLICT()).isEqualTo(HttpStatus.CONFLICT); } @Test public void GONE() { - BDDAssertions.then(HttpStatus.GONE()).isEqualTo(410); + BDDAssertions.then(HttpStatus.GONE).isEqualTo(410); + BDDAssertions.then(new HttpStatus().GONE()).isEqualTo(HttpStatus.GONE); } @Test public void LENGTH_REQUIRED() { - BDDAssertions.then(HttpStatus.LENGTH_REQUIRED()).isEqualTo(411); + BDDAssertions.then(HttpStatus.LENGTH_REQUIRED).isEqualTo(411); + BDDAssertions.then(new HttpStatus().LENGTH_REQUIRED()) + .isEqualTo(HttpStatus.LENGTH_REQUIRED); } @Test public void PRECONDITION_FAILED() { - BDDAssertions.then(HttpStatus.PRECONDITION_FAILED()).isEqualTo(412); + BDDAssertions.then(HttpStatus.PRECONDITION_FAILED).isEqualTo(412); + BDDAssertions.then(new HttpStatus().PRECONDITION_FAILED()) + .isEqualTo(HttpStatus.PRECONDITION_FAILED); } @Test public void PAYLOAD_TOO_LARGE() { - BDDAssertions.then(HttpStatus.PAYLOAD_TOO_LARGE()).isEqualTo(413); + BDDAssertions.then(HttpStatus.PAYLOAD_TOO_LARGE).isEqualTo(413); + BDDAssertions.then(new HttpStatus().PAYLOAD_TOO_LARGE()) + .isEqualTo(HttpStatus.PAYLOAD_TOO_LARGE); } @Test public void REQUEST_ENTITY_TOO_LARGE() { - BDDAssertions.then(HttpStatus.REQUEST_ENTITY_TOO_LARGE()).isEqualTo(413); + BDDAssertions.then(HttpStatus.REQUEST_ENTITY_TOO_LARGE).isEqualTo(413); + BDDAssertions.then(new HttpStatus().REQUEST_ENTITY_TOO_LARGE()) + .isEqualTo(HttpStatus.REQUEST_ENTITY_TOO_LARGE); } @Test public void URI_TOO_LONG() { - BDDAssertions.then(HttpStatus.URI_TOO_LONG()).isEqualTo(414); + BDDAssertions.then(HttpStatus.URI_TOO_LONG).isEqualTo(414); + BDDAssertions.then(new HttpStatus().URI_TOO_LONG()) + .isEqualTo(HttpStatus.URI_TOO_LONG); } @Test public void REQUEST_URI_TOO_LONG() { - BDDAssertions.then(HttpStatus.REQUEST_URI_TOO_LONG()).isEqualTo(414); + BDDAssertions.then(HttpStatus.REQUEST_URI_TOO_LONG).isEqualTo(414); + BDDAssertions.then(new HttpStatus().REQUEST_URI_TOO_LONG()) + .isEqualTo(HttpStatus.REQUEST_URI_TOO_LONG); } @Test public void UNSUPPORTED_MEDIA_TYPE() { - BDDAssertions.then(HttpStatus.UNSUPPORTED_MEDIA_TYPE()).isEqualTo(415); + BDDAssertions.then(HttpStatus.UNSUPPORTED_MEDIA_TYPE).isEqualTo(415); + BDDAssertions.then(new HttpStatus().UNSUPPORTED_MEDIA_TYPE()) + .isEqualTo(HttpStatus.UNSUPPORTED_MEDIA_TYPE); } @Test public void REQUESTED_RANGE_NOT_SATISFIABLE() { - BDDAssertions.then(HttpStatus.REQUESTED_RANGE_NOT_SATISFIABLE()).isEqualTo(416); + BDDAssertions.then(HttpStatus.REQUESTED_RANGE_NOT_SATISFIABLE).isEqualTo(416); + BDDAssertions.then(new HttpStatus().REQUESTED_RANGE_NOT_SATISFIABLE()) + .isEqualTo(HttpStatus.REQUESTED_RANGE_NOT_SATISFIABLE); } @Test public void EXPECTATION_FAILED() { - BDDAssertions.then(HttpStatus.EXPECTATION_FAILED()).isEqualTo(417); + BDDAssertions.then(HttpStatus.EXPECTATION_FAILED).isEqualTo(417); + BDDAssertions.then(new HttpStatus().EXPECTATION_FAILED()) + .isEqualTo(HttpStatus.EXPECTATION_FAILED); } @Test public void I_AM_A_TEAPOT() { - BDDAssertions.then(HttpStatus.I_AM_A_TEAPOT()).isEqualTo(418); + BDDAssertions.then(HttpStatus.I_AM_A_TEAPOT).isEqualTo(418); + BDDAssertions.then(new HttpStatus().I_AM_A_TEAPOT()) + .isEqualTo(HttpStatus.I_AM_A_TEAPOT); } @Test public void INSUFFICIENT_SPACE_ON_RESOURCE() { - BDDAssertions.then(HttpStatus.INSUFFICIENT_SPACE_ON_RESOURCE()).isEqualTo(419); + BDDAssertions.then(HttpStatus.INSUFFICIENT_SPACE_ON_RESOURCE).isEqualTo(419); + BDDAssertions.then(new HttpStatus().INSUFFICIENT_SPACE_ON_RESOURCE()) + .isEqualTo(HttpStatus.INSUFFICIENT_SPACE_ON_RESOURCE); } @Test public void METHOD_FAILURE() { - BDDAssertions.then(HttpStatus.METHOD_FAILURE()).isEqualTo(420); + BDDAssertions.then(HttpStatus.METHOD_FAILURE).isEqualTo(420); + BDDAssertions.then(new HttpStatus().METHOD_FAILURE()) + .isEqualTo(HttpStatus.METHOD_FAILURE); } @Test public void DESTINATION_LOCKED() { - BDDAssertions.then(HttpStatus.DESTINATION_LOCKED()).isEqualTo(421); + BDDAssertions.then(HttpStatus.DESTINATION_LOCKED).isEqualTo(421); + BDDAssertions.then(new HttpStatus().DESTINATION_LOCKED()) + .isEqualTo(HttpStatus.DESTINATION_LOCKED); } @Test public void UNPROCESSABLE_ENTITY() { - BDDAssertions.then(HttpStatus.UNPROCESSABLE_ENTITY()).isEqualTo(422); + BDDAssertions.then(HttpStatus.UNPROCESSABLE_ENTITY).isEqualTo(422); + BDDAssertions.then(new HttpStatus().UNPROCESSABLE_ENTITY()) + .isEqualTo(HttpStatus.UNPROCESSABLE_ENTITY); } @Test public void LOCKED() { - BDDAssertions.then(HttpStatus.LOCKED()).isEqualTo(423); + BDDAssertions.then(HttpStatus.LOCKED).isEqualTo(423); + BDDAssertions.then(new HttpStatus().LOCKED()).isEqualTo(HttpStatus.LOCKED); } @Test public void FAILED_DEPENDENCY() { - BDDAssertions.then(HttpStatus.FAILED_DEPENDENCY()).isEqualTo(424); + BDDAssertions.then(HttpStatus.FAILED_DEPENDENCY).isEqualTo(424); + BDDAssertions.then(new HttpStatus().FAILED_DEPENDENCY()) + .isEqualTo(HttpStatus.FAILED_DEPENDENCY); } @Test public void UPGRADE_REQUIRED() { - BDDAssertions.then(HttpStatus.UPGRADE_REQUIRED()).isEqualTo(426); + BDDAssertions.then(HttpStatus.UPGRADE_REQUIRED).isEqualTo(426); + BDDAssertions.then(new HttpStatus().UPGRADE_REQUIRED()) + .isEqualTo(HttpStatus.UPGRADE_REQUIRED); } @Test public void PRECONDITION_REQUIRED() { - BDDAssertions.then(HttpStatus.PRECONDITION_REQUIRED()).isEqualTo(428); + BDDAssertions.then(HttpStatus.PRECONDITION_REQUIRED).isEqualTo(428); + BDDAssertions.then(new HttpStatus().PRECONDITION_REQUIRED()) + .isEqualTo(HttpStatus.PRECONDITION_REQUIRED); } @Test public void TOO_MANY_REQUESTS() { - BDDAssertions.then(HttpStatus.TOO_MANY_REQUESTS()).isEqualTo(429); + BDDAssertions.then(HttpStatus.TOO_MANY_REQUESTS).isEqualTo(429); + BDDAssertions.then(new HttpStatus().TOO_MANY_REQUESTS()) + .isEqualTo(HttpStatus.TOO_MANY_REQUESTS); } @Test public void REQUEST_HEADER_FIELDS_TOO_LARGE() { - BDDAssertions.then(HttpStatus.REQUEST_HEADER_FIELDS_TOO_LARGE()).isEqualTo(431); + BDDAssertions.then(HttpStatus.REQUEST_HEADER_FIELDS_TOO_LARGE).isEqualTo(431); + BDDAssertions.then(new HttpStatus().REQUEST_HEADER_FIELDS_TOO_LARGE()) + .isEqualTo(HttpStatus.REQUEST_HEADER_FIELDS_TOO_LARGE); } @Test public void UNAVAILABLE_FOR_LEGAL_REASONS() { - BDDAssertions.then(HttpStatus.UNAVAILABLE_FOR_LEGAL_REASONS()).isEqualTo(451); + BDDAssertions.then(HttpStatus.UNAVAILABLE_FOR_LEGAL_REASONS).isEqualTo(451); + BDDAssertions.then(new HttpStatus().UNAVAILABLE_FOR_LEGAL_REASONS()) + .isEqualTo(HttpStatus.UNAVAILABLE_FOR_LEGAL_REASONS); } @Test public void INTERNAL_SERVER_ERROR() { - BDDAssertions.then(HttpStatus.INTERNAL_SERVER_ERROR()).isEqualTo(500); + BDDAssertions.then(HttpStatus.INTERNAL_SERVER_ERROR).isEqualTo(500); + BDDAssertions.then(new HttpStatus().INTERNAL_SERVER_ERROR()) + .isEqualTo(HttpStatus.INTERNAL_SERVER_ERROR); } @Test public void NOT_IMPLEMENTED() { - BDDAssertions.then(HttpStatus.NOT_IMPLEMENTED()).isEqualTo(501); + BDDAssertions.then(HttpStatus.NOT_IMPLEMENTED).isEqualTo(501); + BDDAssertions.then(new HttpStatus().NOT_IMPLEMENTED()) + .isEqualTo(HttpStatus.NOT_IMPLEMENTED); } @Test public void BAD_GATEWAY() { - BDDAssertions.then(HttpStatus.BAD_GATEWAY()).isEqualTo(502); + BDDAssertions.then(HttpStatus.BAD_GATEWAY).isEqualTo(502); + BDDAssertions.then(new HttpStatus().BAD_GATEWAY()) + .isEqualTo(HttpStatus.BAD_GATEWAY); } @Test public void SERVICE_UNAVAILABLE() { - BDDAssertions.then(HttpStatus.SERVICE_UNAVAILABLE()).isEqualTo(503); + BDDAssertions.then(HttpStatus.SERVICE_UNAVAILABLE).isEqualTo(503); + BDDAssertions.then(new HttpStatus().SERVICE_UNAVAILABLE()) + .isEqualTo(HttpStatus.SERVICE_UNAVAILABLE); } @Test public void GATEWAY_TIMEOUT() { - BDDAssertions.then(HttpStatus.GATEWAY_TIMEOUT()).isEqualTo(504); + BDDAssertions.then(HttpStatus.GATEWAY_TIMEOUT).isEqualTo(504); + BDDAssertions.then(new HttpStatus().GATEWAY_TIMEOUT()) + .isEqualTo(HttpStatus.GATEWAY_TIMEOUT); } @Test public void HTTP_VERSION_NOT_SUPPORTED() { - BDDAssertions.then(HttpStatus.HTTP_VERSION_NOT_SUPPORTED()).isEqualTo(505); + BDDAssertions.then(HttpStatus.HTTP_VERSION_NOT_SUPPORTED).isEqualTo(505); + BDDAssertions.then(new HttpStatus().HTTP_VERSION_NOT_SUPPORTED()) + .isEqualTo(HttpStatus.HTTP_VERSION_NOT_SUPPORTED); } @Test public void VARIANT_ALSO_NEGOTIATES() { - BDDAssertions.then(HttpStatus.VARIANT_ALSO_NEGOTIATES()).isEqualTo(506); + BDDAssertions.then(HttpStatus.VARIANT_ALSO_NEGOTIATES).isEqualTo(506); + BDDAssertions.then(new HttpStatus().VARIANT_ALSO_NEGOTIATES()) + .isEqualTo(HttpStatus.VARIANT_ALSO_NEGOTIATES); } @Test public void INSUFFICIENT_STORAGE() { - BDDAssertions.then(HttpStatus.INSUFFICIENT_STORAGE()).isEqualTo(507); + BDDAssertions.then(HttpStatus.INSUFFICIENT_STORAGE).isEqualTo(507); + BDDAssertions.then(new HttpStatus().INSUFFICIENT_STORAGE()) + .isEqualTo(HttpStatus.INSUFFICIENT_STORAGE); } @Test public void LOOP_DETECTED() { - BDDAssertions.then(HttpStatus.LOOP_DETECTED()).isEqualTo(508); + BDDAssertions.then(HttpStatus.LOOP_DETECTED).isEqualTo(508); + BDDAssertions.then(new HttpStatus().LOOP_DETECTED()) + .isEqualTo(HttpStatus.LOOP_DETECTED); } @Test public void BANDWIDTH_LIMIT_EXCEEDED() { - BDDAssertions.then(HttpStatus.BANDWIDTH_LIMIT_EXCEEDED()).isEqualTo(509); + BDDAssertions.then(HttpStatus.BANDWIDTH_LIMIT_EXCEEDED).isEqualTo(509); + BDDAssertions.then(new HttpStatus().BANDWIDTH_LIMIT_EXCEEDED()) + .isEqualTo(HttpStatus.BANDWIDTH_LIMIT_EXCEEDED); } @Test public void NOT_EXTENDED() { - BDDAssertions.then(HttpStatus.NOT_EXTENDED()).isEqualTo(510); + BDDAssertions.then(HttpStatus.NOT_EXTENDED).isEqualTo(510); + BDDAssertions.then(new HttpStatus().NOT_EXTENDED()) + .isEqualTo(HttpStatus.NOT_EXTENDED); } @Test public void NETWORK_AUTHENTICATION_REQUIRED() { - BDDAssertions.then(HttpStatus.NETWORK_AUTHENTICATION_REQUIRED()).isEqualTo(511); + BDDAssertions.then(HttpStatus.NETWORK_AUTHENTICATION_REQUIRED).isEqualTo(511); + BDDAssertions.then(new HttpStatus().NETWORK_AUTHENTICATION_REQUIRED()) + .isEqualTo(HttpStatus.NETWORK_AUTHENTICATION_REQUIRED); } }