Refactored internals
This commit is contained in:
@@ -42,10 +42,6 @@ public class Headers {
|
||||
private static final BiFunction<String, Header, Object> SERVER_SIDE = (s,
|
||||
header) -> ContractUtils.convertTestSideRecursively(header);
|
||||
|
||||
private MediaTypes mediaTypes = new MediaTypes();
|
||||
|
||||
private MessagingHeaders messagingHeaders = new MessagingHeaders();
|
||||
|
||||
private Set<Header> entries = new LinkedHashSet<>();
|
||||
|
||||
public void header(Map<String, Object> 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<Header> 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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -82,9 +82,11 @@ public class Request extends Common implements RegexCreatingProperty<ClientDslPr
|
||||
/**
|
||||
* Name of the HTTP method.
|
||||
* @param httpMethod HTTP method name
|
||||
* @deprecated In favor of {@code method(String method)}
|
||||
*/
|
||||
@Deprecated
|
||||
public void method(HttpMethods.HttpMethod httpMethod) {
|
||||
this.method = toDslProperty(httpMethod.toString());
|
||||
this.method = toDslProperty(httpMethod.getMethodName());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -549,36 +551,36 @@ public class Request extends Common implements RegexCreatingProperty<ClientDslPr
|
||||
return property.anyOf(values);
|
||||
}
|
||||
|
||||
public HttpMethods.HttpMethod GET() {
|
||||
return HttpMethods.GET();
|
||||
public String GET() {
|
||||
return HttpMethods.GET;
|
||||
}
|
||||
|
||||
public HttpMethods.HttpMethod HEAD() {
|
||||
return HttpMethods.HEAD();
|
||||
public String HEAD() {
|
||||
return HttpMethods.HEAD;
|
||||
}
|
||||
|
||||
public HttpMethods.HttpMethod POST() {
|
||||
return HttpMethods.POST();
|
||||
public String POST() {
|
||||
return HttpMethods.POST;
|
||||
}
|
||||
|
||||
public HttpMethods.HttpMethod PUT() {
|
||||
return HttpMethods.PUT();
|
||||
public String PUT() {
|
||||
return HttpMethods.PUT;
|
||||
}
|
||||
|
||||
public HttpMethods.HttpMethod PATCH() {
|
||||
return HttpMethods.PATCH();
|
||||
public String PATCH() {
|
||||
return HttpMethods.PATCH;
|
||||
}
|
||||
|
||||
public HttpMethods.HttpMethod DELETE() {
|
||||
return HttpMethods.DELETE();
|
||||
public String DELETE() {
|
||||
return HttpMethods.DELETE;
|
||||
}
|
||||
|
||||
public HttpMethods.HttpMethod OPTIONS() {
|
||||
return HttpMethods.OPTIONS();
|
||||
public String OPTIONS() {
|
||||
return HttpMethods.OPTIONS;
|
||||
}
|
||||
|
||||
public HttpMethods.HttpMethod TRACE() {
|
||||
return HttpMethods.TRACE();
|
||||
public String TRACE() {
|
||||
return HttpMethods.TRACE;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -415,278 +415,278 @@ public class Response extends Common implements RegexCreatingProperty<ServerDslP
|
||||
}
|
||||
|
||||
public int CONTINUE() {
|
||||
return HttpStatus.CONTINUE();
|
||||
return HttpStatus.CONTINUE;
|
||||
}
|
||||
|
||||
public int SWITCHING_PROTOCOLS() {
|
||||
return HttpStatus.SWITCHING_PROTOCOLS();
|
||||
return HttpStatus.SWITCHING_PROTOCOLS;
|
||||
}
|
||||
|
||||
public int PROCESSING() {
|
||||
return HttpStatus.PROCESSING();
|
||||
return HttpStatus.PROCESSING;
|
||||
}
|
||||
|
||||
public int CHECKPOINT() {
|
||||
return HttpStatus.CHECKPOINT();
|
||||
return HttpStatus.CHECKPOINT;
|
||||
}
|
||||
|
||||
public int OK() {
|
||||
return HttpStatus.OK();
|
||||
return HttpStatus.OK;
|
||||
}
|
||||
|
||||
public int CREATED() {
|
||||
return HttpStatus.CREATED();
|
||||
return HttpStatus.CREATED;
|
||||
}
|
||||
|
||||
public int ACCEPTED() {
|
||||
return HttpStatus.ACCEPTED();
|
||||
return HttpStatus.ACCEPTED;
|
||||
}
|
||||
|
||||
public int NON_AUTHORITATIVE_INFORMATION() {
|
||||
return HttpStatus.NON_AUTHORITATIVE_INFORMATION();
|
||||
return HttpStatus.NON_AUTHORITATIVE_INFORMATION;
|
||||
}
|
||||
|
||||
public int NO_CONTENT() {
|
||||
return HttpStatus.NO_CONTENT();
|
||||
return HttpStatus.NO_CONTENT;
|
||||
}
|
||||
|
||||
public int RESET_CONTENT() {
|
||||
return HttpStatus.RESET_CONTENT();
|
||||
return HttpStatus.RESET_CONTENT;
|
||||
}
|
||||
|
||||
public int PARTIAL_CONTENT() {
|
||||
return HttpStatus.PARTIAL_CONTENT();
|
||||
return HttpStatus.PARTIAL_CONTENT;
|
||||
}
|
||||
|
||||
public int MULTI_STATUS() {
|
||||
return HttpStatus.MULTI_STATUS();
|
||||
return HttpStatus.MULTI_STATUS;
|
||||
}
|
||||
|
||||
public int ALREADY_REPORTED() {
|
||||
return HttpStatus.ALREADY_REPORTED();
|
||||
return HttpStatus.ALREADY_REPORTED;
|
||||
}
|
||||
|
||||
public int IM_USED() {
|
||||
return HttpStatus.IM_USED();
|
||||
return HttpStatus.IM_USED;
|
||||
}
|
||||
|
||||
public int MULTIPLE_CHOICES() {
|
||||
return HttpStatus.MULTIPLE_CHOICES();
|
||||
return HttpStatus.MULTIPLE_CHOICES;
|
||||
}
|
||||
|
||||
public int MOVED_PERMANENTLY() {
|
||||
return HttpStatus.MOVED_PERMANENTLY();
|
||||
return HttpStatus.MOVED_PERMANENTLY;
|
||||
}
|
||||
|
||||
public int FOUND() {
|
||||
return HttpStatus.FOUND();
|
||||
return HttpStatus.FOUND;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public int MOVED_TEMPORARILY() {
|
||||
return HttpStatus.MOVED_TEMPORARILY();
|
||||
return HttpStatus.MOVED_TEMPORARILY;
|
||||
}
|
||||
|
||||
public int SEE_OTHER() {
|
||||
return HttpStatus.SEE_OTHER();
|
||||
return HttpStatus.SEE_OTHER;
|
||||
}
|
||||
|
||||
public int NOT_MODIFIED() {
|
||||
return HttpStatus.NOT_MODIFIED();
|
||||
return HttpStatus.NOT_MODIFIED;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public int USE_PROXY() {
|
||||
return HttpStatus.USE_PROXY();
|
||||
return HttpStatus.USE_PROXY;
|
||||
}
|
||||
|
||||
public int TEMPORARY_REDIRECT() {
|
||||
return HttpStatus.TEMPORARY_REDIRECT();
|
||||
return HttpStatus.TEMPORARY_REDIRECT;
|
||||
}
|
||||
|
||||
public int PERMANENT_REDIRECT() {
|
||||
return HttpStatus.PERMANENT_REDIRECT();
|
||||
return HttpStatus.PERMANENT_REDIRECT;
|
||||
}
|
||||
|
||||
public int BAD_REQUEST() {
|
||||
return HttpStatus.BAD_REQUEST();
|
||||
return HttpStatus.BAD_REQUEST;
|
||||
}
|
||||
|
||||
public int UNAUTHORIZED() {
|
||||
return HttpStatus.UNAUTHORIZED();
|
||||
return HttpStatus.UNAUTHORIZED;
|
||||
}
|
||||
|
||||
public int PAYMENT_REQUIRED() {
|
||||
return HttpStatus.PAYMENT_REQUIRED();
|
||||
return HttpStatus.PAYMENT_REQUIRED;
|
||||
}
|
||||
|
||||
public int FORBIDDEN() {
|
||||
return HttpStatus.FORBIDDEN();
|
||||
return HttpStatus.FORBIDDEN;
|
||||
}
|
||||
|
||||
public int NOT_FOUND() {
|
||||
return HttpStatus.NOT_FOUND();
|
||||
return HttpStatus.NOT_FOUND;
|
||||
}
|
||||
|
||||
public int METHOD_NOT_ALLOWED() {
|
||||
return HttpStatus.METHOD_NOT_ALLOWED();
|
||||
return HttpStatus.METHOD_NOT_ALLOWED;
|
||||
}
|
||||
|
||||
public int NOT_ACCEPTABLE() {
|
||||
return HttpStatus.NOT_ACCEPTABLE();
|
||||
return HttpStatus.NOT_ACCEPTABLE;
|
||||
}
|
||||
|
||||
public int PROXY_AUTHENTICATION_REQUIRED() {
|
||||
return HttpStatus.PROXY_AUTHENTICATION_REQUIRED();
|
||||
return HttpStatus.PROXY_AUTHENTICATION_REQUIRED;
|
||||
}
|
||||
|
||||
public int REQUEST_TIMEOUT() {
|
||||
return HttpStatus.REQUEST_TIMEOUT();
|
||||
return HttpStatus.REQUEST_TIMEOUT;
|
||||
}
|
||||
|
||||
public int CONFLICT() {
|
||||
return HttpStatus.CONFLICT();
|
||||
return HttpStatus.CONFLICT;
|
||||
}
|
||||
|
||||
public int GONE() {
|
||||
return HttpStatus.GONE();
|
||||
return HttpStatus.GONE;
|
||||
}
|
||||
|
||||
public int LENGTH_REQUIRED() {
|
||||
return HttpStatus.LENGTH_REQUIRED();
|
||||
return HttpStatus.LENGTH_REQUIRED;
|
||||
}
|
||||
|
||||
public int PRECONDITION_FAILED() {
|
||||
return HttpStatus.PRECONDITION_FAILED();
|
||||
return HttpStatus.PRECONDITION_FAILED;
|
||||
}
|
||||
|
||||
public int PAYLOAD_TOO_LARGE() {
|
||||
return HttpStatus.PAYLOAD_TOO_LARGE();
|
||||
return HttpStatus.PAYLOAD_TOO_LARGE;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public int REQUEST_ENTITY_TOO_LARGE() {
|
||||
return HttpStatus.REQUEST_ENTITY_TOO_LARGE();
|
||||
return HttpStatus.REQUEST_ENTITY_TOO_LARGE;
|
||||
}
|
||||
|
||||
public int URI_TOO_LONG() {
|
||||
return HttpStatus.URI_TOO_LONG();
|
||||
return HttpStatus.URI_TOO_LONG;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public int REQUEST_URI_TOO_LONG() {
|
||||
return HttpStatus.REQUEST_URI_TOO_LONG();
|
||||
return HttpStatus.REQUEST_URI_TOO_LONG;
|
||||
}
|
||||
|
||||
public int UNSUPPORTED_MEDIA_TYPE() {
|
||||
return HttpStatus.UNSUPPORTED_MEDIA_TYPE();
|
||||
return HttpStatus.UNSUPPORTED_MEDIA_TYPE;
|
||||
}
|
||||
|
||||
public int REQUESTED_RANGE_NOT_SATISFIABLE() {
|
||||
return HttpStatus.REQUESTED_RANGE_NOT_SATISFIABLE();
|
||||
return HttpStatus.REQUESTED_RANGE_NOT_SATISFIABLE;
|
||||
}
|
||||
|
||||
public int EXPECTATION_FAILED() {
|
||||
return HttpStatus.EXPECTATION_FAILED();
|
||||
return HttpStatus.EXPECTATION_FAILED;
|
||||
}
|
||||
|
||||
public int I_AM_A_TEAPOT() {
|
||||
return HttpStatus.I_AM_A_TEAPOT();
|
||||
return HttpStatus.I_AM_A_TEAPOT;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public int INSUFFICIENT_SPACE_ON_RESOURCE() {
|
||||
return HttpStatus.INSUFFICIENT_SPACE_ON_RESOURCE();
|
||||
return HttpStatus.INSUFFICIENT_SPACE_ON_RESOURCE;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public int METHOD_FAILURE() {
|
||||
return HttpStatus.METHOD_FAILURE();
|
||||
return HttpStatus.METHOD_FAILURE;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public int DESTINATION_LOCKED() {
|
||||
return HttpStatus.DESTINATION_LOCKED();
|
||||
return HttpStatus.DESTINATION_LOCKED;
|
||||
}
|
||||
|
||||
public int UNPROCESSABLE_ENTITY() {
|
||||
return HttpStatus.UNPROCESSABLE_ENTITY();
|
||||
return HttpStatus.UNPROCESSABLE_ENTITY;
|
||||
}
|
||||
|
||||
public int LOCKED() {
|
||||
return HttpStatus.LOCKED();
|
||||
return HttpStatus.LOCKED;
|
||||
}
|
||||
|
||||
public int FAILED_DEPENDENCY() {
|
||||
return HttpStatus.FAILED_DEPENDENCY();
|
||||
return HttpStatus.FAILED_DEPENDENCY;
|
||||
}
|
||||
|
||||
public int UPGRADE_REQUIRED() {
|
||||
return HttpStatus.UPGRADE_REQUIRED();
|
||||
return HttpStatus.UPGRADE_REQUIRED;
|
||||
}
|
||||
|
||||
public int PRECONDITION_REQUIRED() {
|
||||
return HttpStatus.PRECONDITION_REQUIRED();
|
||||
return HttpStatus.PRECONDITION_REQUIRED;
|
||||
}
|
||||
|
||||
public int TOO_MANY_REQUESTS() {
|
||||
return HttpStatus.TOO_MANY_REQUESTS();
|
||||
return HttpStatus.TOO_MANY_REQUESTS;
|
||||
}
|
||||
|
||||
public int REQUEST_HEADER_FIELDS_TOO_LARGE() {
|
||||
return HttpStatus.REQUEST_HEADER_FIELDS_TOO_LARGE();
|
||||
return HttpStatus.REQUEST_HEADER_FIELDS_TOO_LARGE;
|
||||
}
|
||||
|
||||
public int UNAVAILABLE_FOR_LEGAL_REASONS() {
|
||||
return HttpStatus.UNAVAILABLE_FOR_LEGAL_REASONS();
|
||||
return HttpStatus.UNAVAILABLE_FOR_LEGAL_REASONS;
|
||||
}
|
||||
|
||||
public int INTERNAL_SERVER_ERROR() {
|
||||
return HttpStatus.INTERNAL_SERVER_ERROR();
|
||||
return HttpStatus.INTERNAL_SERVER_ERROR;
|
||||
}
|
||||
|
||||
public int NOT_IMPLEMENTED() {
|
||||
return HttpStatus.NOT_IMPLEMENTED();
|
||||
return HttpStatus.NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
public int BAD_GATEWAY() {
|
||||
return HttpStatus.BAD_GATEWAY();
|
||||
return HttpStatus.BAD_GATEWAY;
|
||||
}
|
||||
|
||||
public int SERVICE_UNAVAILABLE() {
|
||||
return HttpStatus.SERVICE_UNAVAILABLE();
|
||||
return HttpStatus.SERVICE_UNAVAILABLE;
|
||||
}
|
||||
|
||||
public int GATEWAY_TIMEOUT() {
|
||||
return HttpStatus.GATEWAY_TIMEOUT();
|
||||
return HttpStatus.GATEWAY_TIMEOUT;
|
||||
}
|
||||
|
||||
public int HTTP_VERSION_NOT_SUPPORTED() {
|
||||
return HttpStatus.HTTP_VERSION_NOT_SUPPORTED();
|
||||
return HttpStatus.HTTP_VERSION_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
public int VARIANT_ALSO_NEGOTIATES() {
|
||||
return HttpStatus.VARIANT_ALSO_NEGOTIATES();
|
||||
return HttpStatus.VARIANT_ALSO_NEGOTIATES;
|
||||
}
|
||||
|
||||
public int INSUFFICIENT_STORAGE() {
|
||||
return HttpStatus.INSUFFICIENT_STORAGE();
|
||||
return HttpStatus.INSUFFICIENT_STORAGE;
|
||||
}
|
||||
|
||||
public int LOOP_DETECTED() {
|
||||
return HttpStatus.LOOP_DETECTED();
|
||||
return HttpStatus.LOOP_DETECTED;
|
||||
}
|
||||
|
||||
public int BANDWIDTH_LIMIT_EXCEEDED() {
|
||||
return HttpStatus.BANDWIDTH_LIMIT_EXCEEDED();
|
||||
return HttpStatus.BANDWIDTH_LIMIT_EXCEEDED;
|
||||
}
|
||||
|
||||
public int NOT_EXTENDED() {
|
||||
return HttpStatus.NOT_EXTENDED();
|
||||
return HttpStatus.NOT_EXTENDED;
|
||||
}
|
||||
|
||||
public int NETWORK_AUTHENTICATION_REQUIRED() {
|
||||
return HttpStatus.NETWORK_AUTHENTICATION_REQUIRED();
|
||||
return HttpStatus.NETWORK_AUTHENTICATION_REQUIRED;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,434 @@
|
||||
/*
|
||||
* Copyright 2013-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cloud.contract.spec.internal;
|
||||
|
||||
import org.assertj.core.api.BDDAssertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* @author Tim Ysewyn
|
||||
*/
|
||||
public class HttpHeadersTests {
|
||||
|
||||
@Test
|
||||
public void ACCEPT() {
|
||||
BDDAssertions.then(HttpHeaders.ACCEPT).isEqualTo("Accept");
|
||||
BDDAssertions.then(new HttpHeaders().accept()).isEqualTo(HttpHeaders.ACCEPT);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void ACCEPT_CHARSET() {
|
||||
BDDAssertions.then(HttpHeaders.ACCEPT_CHARSET).isEqualTo("Accept-Charset");
|
||||
BDDAssertions.then(new HttpHeaders().acceptCharset())
|
||||
.isEqualTo(HttpHeaders.ACCEPT_CHARSET);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void ACCEPT_ENCODING() {
|
||||
BDDAssertions.then(HttpHeaders.ACCEPT_ENCODING).isEqualTo("Accept-Encoding");
|
||||
BDDAssertions.then(new HttpHeaders().acceptEncoding())
|
||||
.isEqualTo(HttpHeaders.ACCEPT_ENCODING);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void ACCEPT_LANGUAGE() {
|
||||
BDDAssertions.then(HttpHeaders.ACCEPT_LANGUAGE).isEqualTo("Accept-Language");
|
||||
BDDAssertions.then(new HttpHeaders().acceptLanguage())
|
||||
.isEqualTo(HttpHeaders.ACCEPT_LANGUAGE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void ACCEPT_RANGES() {
|
||||
BDDAssertions.then(HttpHeaders.ACCEPT_RANGES).isEqualTo("Accept-Ranges");
|
||||
BDDAssertions.then(new HttpHeaders().acceptRanges())
|
||||
.isEqualTo(HttpHeaders.ACCEPT_RANGES);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void ACCESS_CONTROL_ALLOW_CREDENTIALS() {
|
||||
BDDAssertions.then(HttpHeaders.ACCESS_CONTROL_ALLOW_CREDENTIALS)
|
||||
.isEqualTo("Access-Control-Allow-Credentials");
|
||||
BDDAssertions.then(new HttpHeaders().accessControlAllowCredentials())
|
||||
.isEqualTo(HttpHeaders.ACCESS_CONTROL_ALLOW_CREDENTIALS);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void ACCESS_CONTROL_ALLOW_HEADERS() {
|
||||
BDDAssertions.then(HttpHeaders.ACCESS_CONTROL_ALLOW_HEADERS)
|
||||
.isEqualTo("Access-Control-Allow-Headers");
|
||||
BDDAssertions.then(new HttpHeaders().accessControlAllowHeaders())
|
||||
.isEqualTo(HttpHeaders.ACCESS_CONTROL_ALLOW_HEADERS);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void ACCESS_CONTROL_ALLOW_METHODS() {
|
||||
BDDAssertions.then(HttpHeaders.ACCESS_CONTROL_ALLOW_METHODS)
|
||||
.isEqualTo("Access-Control-Allow-Methods");
|
||||
BDDAssertions.then(new HttpHeaders().accessControlAllowMethods())
|
||||
.isEqualTo(HttpHeaders.ACCESS_CONTROL_ALLOW_METHODS);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void ACCESS_CONTROL_ALLOW_ORIGIN() {
|
||||
BDDAssertions.then(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN)
|
||||
.isEqualTo("Access-Control-Allow-Origin");
|
||||
BDDAssertions.then(new HttpHeaders().accessControlAllowOrigin())
|
||||
.isEqualTo(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void ACCESS_CONTROL_EXPOSE_HEADERS() {
|
||||
BDDAssertions.then(HttpHeaders.ACCESS_CONTROL_EXPOSE_HEADERS)
|
||||
.isEqualTo("Access-Control-Expose-Headers");
|
||||
BDDAssertions.then(new HttpHeaders().accessControlExposeHeaders())
|
||||
.isEqualTo(HttpHeaders.ACCESS_CONTROL_EXPOSE_HEADERS);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void ACCESS_CONTROL_MAX_AGE() {
|
||||
BDDAssertions.then(HttpHeaders.ACCESS_CONTROL_MAX_AGE)
|
||||
.isEqualTo("Access-Control-Max-Age");
|
||||
BDDAssertions.then(new HttpHeaders().accessControlMaxAge())
|
||||
.isEqualTo(HttpHeaders.ACCESS_CONTROL_MAX_AGE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void ACCESS_CONTROL_REQUEST_HEADERS() {
|
||||
BDDAssertions.then(HttpHeaders.ACCESS_CONTROL_REQUEST_HEADERS)
|
||||
.isEqualTo("Access-Control-Request-Headers");
|
||||
BDDAssertions.then(new HttpHeaders().accessControlRequestHeaders())
|
||||
.isEqualTo(HttpHeaders.ACCESS_CONTROL_REQUEST_HEADERS);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void ACCESS_CONTROL_REQUEST_METHOD() {
|
||||
BDDAssertions.then(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD)
|
||||
.isEqualTo("Access-Control-Request-Method");
|
||||
BDDAssertions.then(new HttpHeaders().accessControlRequestMethod())
|
||||
.isEqualTo(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void AGE() {
|
||||
BDDAssertions.then(HttpHeaders.AGE).isEqualTo("Age");
|
||||
BDDAssertions.then(new HttpHeaders().age()).isEqualTo(HttpHeaders.AGE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void ALLOW() {
|
||||
BDDAssertions.then(HttpHeaders.ALLOW).isEqualTo("Allow");
|
||||
BDDAssertions.then(new HttpHeaders().allow()).isEqualTo(HttpHeaders.ALLOW);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void AUTHORIZATION() {
|
||||
BDDAssertions.then(HttpHeaders.AUTHORIZATION).isEqualTo("Authorization");
|
||||
BDDAssertions.then(new HttpHeaders().authorization())
|
||||
.isEqualTo(HttpHeaders.AUTHORIZATION);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void CACHE_CONTROL() {
|
||||
BDDAssertions.then(HttpHeaders.CACHE_CONTROL).isEqualTo("Cache-Control");
|
||||
BDDAssertions.then(new HttpHeaders().cacheControl())
|
||||
.isEqualTo(HttpHeaders.CACHE_CONTROL);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void CONNECTION() {
|
||||
BDDAssertions.then(HttpHeaders.CONNECTION).isEqualTo("Connection");
|
||||
BDDAssertions.then(new HttpHeaders().connection())
|
||||
.isEqualTo(HttpHeaders.CONNECTION);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void CONTENT_ENCODING() {
|
||||
BDDAssertions.then(HttpHeaders.CONTENT_ENCODING).isEqualTo("Content-Encoding");
|
||||
BDDAssertions.then(new HttpHeaders().contentEncoding())
|
||||
.isEqualTo(HttpHeaders.CONTENT_ENCODING);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void CONTENT_DISPOSITION() {
|
||||
BDDAssertions.then(HttpHeaders.CONTENT_DISPOSITION)
|
||||
.isEqualTo("Content-Disposition");
|
||||
BDDAssertions.then(new HttpHeaders().contentDisposition())
|
||||
.isEqualTo(HttpHeaders.CONTENT_DISPOSITION);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void CONTENT_LANGUAGE() {
|
||||
BDDAssertions.then(HttpHeaders.CONTENT_LANGUAGE).isEqualTo("Content-Language");
|
||||
BDDAssertions.then(new HttpHeaders().contentLanguage())
|
||||
.isEqualTo(HttpHeaders.CONTENT_LANGUAGE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void CONTENT_LENGTH() {
|
||||
BDDAssertions.then(HttpHeaders.CONTENT_LENGTH).isEqualTo("Content-Length");
|
||||
BDDAssertions.then(new HttpHeaders().contentLength())
|
||||
.isEqualTo(HttpHeaders.CONTENT_LENGTH);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void CONTENT_LOCATION() {
|
||||
BDDAssertions.then(HttpHeaders.CONTENT_LOCATION).isEqualTo("Content-Location");
|
||||
BDDAssertions.then(new HttpHeaders().contentLocation())
|
||||
.isEqualTo(HttpHeaders.CONTENT_LOCATION);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void CONTENT_RANGE() {
|
||||
BDDAssertions.then(HttpHeaders.CONTENT_RANGE).isEqualTo("Content-Range");
|
||||
BDDAssertions.then(new HttpHeaders().contentRange())
|
||||
.isEqualTo(HttpHeaders.CONTENT_RANGE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void CONTENT_TYPE() {
|
||||
BDDAssertions.then(HttpHeaders.CONTENT_TYPE).isEqualTo("Content-Type");
|
||||
BDDAssertions.then(new HttpHeaders().contentType())
|
||||
.isEqualTo(HttpHeaders.CONTENT_TYPE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void COOKIE() {
|
||||
BDDAssertions.then(HttpHeaders.COOKIE).isEqualTo("Cookie");
|
||||
BDDAssertions.then(new HttpHeaders().cookie()).isEqualTo(HttpHeaders.COOKIE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void DATE() {
|
||||
BDDAssertions.then(HttpHeaders.DATE).isEqualTo("Date");
|
||||
BDDAssertions.then(new HttpHeaders().date()).isEqualTo(HttpHeaders.DATE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void ETAG() {
|
||||
BDDAssertions.then(HttpHeaders.ETAG).isEqualTo("ETag");
|
||||
BDDAssertions.then(new HttpHeaders().etag()).isEqualTo(HttpHeaders.ETAG);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void EXPECT() {
|
||||
BDDAssertions.then(HttpHeaders.EXPECT).isEqualTo("Expect");
|
||||
BDDAssertions.then(new HttpHeaders().expect()).isEqualTo(HttpHeaders.EXPECT);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void EXPIRES() {
|
||||
BDDAssertions.then(HttpHeaders.EXPIRES).isEqualTo("Expires");
|
||||
BDDAssertions.then(new HttpHeaders().expires()).isEqualTo(HttpHeaders.EXPIRES);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void FROM() {
|
||||
BDDAssertions.then(HttpHeaders.FROM).isEqualTo("From");
|
||||
BDDAssertions.then(new HttpHeaders().from()).isEqualTo(HttpHeaders.FROM);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void HOST() {
|
||||
BDDAssertions.then(HttpHeaders.HOST).isEqualTo("Host");
|
||||
BDDAssertions.then(new HttpHeaders().host()).isEqualTo(HttpHeaders.HOST);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void IF_MATCH() {
|
||||
BDDAssertions.then(HttpHeaders.IF_MATCH).isEqualTo("If-Match");
|
||||
BDDAssertions.then(new HttpHeaders().ifMatch()).isEqualTo(HttpHeaders.IF_MATCH);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void IF_MODIFIED_SINCE() {
|
||||
BDDAssertions.then(HttpHeaders.IF_MODIFIED_SINCE).isEqualTo("If-Modified-Since");
|
||||
BDDAssertions.then(new HttpHeaders().ifModifiedSince())
|
||||
.isEqualTo(HttpHeaders.IF_MODIFIED_SINCE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void IF_NONE_MATCH() {
|
||||
BDDAssertions.then(HttpHeaders.IF_NONE_MATCH).isEqualTo("If-None-Match");
|
||||
BDDAssertions.then(new HttpHeaders().ifNoneMatch())
|
||||
.isEqualTo(HttpHeaders.IF_NONE_MATCH);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void IF_RANGE() {
|
||||
BDDAssertions.then(HttpHeaders.IF_RANGE).isEqualTo("If-Range");
|
||||
BDDAssertions.then(new HttpHeaders().ifRange()).isEqualTo(HttpHeaders.IF_RANGE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void IF_UNMODIFIED_SINCE() {
|
||||
BDDAssertions.then(HttpHeaders.IF_UNMODIFIED_SINCE)
|
||||
.isEqualTo("If-Unmodified-Since");
|
||||
BDDAssertions.then(new HttpHeaders().ifUnmodifiedSince())
|
||||
.isEqualTo(HttpHeaders.IF_UNMODIFIED_SINCE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void LAST_MODIFIED() {
|
||||
BDDAssertions.then(HttpHeaders.LAST_MODIFIED).isEqualTo("Last-Modified");
|
||||
BDDAssertions.then(new HttpHeaders().lastModified())
|
||||
.isEqualTo(HttpHeaders.LAST_MODIFIED);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void LINK() {
|
||||
BDDAssertions.then(HttpHeaders.LINK).isEqualTo("Link");
|
||||
BDDAssertions.then(new HttpHeaders().link()).isEqualTo(HttpHeaders.LINK);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void LOCATION() {
|
||||
BDDAssertions.then(HttpHeaders.LOCATION).isEqualTo("Location");
|
||||
BDDAssertions.then(new HttpHeaders().location()).isEqualTo(HttpHeaders.LOCATION);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void MAX_FORWARDS() {
|
||||
BDDAssertions.then(HttpHeaders.MAX_FORWARDS).isEqualTo("Max-Forwards");
|
||||
BDDAssertions.then(new HttpHeaders().max_forwards())
|
||||
.isEqualTo(HttpHeaders.MAX_FORWARDS);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void ORIGIN() {
|
||||
BDDAssertions.then(HttpHeaders.ORIGIN).isEqualTo("Origin");
|
||||
BDDAssertions.then(new HttpHeaders().origin()).isEqualTo(HttpHeaders.ORIGIN);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void PRAGMA() {
|
||||
BDDAssertions.then(HttpHeaders.PRAGMA).isEqualTo("Pragma");
|
||||
BDDAssertions.then(new HttpHeaders().pragma()).isEqualTo(HttpHeaders.PRAGMA);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void PROXY_AUTHENTICATE() {
|
||||
BDDAssertions.then(HttpHeaders.PROXY_AUTHENTICATE)
|
||||
.isEqualTo("Proxy-Authenticate");
|
||||
BDDAssertions.then(new HttpHeaders().proxyAuthenticate())
|
||||
.isEqualTo(HttpHeaders.PROXY_AUTHENTICATE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void PROXY_AUTHORIZATION() {
|
||||
BDDAssertions.then(HttpHeaders.PROXY_AUTHORIZATION)
|
||||
.isEqualTo("Proxy-Authorization");
|
||||
BDDAssertions.then(new HttpHeaders().proxyAuthorization())
|
||||
.isEqualTo(HttpHeaders.PROXY_AUTHORIZATION);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void RANGE() {
|
||||
BDDAssertions.then(HttpHeaders.RANGE).isEqualTo("Range");
|
||||
BDDAssertions.then(new HttpHeaders().range()).isEqualTo(HttpHeaders.RANGE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void REFERER() {
|
||||
BDDAssertions.then(HttpHeaders.REFERER).isEqualTo("Referer");
|
||||
BDDAssertions.then(new HttpHeaders().referer()).isEqualTo(HttpHeaders.REFERER);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void RETRY_AFTER() {
|
||||
BDDAssertions.then(HttpHeaders.RETRY_AFTER).isEqualTo("Retry-After");
|
||||
BDDAssertions.then(new HttpHeaders().retryAfter())
|
||||
.isEqualTo(HttpHeaders.RETRY_AFTER);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void SERVER() {
|
||||
BDDAssertions.then(HttpHeaders.SERVER).isEqualTo("Server");
|
||||
BDDAssertions.then(new HttpHeaders().server()).isEqualTo(HttpHeaders.SERVER);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void SET_COOKIE() {
|
||||
BDDAssertions.then(HttpHeaders.SET_COOKIE).isEqualTo("Set-Cookie");
|
||||
BDDAssertions.then(new HttpHeaders().setCookie())
|
||||
.isEqualTo(HttpHeaders.SET_COOKIE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void SET_COOKIE_2() {
|
||||
BDDAssertions.then(HttpHeaders.SET_COOKIE_2).isEqualTo("Set-Cookie2");
|
||||
BDDAssertions.then(new HttpHeaders().setCookie2())
|
||||
.isEqualTo(HttpHeaders.SET_COOKIE_2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void TE() {
|
||||
BDDAssertions.then(HttpHeaders.TE).isEqualTo("TE");
|
||||
BDDAssertions.then(new HttpHeaders().te()).isEqualTo(HttpHeaders.TE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void TRAILER() {
|
||||
BDDAssertions.then(HttpHeaders.TRAILER).isEqualTo("Trailer");
|
||||
BDDAssertions.then(new HttpHeaders().trailer()).isEqualTo(HttpHeaders.TRAILER);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void TRANSFER_ENCODING() {
|
||||
BDDAssertions.then(HttpHeaders.TRANSFER_ENCODING).isEqualTo("Transfer-Encoding");
|
||||
BDDAssertions.then(new HttpHeaders().transferEncoding())
|
||||
.isEqualTo(HttpHeaders.TRANSFER_ENCODING);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void UPGRADE() {
|
||||
BDDAssertions.then(HttpHeaders.UPGRADE).isEqualTo("Upgrade");
|
||||
BDDAssertions.then(new HttpHeaders().upgrade()).isEqualTo(HttpHeaders.UPGRADE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void USER_AGENT() {
|
||||
BDDAssertions.then(HttpHeaders.USER_AGENT).isEqualTo("User-Agent");
|
||||
BDDAssertions.then(new HttpHeaders().user_agent())
|
||||
.isEqualTo(HttpHeaders.USER_AGENT);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void VARY() {
|
||||
BDDAssertions.then(HttpHeaders.VARY).isEqualTo("Vary");
|
||||
BDDAssertions.then(new HttpHeaders().vary()).isEqualTo(HttpHeaders.VARY);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void VIA() {
|
||||
BDDAssertions.then(HttpHeaders.VIA).isEqualTo("Via");
|
||||
BDDAssertions.then(new HttpHeaders().via()).isEqualTo(HttpHeaders.VIA);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void WARNING() {
|
||||
BDDAssertions.then(HttpHeaders.WARNING).isEqualTo("Warning");
|
||||
BDDAssertions.then(new HttpHeaders().warning()).isEqualTo(HttpHeaders.WARNING);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void WWW_AUTHENTICATE() {
|
||||
BDDAssertions.then(HttpHeaders.WWW_AUTHENTICATE).isEqualTo("WWW-Authenticate");
|
||||
BDDAssertions.then(new HttpHeaders().wwwAuthenticate())
|
||||
.isEqualTo(HttpHeaders.WWW_AUTHENTICATE);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
* Copyright 2013-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cloud.contract.spec.internal;
|
||||
|
||||
import org.assertj.core.api.BDDAssertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* @author Tim Ysewyn
|
||||
*/
|
||||
public class HttpMethodsTests {
|
||||
|
||||
@Test
|
||||
public void GET() {
|
||||
BDDAssertions.then(HttpMethods.GET).isEqualTo("GET");
|
||||
BDDAssertions.then(new HttpMethods().GET().getMethodName())
|
||||
.isEqualTo(HttpMethods.GET);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void HEAD() {
|
||||
BDDAssertions.then(HttpMethods.HEAD).isEqualTo("HEAD");
|
||||
BDDAssertions.then(new HttpMethods().HEAD().getMethodName())
|
||||
.isEqualTo(HttpMethods.HEAD);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void POST() {
|
||||
BDDAssertions.then(HttpMethods.POST).isEqualTo("POST");
|
||||
BDDAssertions.then(new HttpMethods().POST().getMethodName())
|
||||
.isEqualTo(HttpMethods.POST);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void PUT() {
|
||||
BDDAssertions.then(HttpMethods.PUT).isEqualTo("PUT");
|
||||
BDDAssertions.then(new HttpMethods().PUT().getMethodName())
|
||||
.isEqualTo(HttpMethods.PUT);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void PATCH() {
|
||||
BDDAssertions.then(HttpMethods.PATCH).isEqualTo("PATCH");
|
||||
BDDAssertions.then(new HttpMethods().PATCH().getMethodName())
|
||||
.isEqualTo(HttpMethods.PATCH);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void DELETE() {
|
||||
BDDAssertions.then(HttpMethods.DELETE).isEqualTo("DELETE");
|
||||
BDDAssertions.then(new HttpMethods().DELETE().getMethodName())
|
||||
.isEqualTo(HttpMethods.DELETE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void OPTIONS() {
|
||||
BDDAssertions.then(HttpMethods.OPTIONS).isEqualTo("OPTIONS");
|
||||
BDDAssertions.then(new HttpMethods().OPTIONS().getMethodName())
|
||||
.isEqualTo(HttpMethods.OPTIONS);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void TRACE() {
|
||||
BDDAssertions.then(HttpMethods.TRACE).isEqualTo("TRACE");
|
||||
BDDAssertions.then(new HttpMethods().TRACE().getMethodName())
|
||||
.isEqualTo(HttpMethods.TRACE);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
/*
|
||||
* Copyright 2013-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cloud.contract.spec.internal;
|
||||
|
||||
import org.assertj.core.api.BDDAssertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* @author Tim Ysewyn
|
||||
*/
|
||||
public class MediaTypesTests {
|
||||
|
||||
@Test
|
||||
public void ALL_VALUE() {
|
||||
BDDAssertions.then(MediaTypes.ALL_VALUE).isEqualTo("*/*");
|
||||
BDDAssertions.then(new MediaTypes().allValue()).isEqualTo(MediaTypes.ALL_VALUE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void APPLICATION_ATOM_XML() {
|
||||
BDDAssertions.then(MediaTypes.APPLICATION_ATOM_XML)
|
||||
.isEqualTo("application/atom+xml");
|
||||
BDDAssertions.then(new MediaTypes().applicationAtomXml())
|
||||
.isEqualTo(MediaTypes.APPLICATION_ATOM_XML);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void APPLICATION_FORM_URLENCODED() {
|
||||
BDDAssertions.then(MediaTypes.APPLICATION_FORM_URLENCODED)
|
||||
.isEqualTo("application/x-www-form-urlencoded");
|
||||
BDDAssertions.then(new MediaTypes().applicationFormUrlencoded())
|
||||
.isEqualTo(MediaTypes.APPLICATION_FORM_URLENCODED);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void APPLICATION_JSON() {
|
||||
BDDAssertions.then(MediaTypes.APPLICATION_JSON).isEqualTo("application/json");
|
||||
BDDAssertions.then(new MediaTypes().applicationJson())
|
||||
.isEqualTo(MediaTypes.APPLICATION_JSON);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void APPLICATION_JSON_UTF8() {
|
||||
BDDAssertions.then(MediaTypes.APPLICATION_JSON_UTF8)
|
||||
.isEqualTo("application/json;charset=UTF-8");
|
||||
BDDAssertions.then(new MediaTypes().applicationJsonUtf8())
|
||||
.isEqualTo(MediaTypes.APPLICATION_JSON_UTF8);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void APPLICATION_OCTET_STREAM() {
|
||||
BDDAssertions.then(MediaTypes.APPLICATION_OCTET_STREAM)
|
||||
.isEqualTo("application/octet-stream");
|
||||
BDDAssertions.then(new MediaTypes().applicationOctetStream())
|
||||
.isEqualTo(MediaTypes.APPLICATION_OCTET_STREAM);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void APPLICATION_PDF() {
|
||||
BDDAssertions.then(MediaTypes.APPLICATION_PDF).isEqualTo("application/pdf");
|
||||
BDDAssertions.then(new MediaTypes().applicationPdf())
|
||||
.isEqualTo(MediaTypes.APPLICATION_PDF);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void APPLICATION_XHTML_XML() {
|
||||
BDDAssertions.then(MediaTypes.APPLICATION_XHTML_XML)
|
||||
.isEqualTo("application/xhtml+xml");
|
||||
BDDAssertions.then(new MediaTypes().applicationXhtmlXml())
|
||||
.isEqualTo(MediaTypes.APPLICATION_XHTML_XML);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void APPLICATION_XML() {
|
||||
BDDAssertions.then(MediaTypes.APPLICATION_XML).isEqualTo("application/xml");
|
||||
BDDAssertions.then(new MediaTypes().applicationXml())
|
||||
.isEqualTo(MediaTypes.APPLICATION_XML);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void IMAGE_GIF() {
|
||||
BDDAssertions.then(MediaTypes.IMAGE_GIF).isEqualTo("image/gif");
|
||||
BDDAssertions.then(new MediaTypes().imageGif()).isEqualTo(MediaTypes.IMAGE_GIF);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void IMAGE_JPEG() {
|
||||
BDDAssertions.then(MediaTypes.IMAGE_JPEG).isEqualTo("image/jpeg");
|
||||
BDDAssertions.then(new MediaTypes().imageJpeg()).isEqualTo(MediaTypes.IMAGE_JPEG);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void IMAGE_PNG() {
|
||||
BDDAssertions.then(MediaTypes.IMAGE_PNG).isEqualTo("image/png");
|
||||
BDDAssertions.then(new MediaTypes().imagePng()).isEqualTo(MediaTypes.IMAGE_PNG);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void MULTIPART_FORM_DATA() {
|
||||
BDDAssertions.then(MediaTypes.MULTIPART_FORM_DATA)
|
||||
.isEqualTo("multipart/form-data");
|
||||
BDDAssertions.then(new MediaTypes().multipartFormData())
|
||||
.isEqualTo(MediaTypes.MULTIPART_FORM_DATA);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void TEXT_HTML() {
|
||||
BDDAssertions.then(MediaTypes.TEXT_HTML).isEqualTo("text/html");
|
||||
BDDAssertions.then(new MediaTypes().textHtml()).isEqualTo(MediaTypes.TEXT_HTML);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void TEXT_MARKDOWN() {
|
||||
BDDAssertions.then(MediaTypes.TEXT_MARKDOWN).isEqualTo("text/markdown");
|
||||
BDDAssertions.then(new MediaTypes().textMarkdown())
|
||||
.isEqualTo(MediaTypes.TEXT_MARKDOWN);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void TEXT_PLAIN() {
|
||||
BDDAssertions.then(MediaTypes.TEXT_PLAIN).isEqualTo("text/plain");
|
||||
BDDAssertions.then(new MediaTypes().textPlain()).isEqualTo(MediaTypes.TEXT_PLAIN);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void TEXT_XML() {
|
||||
BDDAssertions.then(MediaTypes.TEXT_XML).isEqualTo("text/xml");
|
||||
BDDAssertions.then(new MediaTypes().textXml()).isEqualTo(MediaTypes.TEXT_XML);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright 2013-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cloud.contract.spec.internal;
|
||||
|
||||
import org.assertj.core.api.BDDAssertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* @author Tim Ysewyn
|
||||
*/
|
||||
class MessagingHeadersTests {
|
||||
|
||||
@Test
|
||||
public void MESSAGING_CONTENT_TYPE() {
|
||||
BDDAssertions.then(MessagingHeaders.MESSAGING_CONTENT_TYPE)
|
||||
.isEqualTo("contentType");
|
||||
BDDAssertions.then(new MessagingHeaders().messagingContentType())
|
||||
.isEqualTo(MessagingHeaders.MESSAGING_CONTENT_TYPE);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user