Removed unwanted changed
This commit is contained in:
@@ -36,6 +36,8 @@ public class BodyMatchers {
|
||||
|
||||
protected final List<BodyMatcher> matchers = new LinkedList<>();
|
||||
|
||||
private final RegexPatterns regexPatterns = new RegexPatterns();
|
||||
|
||||
public void jsonPath(String path, MatchingTypeValue matchingType) {
|
||||
this.matchers.add(new PathBodyMatcher(path, matchingType));
|
||||
}
|
||||
@@ -69,15 +71,16 @@ public class BodyMatchers {
|
||||
}
|
||||
|
||||
public MatchingTypeValue byDate() {
|
||||
return new MatchingTypeValue(MatchingType.DATE, RegexPatterns.isoDate());
|
||||
return new MatchingTypeValue(MatchingType.DATE, this.regexPatterns.isoDate());
|
||||
}
|
||||
|
||||
public MatchingTypeValue byTime() {
|
||||
return new MatchingTypeValue(MatchingType.TIME, RegexPatterns.isoTime());
|
||||
return new MatchingTypeValue(MatchingType.TIME, this.regexPatterns.isoTime());
|
||||
}
|
||||
|
||||
public MatchingTypeValue byTimestamp() {
|
||||
return new MatchingTypeValue(MatchingType.TIMESTAMP, RegexPatterns.isoDateTime());
|
||||
return new MatchingTypeValue(MatchingType.TIMESTAMP,
|
||||
this.regexPatterns.isoDateTime());
|
||||
}
|
||||
|
||||
public RegexMatchingTypeValue byRegex(String regex) {
|
||||
|
||||
@@ -32,12 +32,12 @@ import java.util.stream.Collectors;
|
||||
/**
|
||||
* Contains useful common methods for the DSL.
|
||||
*
|
||||
* @author Marcin Grzejszczak
|
||||
* @author Tim Ysewyn
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public class Common {
|
||||
|
||||
private final RegexPatterns regexPatterns = new RegexPatterns();
|
||||
|
||||
public Map<String, DslProperty> convertObjectsToDslProperties(
|
||||
Map<String, Object> body) {
|
||||
return body.entrySet().stream().collect(Collectors.toMap(
|
||||
@@ -324,79 +324,79 @@ public class Common {
|
||||
}
|
||||
|
||||
public RegexProperty onlyAlphaUnicode() {
|
||||
return RegexPatterns.onlyAlphaUnicode();
|
||||
return regexPatterns.onlyAlphaUnicode();
|
||||
}
|
||||
|
||||
public RegexProperty alphaNumeric() {
|
||||
return RegexPatterns.alphaNumeric();
|
||||
return regexPatterns.alphaNumeric();
|
||||
}
|
||||
|
||||
public RegexProperty number() {
|
||||
return RegexPatterns.number();
|
||||
return regexPatterns.number();
|
||||
}
|
||||
|
||||
public RegexProperty positiveInt() {
|
||||
return RegexPatterns.positiveInt();
|
||||
return regexPatterns.positiveInt();
|
||||
}
|
||||
|
||||
public RegexProperty anyBoolean() {
|
||||
return RegexPatterns.anyBoolean();
|
||||
return regexPatterns.anyBoolean();
|
||||
}
|
||||
|
||||
public RegexProperty anInteger() {
|
||||
return RegexPatterns.anInteger();
|
||||
return regexPatterns.anInteger();
|
||||
}
|
||||
|
||||
public RegexProperty aDouble() {
|
||||
return RegexPatterns.aDouble();
|
||||
return regexPatterns.aDouble();
|
||||
}
|
||||
|
||||
public RegexProperty ipAddress() {
|
||||
return RegexPatterns.ipAddress();
|
||||
return regexPatterns.ipAddress();
|
||||
}
|
||||
|
||||
public RegexProperty hostname() {
|
||||
return RegexPatterns.hostname();
|
||||
return regexPatterns.hostname();
|
||||
}
|
||||
|
||||
public RegexProperty email() {
|
||||
return RegexPatterns.email();
|
||||
return regexPatterns.email();
|
||||
}
|
||||
|
||||
public RegexProperty url() {
|
||||
return RegexPatterns.url();
|
||||
return regexPatterns.url();
|
||||
}
|
||||
|
||||
public RegexProperty httpsUrl() {
|
||||
return RegexPatterns.httpsUrl();
|
||||
return regexPatterns.httpsUrl();
|
||||
}
|
||||
|
||||
public RegexProperty uuid() {
|
||||
return RegexPatterns.uuid();
|
||||
return regexPatterns.uuid();
|
||||
}
|
||||
|
||||
public RegexProperty isoDate() {
|
||||
return RegexPatterns.isoDate();
|
||||
return regexPatterns.isoDate();
|
||||
}
|
||||
|
||||
public RegexProperty isoDateTime() {
|
||||
return RegexPatterns.isoDateTime();
|
||||
return regexPatterns.isoDateTime();
|
||||
}
|
||||
|
||||
public RegexProperty isoTime() {
|
||||
return RegexPatterns.isoTime();
|
||||
return regexPatterns.isoTime();
|
||||
}
|
||||
|
||||
public RegexProperty iso8601WithOffset() {
|
||||
return RegexPatterns.iso8601WithOffset();
|
||||
return regexPatterns.iso8601WithOffset();
|
||||
}
|
||||
|
||||
public RegexProperty nonEmpty() {
|
||||
return RegexPatterns.nonEmpty();
|
||||
return regexPatterns.nonEmpty();
|
||||
}
|
||||
|
||||
public RegexProperty nonBlank() {
|
||||
return RegexPatterns.nonBlank();
|
||||
return regexPatterns.nonBlank();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@ package org.springframework.cloud.contract.spec.internal;
|
||||
* Helper functions for HTTP statuses.
|
||||
*
|
||||
* @author Marcin Grzejszczak
|
||||
* @author Tim Ysewyn
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public class HttpStatus {
|
||||
@@ -30,7 +29,7 @@ public class HttpStatus {
|
||||
* @see <ahref="https://tools.ietf.org/html/rfc7231#section-6.2.1" > HTTP/1.1:
|
||||
* Semantics and Content, section 6.2.1</a>
|
||||
*/
|
||||
public static int CONTINUE() {
|
||||
public int CONTINUE() {
|
||||
return 100;
|
||||
}
|
||||
|
||||
@@ -39,7 +38,7 @@ public class HttpStatus {
|
||||
* @see <ahref="https://tools.ietf.org/html/rfc7231#section-6.2.2" > HTTP/1.1:
|
||||
* Semantics and Content, section 6.2.2</a>
|
||||
*/
|
||||
public static int SWITCHING_PROTOCOLS() {
|
||||
public int SWITCHING_PROTOCOLS() {
|
||||
return 101;
|
||||
}
|
||||
|
||||
@@ -47,7 +46,7 @@ public class HttpStatus {
|
||||
* {@code 102 Processing}.
|
||||
* @see <ahref="https://tools.ietf.org/html/rfc2518#section-10.1" > WebDAV</a>
|
||||
*/
|
||||
public static int PROCESSING() {
|
||||
public int PROCESSING() {
|
||||
return 102;
|
||||
}
|
||||
|
||||
@@ -56,7 +55,7 @@ public class HttpStatus {
|
||||
* @see <ahref="https://code.google.com/p/gears/wiki/ResumableHttpRequestsProposal" >
|
||||
* A proposal for supporting resumable POST/PUT HTTP requests in HTTP/1.0</a>
|
||||
*/
|
||||
public static int CHECKPOINT() {
|
||||
public int CHECKPOINT() {
|
||||
return 103;
|
||||
}
|
||||
|
||||
@@ -65,7 +64,7 @@ public class HttpStatus {
|
||||
* @see <ahref="https://tools.ietf.org/html/rfc7231#section-6.3.1" > HTTP/1.1:
|
||||
* Semantics and Content, section 6.3.1</a>
|
||||
*/
|
||||
public static int OK() {
|
||||
public int OK() {
|
||||
return 200;
|
||||
}
|
||||
|
||||
@@ -74,7 +73,7 @@ public class HttpStatus {
|
||||
* @see <ahref="https://tools.ietf.org/html/rfc7231#section-6.3.2" > HTTP/1.1:
|
||||
* Semantics and Content, section 6.3.2</a>
|
||||
*/
|
||||
public static int CREATED() {
|
||||
public int CREATED() {
|
||||
return 201;
|
||||
}
|
||||
|
||||
@@ -83,7 +82,7 @@ public class HttpStatus {
|
||||
* @see <ahref="https://tools.ietf.org/html/rfc7231#section-6.3.3" > HTTP/1.1:
|
||||
* Semantics and Content, section 6.3.3</a>
|
||||
*/
|
||||
public static int ACCEPTED() {
|
||||
public int ACCEPTED() {
|
||||
return 202;
|
||||
}
|
||||
|
||||
@@ -92,7 +91,7 @@ public class HttpStatus {
|
||||
* @see <ahref="https://tools.ietf.org/html/rfc7231#section-6.3.4" > HTTP/1.1:
|
||||
* Semantics and Content, section 6.3.4</a>
|
||||
*/
|
||||
public static int NON_AUTHORITATIVE_INFORMATION() {
|
||||
public int NON_AUTHORITATIVE_INFORMATION() {
|
||||
return 203;
|
||||
}
|
||||
|
||||
@@ -101,7 +100,7 @@ public class HttpStatus {
|
||||
* @see <ahref="https://tools.ietf.org/html/rfc7231#section-6.3.5" > HTTP/1.1:
|
||||
* Semantics and Content, section 6.3.5</a>
|
||||
*/
|
||||
public static int NO_CONTENT() {
|
||||
public int NO_CONTENT() {
|
||||
return 204;
|
||||
}
|
||||
|
||||
@@ -110,7 +109,7 @@ public class HttpStatus {
|
||||
* @see <ahref="https://tools.ietf.org/html/rfc7231#section-6.3.6" > HTTP/1.1:
|
||||
* Semantics and Content, section 6.3.6</a>
|
||||
*/
|
||||
public static int RESET_CONTENT() {
|
||||
public int RESET_CONTENT() {
|
||||
return 205;
|
||||
}
|
||||
|
||||
@@ -119,7 +118,7 @@ public class HttpStatus {
|
||||
* @see <ahref="https://tools.ietf.org/html/rfc7233#section-4.1" > HTTP/1.1: Range
|
||||
* Requests, section 4.1</a>
|
||||
*/
|
||||
public static int PARTIAL_CONTENT() {
|
||||
public int PARTIAL_CONTENT() {
|
||||
return 206;
|
||||
}
|
||||
|
||||
@@ -127,7 +126,7 @@ public class HttpStatus {
|
||||
* {@code 207 Multi-Status}.
|
||||
* @see <ahref="https://tools.ietf.org/html/rfc4918#section-13" > WebDAV</a>
|
||||
*/
|
||||
public static int MULTI_STATUS() {
|
||||
public int MULTI_STATUS() {
|
||||
return 207;
|
||||
}
|
||||
|
||||
@@ -136,7 +135,7 @@ public class HttpStatus {
|
||||
* @see <ahref="https://tools.ietf.org/html/rfc5842#section-7.1" > WebDAV Binding
|
||||
* Extensions</a>
|
||||
*/
|
||||
public static int ALREADY_REPORTED() {
|
||||
public int ALREADY_REPORTED() {
|
||||
return 208;
|
||||
}
|
||||
|
||||
@@ -145,7 +144,7 @@ public class HttpStatus {
|
||||
* @see <ahref="https://tools.ietf.org/html/rfc3229#section-10.4.1" > Delta encoding
|
||||
* in HTTP</a>
|
||||
*/
|
||||
public static int IM_USED() {
|
||||
public int IM_USED() {
|
||||
return 226;
|
||||
}
|
||||
|
||||
@@ -154,7 +153,7 @@ public class HttpStatus {
|
||||
* @see <ahref="https://tools.ietf.org/html/rfc7231#section-6.4.1" > HTTP/1.1:
|
||||
* Semantics and Content, section 6.4.1</a>
|
||||
*/
|
||||
public static int MULTIPLE_CHOICES() {
|
||||
public int MULTIPLE_CHOICES() {
|
||||
return 300;
|
||||
}
|
||||
|
||||
@@ -163,7 +162,7 @@ public class HttpStatus {
|
||||
* @see <ahref="https://tools.ietf.org/html/rfc7231#section-6.4.2" > HTTP/1.1:
|
||||
* Semantics and Content, section 6.4.2</a>
|
||||
*/
|
||||
public static int MOVED_PERMANENTLY() {
|
||||
public int MOVED_PERMANENTLY() {
|
||||
return 301;
|
||||
}
|
||||
|
||||
@@ -172,7 +171,7 @@ public class HttpStatus {
|
||||
* @see <ahref="https://tools.ietf.org/html/rfc7231#section-6.4.3" > HTTP/1.1:
|
||||
* Semantics and Content, section 6.4.3</a>
|
||||
*/
|
||||
public static int FOUND() {
|
||||
public int FOUND() {
|
||||
return 302;
|
||||
}
|
||||
|
||||
@@ -184,7 +183,7 @@ public class HttpStatus {
|
||||
* {@code HttpStatus.valueOf(302)}
|
||||
*/
|
||||
@Deprecated
|
||||
public static int MOVED_TEMPORARILY() {
|
||||
public int MOVED_TEMPORARILY() {
|
||||
return 302;
|
||||
}
|
||||
|
||||
@@ -193,7 +192,7 @@ public class HttpStatus {
|
||||
* @see <ahref="https://tools.ietf.org/html/rfc7231#section-6.4.4" > HTTP/1.1:
|
||||
* Semantics and Content, section 6.4.4</a>
|
||||
*/
|
||||
public static int SEE_OTHER() {
|
||||
public int SEE_OTHER() {
|
||||
return 303;
|
||||
}
|
||||
|
||||
@@ -202,7 +201,7 @@ public class HttpStatus {
|
||||
* @see <ahref="https://tools.ietf.org/html/rfc7232#section-4.1" > HTTP/1.1:
|
||||
* Conditional Requests, section 4.1</a>
|
||||
*/
|
||||
public static int NOT_MODIFIED() {
|
||||
public int NOT_MODIFIED() {
|
||||
return 304;
|
||||
}
|
||||
|
||||
@@ -213,7 +212,7 @@ public class HttpStatus {
|
||||
* @deprecated due to security concerns regarding in-band configuration of a proxy
|
||||
*/
|
||||
@Deprecated
|
||||
public static int USE_PROXY() {
|
||||
public int USE_PROXY() {
|
||||
return 305;
|
||||
}
|
||||
|
||||
@@ -222,7 +221,7 @@ public class HttpStatus {
|
||||
* @see <ahref="https://tools.ietf.org/html/rfc7231#section-6.4.7" > HTTP/1.1:
|
||||
* Semantics and Content, section 6.4.7</a>
|
||||
*/
|
||||
public static int TEMPORARY_REDIRECT() {
|
||||
public int TEMPORARY_REDIRECT() {
|
||||
return 307;
|
||||
}
|
||||
|
||||
@@ -230,7 +229,7 @@ public class HttpStatus {
|
||||
* {@code 308 Permanent Redirect}.
|
||||
* @see <ahref="https://tools.ietf.org/html/rfc7238" > RFC 7238</a>
|
||||
*/
|
||||
public static int PERMANENT_REDIRECT() {
|
||||
public int PERMANENT_REDIRECT() {
|
||||
return 308;
|
||||
}
|
||||
|
||||
@@ -239,7 +238,7 @@ public class HttpStatus {
|
||||
* @see <ahref="https://tools.ietf.org/html/rfc7231#section-6.5.1" > HTTP/1.1:
|
||||
* Semantics and Content, section 6.5.1</a>
|
||||
*/
|
||||
public static int BAD_REQUEST() {
|
||||
public int BAD_REQUEST() {
|
||||
return 400;
|
||||
}
|
||||
|
||||
@@ -248,7 +247,7 @@ public class HttpStatus {
|
||||
* @see <ahref="https://tools.ietf.org/html/rfc7235#section-3.1" > HTTP/1.1:
|
||||
* Authentication, section 3.1</a>
|
||||
*/
|
||||
public static int UNAUTHORIZED() {
|
||||
public int UNAUTHORIZED() {
|
||||
return 401;
|
||||
}
|
||||
|
||||
@@ -257,7 +256,7 @@ public class HttpStatus {
|
||||
* @see <ahref="https://tools.ietf.org/html/rfc7231#section-6.5.2" > HTTP/1.1:
|
||||
* Semantics and Content, section 6.5.2</a>
|
||||
*/
|
||||
public static int PAYMENT_REQUIRED() {
|
||||
public int PAYMENT_REQUIRED() {
|
||||
return 402;
|
||||
}
|
||||
|
||||
@@ -266,7 +265,7 @@ public class HttpStatus {
|
||||
* @see <ahref="https://tools.ietf.org/html/rfc7231#section-6.5.3" > HTTP/1.1:
|
||||
* Semantics and Content, section 6.5.3</a>
|
||||
*/
|
||||
public static int FORBIDDEN() {
|
||||
public int FORBIDDEN() {
|
||||
return 403;
|
||||
}
|
||||
|
||||
@@ -275,7 +274,7 @@ public class HttpStatus {
|
||||
* @see <ahref="https://tools.ietf.org/html/rfc7231#section-6.5.4" > HTTP/1.1:
|
||||
* Semantics and Content, section 6.5.4</a>
|
||||
*/
|
||||
public static int NOT_FOUND() {
|
||||
public int NOT_FOUND() {
|
||||
return 404;
|
||||
}
|
||||
|
||||
@@ -284,7 +283,7 @@ public class HttpStatus {
|
||||
* @see <ahref="https://tools.ietf.org/html/rfc7231#section-6.5.5" > HTTP/1.1:
|
||||
* Semantics and Content, section 6.5.5</a>
|
||||
*/
|
||||
public static int METHOD_NOT_ALLOWED() {
|
||||
public int METHOD_NOT_ALLOWED() {
|
||||
return 405;
|
||||
}
|
||||
|
||||
@@ -293,7 +292,7 @@ public class HttpStatus {
|
||||
* @see <ahref="https://tools.ietf.org/html/rfc7231#section-6.5.6" > HTTP/1.1:
|
||||
* Semantics and Content, section 6.5.6</a>
|
||||
*/
|
||||
public static int NOT_ACCEPTABLE() {
|
||||
public int NOT_ACCEPTABLE() {
|
||||
return 406;
|
||||
}
|
||||
|
||||
@@ -302,7 +301,7 @@ public class HttpStatus {
|
||||
* @see <ahref="https://tools.ietf.org/html/rfc7235#section-3.2" > HTTP/1.1:
|
||||
* Authentication, section 3.2</a>
|
||||
*/
|
||||
public static int PROXY_AUTHENTICATION_REQUIRED() {
|
||||
public int PROXY_AUTHENTICATION_REQUIRED() {
|
||||
return 407;
|
||||
}
|
||||
|
||||
@@ -311,7 +310,7 @@ public class HttpStatus {
|
||||
* @see <ahref="https://tools.ietf.org/html/rfc7231#section-6.5.7" > HTTP/1.1:
|
||||
* Semantics and Content, section 6.5.7</a>
|
||||
*/
|
||||
public static int REQUEST_TIMEOUT() {
|
||||
public int REQUEST_TIMEOUT() {
|
||||
return 408;
|
||||
}
|
||||
|
||||
@@ -320,7 +319,7 @@ public class HttpStatus {
|
||||
* @see <ahref="https://tools.ietf.org/html/rfc7231#section-6.5.8" > HTTP/1.1:
|
||||
* Semantics and Content, section 6.5.8</a>
|
||||
*/
|
||||
public static int CONFLICT() {
|
||||
public int CONFLICT() {
|
||||
return 409;
|
||||
}
|
||||
|
||||
@@ -329,7 +328,7 @@ public class HttpStatus {
|
||||
* @see <ahref="https://tools.ietf.org/html/rfc7231#section-6.5.9" > HTTP/1.1:
|
||||
* Semantics and Content, section 6.5.9</a>
|
||||
*/
|
||||
public static int GONE() {
|
||||
public int GONE() {
|
||||
return 410;
|
||||
}
|
||||
|
||||
@@ -338,7 +337,7 @@ public class HttpStatus {
|
||||
* @see <ahref="https://tools.ietf.org/html/rfc7231#section-6.5.10" > HTTP/1.1:
|
||||
* Semantics and Content, section 6.5.10</a>
|
||||
*/
|
||||
public static int LENGTH_REQUIRED() {
|
||||
public int LENGTH_REQUIRED() {
|
||||
return 411;
|
||||
}
|
||||
|
||||
@@ -347,7 +346,7 @@ public class HttpStatus {
|
||||
* @see <ahref="https://tools.ietf.org/html/rfc7232#section-4.2" > HTTP/1.1:
|
||||
* Conditional Requests, section 4.2</a>
|
||||
*/
|
||||
public static int PRECONDITION_FAILED() {
|
||||
public int PRECONDITION_FAILED() {
|
||||
return 412;
|
||||
}
|
||||
|
||||
@@ -356,7 +355,7 @@ public class HttpStatus {
|
||||
* @since 4.1* @see <ahref="https://tools.ietf.org/html/rfc7231#section-6.5.11" >
|
||||
* HTTP/1.1: Semantics and Content, section 6.5.11</a>
|
||||
*/
|
||||
public static int PAYLOAD_TOO_LARGE() {
|
||||
public int PAYLOAD_TOO_LARGE() {
|
||||
return 413;
|
||||
}
|
||||
|
||||
@@ -368,7 +367,7 @@ public class HttpStatus {
|
||||
* {@code HttpStatus.valueOf(413)}
|
||||
*/
|
||||
@Deprecated
|
||||
public static int REQUEST_ENTITY_TOO_LARGE() {
|
||||
public int REQUEST_ENTITY_TOO_LARGE() {
|
||||
return 413;
|
||||
}
|
||||
|
||||
@@ -377,7 +376,7 @@ public class HttpStatus {
|
||||
* @since 4.1* @see <ahref="https://tools.ietf.org/html/rfc7231#section-6.5.12" >
|
||||
* HTTP/1.1: Semantics and Content, section 6.5.12</a>
|
||||
*/
|
||||
public static int URI_TOO_LONG() {
|
||||
public int URI_TOO_LONG() {
|
||||
return 414;
|
||||
}
|
||||
|
||||
@@ -389,7 +388,7 @@ public class HttpStatus {
|
||||
* {@code HttpStatus.valueOf(414)}
|
||||
*/
|
||||
@Deprecated
|
||||
public static int REQUEST_URI_TOO_LONG() {
|
||||
public int REQUEST_URI_TOO_LONG() {
|
||||
return 414;
|
||||
}
|
||||
|
||||
@@ -398,7 +397,7 @@ public class HttpStatus {
|
||||
* @see <ahref="https://tools.ietf.org/html/rfc7231#section-6.5.13" > HTTP/1.1:
|
||||
* Semantics and Content, section 6.5.13</a>
|
||||
*/
|
||||
public static int UNSUPPORTED_MEDIA_TYPE() {
|
||||
public int UNSUPPORTED_MEDIA_TYPE() {
|
||||
return 415;
|
||||
}
|
||||
|
||||
@@ -407,7 +406,7 @@ public class HttpStatus {
|
||||
* @see <ahref="https://tools.ietf.org/html/rfc7233#section-4.4" > HTTP/1.1: Range
|
||||
* Requests, section 4.4</a>
|
||||
*/
|
||||
public static int REQUESTED_RANGE_NOT_SATISFIABLE() {
|
||||
public int REQUESTED_RANGE_NOT_SATISFIABLE() {
|
||||
return 416;
|
||||
}
|
||||
|
||||
@@ -416,7 +415,7 @@ public class HttpStatus {
|
||||
* @see <ahref="https://tools.ietf.org/html/rfc7231#section-6.5.14" > HTTP/1.1:
|
||||
* Semantics and Content, section 6.5.14</a>
|
||||
*/
|
||||
public static int EXPECTATION_FAILED() {
|
||||
public int EXPECTATION_FAILED() {
|
||||
return 417;
|
||||
}
|
||||
|
||||
@@ -424,7 +423,7 @@ public class HttpStatus {
|
||||
* {@code 418 I'm a teapot}.
|
||||
* @see <ahref="https://tools.ietf.org/html/rfc2324#section-2.3.2" > HTCPCP/1.0</a>
|
||||
*/
|
||||
public static int I_AM_A_TEAPOT() {
|
||||
public int I_AM_A_TEAPOT() {
|
||||
return 418;
|
||||
}
|
||||
|
||||
@@ -434,7 +433,7 @@ public class HttpStatus {
|
||||
* Draft Changes</a>
|
||||
*/
|
||||
@Deprecated
|
||||
public static int INSUFFICIENT_SPACE_ON_RESOURCE() {
|
||||
public int INSUFFICIENT_SPACE_ON_RESOURCE() {
|
||||
return 419;
|
||||
}
|
||||
|
||||
@@ -444,7 +443,7 @@ public class HttpStatus {
|
||||
* Draft Changes</a>
|
||||
*/
|
||||
@Deprecated
|
||||
public static int METHOD_FAILURE() {
|
||||
public int METHOD_FAILURE() {
|
||||
return 420;
|
||||
}
|
||||
|
||||
@@ -454,7 +453,7 @@ public class HttpStatus {
|
||||
* Draft Changes</a>
|
||||
*/
|
||||
@Deprecated
|
||||
public static int DESTINATION_LOCKED() {
|
||||
public int DESTINATION_LOCKED() {
|
||||
return 421;
|
||||
}
|
||||
|
||||
@@ -462,7 +461,7 @@ public class HttpStatus {
|
||||
* {@code 422 Unprocessable Entity}.
|
||||
* @see <ahref="https://tools.ietf.org/html/rfc4918#section-11.2" > WebDAV</a>
|
||||
*/
|
||||
public static int UNPROCESSABLE_ENTITY() {
|
||||
public int UNPROCESSABLE_ENTITY() {
|
||||
return 422;
|
||||
}
|
||||
|
||||
@@ -470,7 +469,7 @@ public class HttpStatus {
|
||||
* {@code 423 Locked}.
|
||||
* @see <ahref="https://tools.ietf.org/html/rfc4918#section-11.3" > WebDAV</a>
|
||||
*/
|
||||
public static int LOCKED() {
|
||||
public int LOCKED() {
|
||||
return 423;
|
||||
}
|
||||
|
||||
@@ -478,7 +477,7 @@ public class HttpStatus {
|
||||
* {@code 424 Failed Dependency}.
|
||||
* @see <ahref="https://tools.ietf.org/html/rfc4918#section-11.4" > WebDAV</a>
|
||||
*/
|
||||
public static int FAILED_DEPENDENCY() {
|
||||
public int FAILED_DEPENDENCY() {
|
||||
return 424;
|
||||
}
|
||||
|
||||
@@ -487,7 +486,7 @@ public class HttpStatus {
|
||||
* @see <ahref="https://tools.ietf.org/html/rfc2817#section-6" > Upgrading to TLS
|
||||
* Within HTTP/1.1</a>
|
||||
*/
|
||||
public static int UPGRADE_REQUIRED() {
|
||||
public int UPGRADE_REQUIRED() {
|
||||
return 426;
|
||||
}
|
||||
|
||||
@@ -496,7 +495,7 @@ public class HttpStatus {
|
||||
* @see <ahref="https://tools.ietf.org/html/rfc6585#section-3" > Additional HTTP
|
||||
* Status Codes</a>
|
||||
*/
|
||||
public static int PRECONDITION_REQUIRED() {
|
||||
public int PRECONDITION_REQUIRED() {
|
||||
return 428;
|
||||
}
|
||||
|
||||
@@ -505,7 +504,7 @@ public class HttpStatus {
|
||||
* @see <ahref="https://tools.ietf.org/html/rfc6585#section-4" > Additional HTTP
|
||||
* Status Codes</a>
|
||||
*/
|
||||
public static int TOO_MANY_REQUESTS() {
|
||||
public int TOO_MANY_REQUESTS() {
|
||||
return 429;
|
||||
}
|
||||
|
||||
@@ -514,7 +513,7 @@ public class HttpStatus {
|
||||
* @see <ahref="https://tools.ietf.org/html/rfc6585#section-5" > Additional HTTP
|
||||
* Status Codes</a>
|
||||
*/
|
||||
public static int REQUEST_HEADER_FIELDS_TOO_LARGE() {
|
||||
public int REQUEST_HEADER_FIELDS_TOO_LARGE() {
|
||||
return 431;
|
||||
}
|
||||
|
||||
@@ -524,7 +523,7 @@ public class HttpStatus {
|
||||
* > An HTTP Status Code to Report Legal Obstacles</a>
|
||||
* @since 4.3
|
||||
*/
|
||||
public static int UNAVAILABLE_FOR_LEGAL_REASONS() {
|
||||
public int UNAVAILABLE_FOR_LEGAL_REASONS() {
|
||||
return 451;
|
||||
}
|
||||
|
||||
@@ -533,7 +532,7 @@ public class HttpStatus {
|
||||
* @see <ahref="https://tools.ietf.org/html/rfc7231#section-6.6.1" > HTTP/1.1:
|
||||
* Semantics and Content, section 6.6.1</a>
|
||||
*/
|
||||
public static int INTERNAL_SERVER_ERROR() {
|
||||
public int INTERNAL_SERVER_ERROR() {
|
||||
return 500;
|
||||
}
|
||||
|
||||
@@ -542,7 +541,7 @@ public class HttpStatus {
|
||||
* @see <ahref="https://tools.ietf.org/html/rfc7231#section-6.6.2" > HTTP/1.1:
|
||||
* Semantics and Content, section 6.6.2</a>
|
||||
*/
|
||||
public static int NOT_IMPLEMENTED() {
|
||||
public int NOT_IMPLEMENTED() {
|
||||
return 501;
|
||||
}
|
||||
|
||||
@@ -551,7 +550,7 @@ public class HttpStatus {
|
||||
* @see <ahref="https://tools.ietf.org/html/rfc7231#section-6.6.3" > HTTP/1.1:
|
||||
* Semantics and Content, section 6.6.3</a>
|
||||
*/
|
||||
public static int BAD_GATEWAY() {
|
||||
public int BAD_GATEWAY() {
|
||||
return 502;
|
||||
}
|
||||
|
||||
@@ -560,7 +559,7 @@ public class HttpStatus {
|
||||
* @see <ahref="https://tools.ietf.org/html/rfc7231#section-6.6.4" > HTTP/1.1:
|
||||
* Semantics and Content, section 6.6.4</a>
|
||||
*/
|
||||
public static int SERVICE_UNAVAILABLE() {
|
||||
public int SERVICE_UNAVAILABLE() {
|
||||
return 503;
|
||||
}
|
||||
|
||||
@@ -569,7 +568,7 @@ public class HttpStatus {
|
||||
* @see <ahref="https://tools.ietf.org/html/rfc7231#section-6.6.5" > HTTP/1.1:
|
||||
* Semantics and Content, section 6.6.5</a>
|
||||
*/
|
||||
public static int GATEWAY_TIMEOUT() {
|
||||
public int GATEWAY_TIMEOUT() {
|
||||
return 504;
|
||||
}
|
||||
|
||||
@@ -578,7 +577,7 @@ public class HttpStatus {
|
||||
* @see <ahref="https://tools.ietf.org/html/rfc7231#section-6.6.6" > HTTP/1.1:
|
||||
* Semantics and Content, section 6.6.6</a>
|
||||
*/
|
||||
public static int HTTP_VERSION_NOT_SUPPORTED() {
|
||||
public int HTTP_VERSION_NOT_SUPPORTED() {
|
||||
return 505;
|
||||
}
|
||||
|
||||
@@ -587,7 +586,7 @@ public class HttpStatus {
|
||||
* @see <ahref="https://tools.ietf.org/html/rfc2295#section-8.1" > Transparent Content
|
||||
* Negotiation</a>
|
||||
*/
|
||||
public static int VARIANT_ALSO_NEGOTIATES() {
|
||||
public int VARIANT_ALSO_NEGOTIATES() {
|
||||
return 506;
|
||||
}
|
||||
|
||||
@@ -595,7 +594,7 @@ public class HttpStatus {
|
||||
* {@code 507 Insufficient Storage}
|
||||
* @see <ahref="https://tools.ietf.org/html/rfc4918#section-11.5" > WebDAV</a>
|
||||
*/
|
||||
public static int INSUFFICIENT_STORAGE() {
|
||||
public int INSUFFICIENT_STORAGE() {
|
||||
return 507;
|
||||
}
|
||||
|
||||
@@ -604,14 +603,14 @@ public class HttpStatus {
|
||||
* @see <ahref="https://tools.ietf.org/html/rfc5842#section-7.2" > WebDAV Binding
|
||||
* Extensions</a>
|
||||
*/
|
||||
public static int LOOP_DETECTED() {
|
||||
public int LOOP_DETECTED() {
|
||||
return 508;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@code 509 Bandwidth Limit Exceeded}
|
||||
*/
|
||||
public static int BANDWIDTH_LIMIT_EXCEEDED() {
|
||||
public int BANDWIDTH_LIMIT_EXCEEDED() {
|
||||
return 509;
|
||||
}
|
||||
|
||||
@@ -620,7 +619,7 @@ public class HttpStatus {
|
||||
* @see <ahref="https://tools.ietf.org/html/rfc2774#section-7" > HTTP Extension
|
||||
* Framework</a>
|
||||
*/
|
||||
public static int NOT_EXTENDED() {
|
||||
public int NOT_EXTENDED() {
|
||||
return 510;
|
||||
}
|
||||
|
||||
@@ -629,7 +628,7 @@ public class HttpStatus {
|
||||
* @see <ahref="https://tools.ietf.org/html/rfc6585#section-6" > Additional HTTP
|
||||
* Status Codes</a>
|
||||
*/
|
||||
public static int NETWORK_AUTHENTICATION_REQUIRED() {
|
||||
public int NETWORK_AUTHENTICATION_REQUIRED() {
|
||||
return 511;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,12 +27,9 @@ import java.util.stream.Collectors;
|
||||
* @author Tim Ysewyn
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public final class RegexPatterns {
|
||||
|
||||
private RegexPatterns() {
|
||||
// Shouldn't be instantiated
|
||||
}
|
||||
public class RegexPatterns {
|
||||
|
||||
// tag::regexps[]
|
||||
protected static final Pattern TRUE_OR_FALSE = Pattern.compile("(true|false)");
|
||||
|
||||
protected static final Pattern ALPHA_NUMERIC = Pattern.compile("[a-zA-Z0-9]+");
|
||||
@@ -111,84 +108,82 @@ public final class RegexPatterns {
|
||||
return contentType.toString();
|
||||
}
|
||||
|
||||
// tag::regexps[]
|
||||
|
||||
public static RegexProperty onlyAlphaUnicode() {
|
||||
public RegexProperty onlyAlphaUnicode() {
|
||||
return new RegexProperty(ONLY_ALPHA_UNICODE).asString();
|
||||
}
|
||||
|
||||
public static RegexProperty alphaNumeric() {
|
||||
public RegexProperty alphaNumeric() {
|
||||
return new RegexProperty(ALPHA_NUMERIC).asString();
|
||||
}
|
||||
|
||||
public static RegexProperty number() {
|
||||
public RegexProperty number() {
|
||||
return new RegexProperty(NUMBER).asDouble();
|
||||
}
|
||||
|
||||
public static RegexProperty positiveInt() {
|
||||
public RegexProperty positiveInt() {
|
||||
return new RegexProperty(POSITIVE_INT).asInteger();
|
||||
}
|
||||
|
||||
public static RegexProperty anyBoolean() {
|
||||
public RegexProperty anyBoolean() {
|
||||
return new RegexProperty(TRUE_OR_FALSE).asBooleanType();
|
||||
}
|
||||
|
||||
public static RegexProperty anInteger() {
|
||||
public RegexProperty anInteger() {
|
||||
return new RegexProperty(INTEGER).asInteger();
|
||||
}
|
||||
|
||||
public static RegexProperty aDouble() {
|
||||
public RegexProperty aDouble() {
|
||||
return new RegexProperty(DOUBLE).asDouble();
|
||||
}
|
||||
|
||||
public static RegexProperty ipAddress() {
|
||||
public RegexProperty ipAddress() {
|
||||
return new RegexProperty(IP_ADDRESS).asString();
|
||||
}
|
||||
|
||||
public static RegexProperty hostname() {
|
||||
public RegexProperty hostname() {
|
||||
return new RegexProperty(HOSTNAME_PATTERN).asString();
|
||||
}
|
||||
|
||||
public static RegexProperty email() {
|
||||
public RegexProperty email() {
|
||||
return new RegexProperty(EMAIL).asString();
|
||||
}
|
||||
|
||||
public static RegexProperty url() {
|
||||
public RegexProperty url() {
|
||||
return new RegexProperty(URL).asString();
|
||||
}
|
||||
|
||||
public static RegexProperty httpsUrl() {
|
||||
public RegexProperty httpsUrl() {
|
||||
return new RegexProperty(HTTPS_URL).asString();
|
||||
}
|
||||
|
||||
public static RegexProperty uuid() {
|
||||
public RegexProperty uuid() {
|
||||
return new RegexProperty(UUID).asString();
|
||||
}
|
||||
|
||||
public static RegexProperty isoDate() {
|
||||
public RegexProperty isoDate() {
|
||||
return new RegexProperty(ANY_DATE).asString();
|
||||
}
|
||||
|
||||
public static RegexProperty isoDateTime() {
|
||||
public RegexProperty isoDateTime() {
|
||||
return new RegexProperty(ANY_DATE_TIME).asString();
|
||||
}
|
||||
|
||||
public static RegexProperty isoTime() {
|
||||
public RegexProperty isoTime() {
|
||||
return new RegexProperty(ANY_TIME).asString();
|
||||
}
|
||||
|
||||
public static RegexProperty iso8601WithOffset() {
|
||||
return new RegexProperty(ISO8601_WITH_OFFSET).asString();
|
||||
}
|
||||
|
||||
public static RegexProperty nonEmpty() {
|
||||
return new RegexProperty(NON_EMPTY).asString();
|
||||
}
|
||||
|
||||
public static RegexProperty nonBlank() {
|
||||
return new RegexProperty(NON_BLANK).asString();
|
||||
}
|
||||
|
||||
// end::regexps[]
|
||||
|
||||
public RegexProperty iso8601WithOffset() {
|
||||
return new RegexProperty(ISO8601_WITH_OFFSET).asString();
|
||||
}
|
||||
|
||||
public RegexProperty nonEmpty() {
|
||||
return new RegexProperty(NON_EMPTY).asString();
|
||||
}
|
||||
|
||||
public RegexProperty nonBlank() {
|
||||
return new RegexProperty(NON_BLANK).asString();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -56,6 +56,8 @@ public class Response extends Common implements RegexCreatingProperty<ServerDslP
|
||||
|
||||
private ServerPatternValueDslProperty property = new ServerPatternValueDslProperty();
|
||||
|
||||
private HttpStatus httpStatus = new HttpStatus();
|
||||
|
||||
public Response() {
|
||||
}
|
||||
|
||||
@@ -249,6 +251,14 @@ public class Response extends Common implements RegexCreatingProperty<ServerDslP
|
||||
this.property = property;
|
||||
}
|
||||
|
||||
public HttpStatus getHttpStatus() {
|
||||
return httpStatus;
|
||||
}
|
||||
|
||||
public void setHttpStatus(HttpStatus httpStatus) {
|
||||
this.httpStatus = httpStatus;
|
||||
}
|
||||
|
||||
public DslProperty getStatus() {
|
||||
return status;
|
||||
}
|
||||
@@ -415,278 +425,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
|
||||
|
||||
@@ -4,9 +4,6 @@
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<properties>
|
||||
<!-- TODO: Bump-->
|
||||
<!-- <automaton.version>1.12-1</automaton.version>-->
|
||||
<automaton.version>1.11-8</automaton.version>
|
||||
<kotlin.version>1.3.41</kotlin.version>
|
||||
</properties>
|
||||
<parent>
|
||||
@@ -24,58 +21,11 @@
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-contract-spec-java</artifactId>
|
||||
</dependency>
|
||||
<!-- For backward compatibility since Gradle has problems with applying module extensions-->
|
||||
<dependency>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
<artifactId>groovy</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>dk.brics.automaton</groupId>
|
||||
<artifactId>automaton</artifactId>
|
||||
<version>${automaton.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-text</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-jcl</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
<artifactId>groovy-nio</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
<artifactId>groovy-json</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
<artifactId>groovy-xml</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.spockframework</groupId>
|
||||
<artifactId>spock-core</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>info.solidsoft.spock</groupId>
|
||||
<artifactId>spock-global-unroll</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>kotlin-stdlib-jdk8</artifactId>
|
||||
@@ -127,22 +77,6 @@
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.codehaus.gmavenplus</groupId>
|
||||
<artifactId>gmavenplus-plugin</artifactId>
|
||||
<!-- Joint compilation -->
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>addTestSources</goal>
|
||||
<goal>generateTestStubs</goal>
|
||||
<goal>compileTests</goal>
|
||||
<goal>removeTestStubs</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
|
||||
@@ -23,6 +23,9 @@ import java.util.regex.Pattern
|
||||
* @author Tim Ysewyn
|
||||
*/
|
||||
open class CommonDsl {
|
||||
|
||||
var httpStatus = HttpStatus()
|
||||
var regexPatterns = RegexPatterns()
|
||||
|
||||
/**
|
||||
* Helper method to provide a better name for the consumer side.
|
||||
@@ -100,125 +103,125 @@ open class CommonDsl {
|
||||
|
||||
/* HTTP STATUS CODES */
|
||||
|
||||
fun CONTINUE() = HttpStatus.CONTINUE()
|
||||
fun CONTINUE() = httpStatus.CONTINUE()
|
||||
|
||||
fun SWITCHING_PROTOCOLS() = HttpStatus.SWITCHING_PROTOCOLS()
|
||||
fun SWITCHING_PROTOCOLS() = httpStatus.SWITCHING_PROTOCOLS()
|
||||
|
||||
fun PROCESSING() = HttpStatus.PROCESSING()
|
||||
fun PROCESSING() = httpStatus.PROCESSING()
|
||||
|
||||
fun CHECKPOINT() = HttpStatus.CHECKPOINT()
|
||||
fun CHECKPOINT() = httpStatus.CHECKPOINT()
|
||||
|
||||
fun OK() = HttpStatus.OK()
|
||||
fun OK() = httpStatus.OK()
|
||||
|
||||
fun CREATED() = HttpStatus.CREATED()
|
||||
fun CREATED() = httpStatus.CREATED()
|
||||
|
||||
fun ACCEPTED() = HttpStatus.ACCEPTED()
|
||||
fun ACCEPTED() = httpStatus.ACCEPTED()
|
||||
|
||||
fun NON_AUTHORITATIVE_INFORMATION() = HttpStatus.NON_AUTHORITATIVE_INFORMATION()
|
||||
fun NON_AUTHORITATIVE_INFORMATION() = httpStatus.NON_AUTHORITATIVE_INFORMATION()
|
||||
|
||||
fun NO_CONTENT() = HttpStatus.NO_CONTENT()
|
||||
fun NO_CONTENT() = httpStatus.NO_CONTENT()
|
||||
|
||||
fun RESET_CONTENT() = HttpStatus.RESET_CONTENT()
|
||||
fun RESET_CONTENT() = httpStatus.RESET_CONTENT()
|
||||
|
||||
fun PARTIAL_CONTENT() = HttpStatus.PARTIAL_CONTENT()
|
||||
fun PARTIAL_CONTENT() = httpStatus.PARTIAL_CONTENT()
|
||||
|
||||
fun MULTI_STATUS() = HttpStatus.MULTI_STATUS()
|
||||
fun MULTI_STATUS() = httpStatus.MULTI_STATUS()
|
||||
|
||||
fun ALREADY_REPORTED() = HttpStatus.ALREADY_REPORTED()
|
||||
fun ALREADY_REPORTED() = httpStatus.ALREADY_REPORTED()
|
||||
|
||||
fun IM_USED() = HttpStatus.IM_USED()
|
||||
fun IM_USED() = httpStatus.IM_USED()
|
||||
|
||||
fun MULTIPLE_CHOICES() = HttpStatus.MULTIPLE_CHOICES()
|
||||
fun MULTIPLE_CHOICES() = httpStatus.MULTIPLE_CHOICES()
|
||||
|
||||
fun MOVED_PERMANENTLY() = HttpStatus.MOVED_PERMANENTLY()
|
||||
fun MOVED_PERMANENTLY() = httpStatus.MOVED_PERMANENTLY()
|
||||
|
||||
fun FOUND() = HttpStatus.FOUND()
|
||||
fun FOUND() = httpStatus.FOUND()
|
||||
|
||||
fun SEE_OTHER() = HttpStatus.SEE_OTHER()
|
||||
fun SEE_OTHER() = httpStatus.SEE_OTHER()
|
||||
|
||||
fun NOT_MODIFIED() = HttpStatus.NOT_MODIFIED()
|
||||
fun NOT_MODIFIED() = httpStatus.NOT_MODIFIED()
|
||||
|
||||
fun TEMPORARY_REDIRECT() = HttpStatus.TEMPORARY_REDIRECT()
|
||||
fun TEMPORARY_REDIRECT() = httpStatus.TEMPORARY_REDIRECT()
|
||||
|
||||
fun PERMANENT_REDIRECT() = HttpStatus.PERMANENT_REDIRECT()
|
||||
fun PERMANENT_REDIRECT() = httpStatus.PERMANENT_REDIRECT()
|
||||
|
||||
fun BAD_REQUEST() = HttpStatus.BAD_REQUEST()
|
||||
fun BAD_REQUEST() = httpStatus.BAD_REQUEST()
|
||||
|
||||
fun UNAUTHORIZED() = HttpStatus.UNAUTHORIZED()
|
||||
fun UNAUTHORIZED() = httpStatus.UNAUTHORIZED()
|
||||
|
||||
fun PAYMENT_REQUIRED() = HttpStatus.PAYMENT_REQUIRED()
|
||||
fun PAYMENT_REQUIRED() = httpStatus.PAYMENT_REQUIRED()
|
||||
|
||||
fun FORBIDDEN() = HttpStatus.FORBIDDEN()
|
||||
fun FORBIDDEN() = httpStatus.FORBIDDEN()
|
||||
|
||||
fun NOT_FOUND() = HttpStatus.NOT_FOUND()
|
||||
fun NOT_FOUND() = httpStatus.NOT_FOUND()
|
||||
|
||||
fun METHOD_NOT_ALLOWED() = HttpStatus.METHOD_NOT_ALLOWED()
|
||||
fun METHOD_NOT_ALLOWED() = httpStatus.METHOD_NOT_ALLOWED()
|
||||
|
||||
fun NOT_ACCEPTABLE() = HttpStatus.NOT_ACCEPTABLE()
|
||||
fun NOT_ACCEPTABLE() = httpStatus.NOT_ACCEPTABLE()
|
||||
|
||||
fun PROXY_AUTHENTICATION_REQUIRED() = HttpStatus.PROXY_AUTHENTICATION_REQUIRED()
|
||||
fun PROXY_AUTHENTICATION_REQUIRED() = httpStatus.PROXY_AUTHENTICATION_REQUIRED()
|
||||
|
||||
fun REQUEST_TIMEOUT() = HttpStatus.REQUEST_TIMEOUT()
|
||||
fun REQUEST_TIMEOUT() = httpStatus.REQUEST_TIMEOUT()
|
||||
|
||||
fun CONFLICT() = HttpStatus.CONFLICT()
|
||||
fun CONFLICT() = httpStatus.CONFLICT()
|
||||
|
||||
fun GONE() = HttpStatus.GONE()
|
||||
fun GONE() = httpStatus.GONE()
|
||||
|
||||
fun LENGTH_REQUIRED() = HttpStatus.LENGTH_REQUIRED()
|
||||
fun LENGTH_REQUIRED() = httpStatus.LENGTH_REQUIRED()
|
||||
|
||||
fun PRECONDITION_FAILED() = HttpStatus.PRECONDITION_FAILED()
|
||||
fun PRECONDITION_FAILED() = httpStatus.PRECONDITION_FAILED()
|
||||
|
||||
fun PAYLOAD_TOO_LARGE() = HttpStatus.PAYLOAD_TOO_LARGE()
|
||||
fun PAYLOAD_TOO_LARGE() = httpStatus.PAYLOAD_TOO_LARGE()
|
||||
|
||||
fun URI_TOO_LONG() = HttpStatus.URI_TOO_LONG()
|
||||
fun URI_TOO_LONG() = httpStatus.URI_TOO_LONG()
|
||||
|
||||
fun UNSUPPORTED_MEDIA_TYPE() = HttpStatus.UNSUPPORTED_MEDIA_TYPE()
|
||||
fun UNSUPPORTED_MEDIA_TYPE() = httpStatus.UNSUPPORTED_MEDIA_TYPE()
|
||||
|
||||
fun REQUESTED_RANGE_NOT_SATISFIABLE() = HttpStatus.REQUESTED_RANGE_NOT_SATISFIABLE()
|
||||
fun REQUESTED_RANGE_NOT_SATISFIABLE() = httpStatus.REQUESTED_RANGE_NOT_SATISFIABLE()
|
||||
|
||||
fun EXPECTATION_FAILED() = HttpStatus.EXPECTATION_FAILED()
|
||||
fun EXPECTATION_FAILED() = httpStatus.EXPECTATION_FAILED()
|
||||
|
||||
fun I_AM_A_TEAPOT() = HttpStatus.I_AM_A_TEAPOT()
|
||||
fun I_AM_A_TEAPOT() = httpStatus.I_AM_A_TEAPOT()
|
||||
|
||||
fun UNPROCESSABLE_ENTITY() = HttpStatus.UNPROCESSABLE_ENTITY()
|
||||
fun UNPROCESSABLE_ENTITY() = httpStatus.UNPROCESSABLE_ENTITY()
|
||||
|
||||
fun LOCKED() = HttpStatus.LOCKED()
|
||||
fun LOCKED() = httpStatus.LOCKED()
|
||||
|
||||
fun FAILED_DEPENDENCY() = HttpStatus.FAILED_DEPENDENCY()
|
||||
fun FAILED_DEPENDENCY() = httpStatus.FAILED_DEPENDENCY()
|
||||
|
||||
fun UPGRADE_REQUIRED() = HttpStatus.UPGRADE_REQUIRED()
|
||||
fun UPGRADE_REQUIRED() = httpStatus.UPGRADE_REQUIRED()
|
||||
|
||||
fun PRECONDITION_REQUIRED() = HttpStatus.PRECONDITION_REQUIRED()
|
||||
fun PRECONDITION_REQUIRED() = httpStatus.PRECONDITION_REQUIRED()
|
||||
|
||||
fun TOO_MANY_REQUESTS() = HttpStatus.TOO_MANY_REQUESTS()
|
||||
fun TOO_MANY_REQUESTS() = httpStatus.TOO_MANY_REQUESTS()
|
||||
|
||||
fun REQUEST_HEADER_FIELDS_TOO_LARGE() = HttpStatus.REQUEST_HEADER_FIELDS_TOO_LARGE()
|
||||
fun REQUEST_HEADER_FIELDS_TOO_LARGE() = httpStatus.REQUEST_HEADER_FIELDS_TOO_LARGE()
|
||||
|
||||
fun UNAVAILABLE_FOR_LEGAL_REASONS() = HttpStatus.UNAVAILABLE_FOR_LEGAL_REASONS()
|
||||
fun UNAVAILABLE_FOR_LEGAL_REASONS() = httpStatus.UNAVAILABLE_FOR_LEGAL_REASONS()
|
||||
|
||||
fun INTERNAL_SERVER_ERROR() = HttpStatus.INTERNAL_SERVER_ERROR()
|
||||
fun INTERNAL_SERVER_ERROR() = httpStatus.INTERNAL_SERVER_ERROR()
|
||||
|
||||
fun NOT_IMPLEMENTED() = HttpStatus.NOT_IMPLEMENTED()
|
||||
fun NOT_IMPLEMENTED() = httpStatus.NOT_IMPLEMENTED()
|
||||
|
||||
fun BAD_GATEWAY() = HttpStatus.BAD_GATEWAY()
|
||||
fun BAD_GATEWAY() = httpStatus.BAD_GATEWAY()
|
||||
|
||||
fun SERVICE_UNAVAILABLE() = HttpStatus.SERVICE_UNAVAILABLE()
|
||||
fun SERVICE_UNAVAILABLE() = httpStatus.SERVICE_UNAVAILABLE()
|
||||
|
||||
fun GATEWAY_TIMEOUT() = HttpStatus.GATEWAY_TIMEOUT()
|
||||
fun GATEWAY_TIMEOUT() = httpStatus.GATEWAY_TIMEOUT()
|
||||
|
||||
fun HTTP_VERSION_NOT_SUPPORTED() = HttpStatus.HTTP_VERSION_NOT_SUPPORTED()
|
||||
fun HTTP_VERSION_NOT_SUPPORTED() = httpStatus.HTTP_VERSION_NOT_SUPPORTED()
|
||||
|
||||
fun VARIANT_ALSO_NEGOTIATES() = HttpStatus.VARIANT_ALSO_NEGOTIATES()
|
||||
fun VARIANT_ALSO_NEGOTIATES() = httpStatus.VARIANT_ALSO_NEGOTIATES()
|
||||
|
||||
fun INSUFFICIENT_STORAGE() = HttpStatus.INSUFFICIENT_STORAGE()
|
||||
fun INSUFFICIENT_STORAGE() = httpStatus.INSUFFICIENT_STORAGE()
|
||||
|
||||
fun LOOP_DETECTED() = HttpStatus.LOOP_DETECTED()
|
||||
fun LOOP_DETECTED() = httpStatus.LOOP_DETECTED()
|
||||
|
||||
fun BANDWIDTH_LIMIT_EXCEEDED() = HttpStatus.BANDWIDTH_LIMIT_EXCEEDED()
|
||||
fun BANDWIDTH_LIMIT_EXCEEDED() = httpStatus.BANDWIDTH_LIMIT_EXCEEDED()
|
||||
|
||||
fun NOT_EXTENDED() = HttpStatus.NOT_EXTENDED()
|
||||
fun NOT_EXTENDED() = httpStatus.NOT_EXTENDED()
|
||||
|
||||
fun NETWORK_AUTHENTICATION_REQUIRED() = HttpStatus.NETWORK_AUTHENTICATION_REQUIRED()
|
||||
fun NETWORK_AUTHENTICATION_REQUIRED() = httpStatus.NETWORK_AUTHENTICATION_REQUIRED()
|
||||
|
||||
/* REGEX */
|
||||
|
||||
@@ -230,41 +233,41 @@ open class CommonDsl {
|
||||
|
||||
fun regex(regex: RegexProperty) = regex
|
||||
|
||||
fun onlyAlphaUnicode(): RegexProperty = RegexPatterns.onlyAlphaUnicode()
|
||||
fun onlyAlphaUnicode(): RegexProperty = regexPatterns.onlyAlphaUnicode()
|
||||
|
||||
fun alphaNumeric(): RegexProperty = RegexPatterns.alphaNumeric()
|
||||
fun alphaNumeric(): RegexProperty = regexPatterns.alphaNumeric()
|
||||
|
||||
fun number(): RegexProperty = RegexPatterns.number()
|
||||
fun number(): RegexProperty = regexPatterns.number()
|
||||
|
||||
fun positiveInt(): RegexProperty = RegexPatterns.positiveInt()
|
||||
fun positiveInt(): RegexProperty = regexPatterns.positiveInt()
|
||||
|
||||
fun anyBoolean(): RegexProperty = RegexPatterns.anyBoolean()
|
||||
fun anyBoolean(): RegexProperty = regexPatterns.anyBoolean()
|
||||
|
||||
fun anInteger(): RegexProperty = RegexPatterns.anInteger()
|
||||
fun anInteger(): RegexProperty = regexPatterns.anInteger()
|
||||
|
||||
fun aDouble(): RegexProperty = RegexPatterns.aDouble()
|
||||
fun aDouble(): RegexProperty = regexPatterns.aDouble()
|
||||
|
||||
fun ipAddress(): RegexProperty = RegexPatterns.ipAddress()
|
||||
fun ipAddress(): RegexProperty = regexPatterns.ipAddress()
|
||||
|
||||
fun hostname(): RegexProperty = RegexPatterns.hostname()
|
||||
fun hostname(): RegexProperty = regexPatterns.hostname()
|
||||
|
||||
fun email(): RegexProperty = RegexPatterns.email()
|
||||
fun email(): RegexProperty = regexPatterns.email()
|
||||
|
||||
fun url(): RegexProperty = RegexPatterns.url()
|
||||
fun url(): RegexProperty = regexPatterns.url()
|
||||
|
||||
fun httpsUrl(): RegexProperty = RegexPatterns.httpsUrl()
|
||||
fun httpsUrl(): RegexProperty = regexPatterns.httpsUrl()
|
||||
|
||||
fun uuid(): RegexProperty = RegexPatterns.uuid()
|
||||
fun uuid(): RegexProperty = regexPatterns.uuid()
|
||||
|
||||
fun isoDate(): RegexProperty = RegexPatterns.isoDate()
|
||||
fun isoDate(): RegexProperty = regexPatterns.isoDate()
|
||||
|
||||
fun isoDateTime(): RegexProperty = RegexPatterns.isoDateTime()
|
||||
fun isoDateTime(): RegexProperty = regexPatterns.isoDateTime()
|
||||
|
||||
fun isoTime(): RegexProperty = RegexPatterns.isoTime()
|
||||
fun isoTime(): RegexProperty = regexPatterns.isoTime()
|
||||
|
||||
fun iso8601WithOffset(): RegexProperty = RegexPatterns.iso8601WithOffset()
|
||||
fun iso8601WithOffset(): RegexProperty = regexPatterns.iso8601WithOffset()
|
||||
|
||||
fun nonEmpty(): RegexProperty = RegexPatterns.nonEmpty()
|
||||
fun nonEmpty(): RegexProperty = regexPatterns.nonEmpty()
|
||||
|
||||
fun nonBlank(): RegexProperty = RegexPatterns.nonBlank()
|
||||
fun nonBlank(): RegexProperty = regexPatterns.nonBlank()
|
||||
}
|
||||
@@ -21,343 +21,349 @@ import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author Marcin Grzejszczak
|
||||
* @author Tim Ysewyn
|
||||
*/
|
||||
public class HttpStatusTests {
|
||||
|
||||
@Test
|
||||
public void CONTINUE() {
|
||||
BDDAssertions.then(HttpStatus.CONTINUE()).isEqualTo(100);
|
||||
BDDAssertions.then(new HttpStatus().CONTINUE()).isEqualTo(100);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void SWITCHING_PROTOCOLS() {
|
||||
BDDAssertions.then(HttpStatus.SWITCHING_PROTOCOLS()).isEqualTo(101);
|
||||
BDDAssertions.then(new HttpStatus().SWITCHING_PROTOCOLS()).isEqualTo(101);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void PROCESSING() {
|
||||
BDDAssertions.then(HttpStatus.PROCESSING()).isEqualTo(102);
|
||||
BDDAssertions.then(new HttpStatus().PROCESSING()).isEqualTo(102);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void CHECKPOINT() {
|
||||
BDDAssertions.then(HttpStatus.CHECKPOINT()).isEqualTo(103);
|
||||
BDDAssertions.then(new HttpStatus().CHECKPOINT()).isEqualTo(103);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void OK() {
|
||||
BDDAssertions.then(HttpStatus.OK()).isEqualTo(200);
|
||||
BDDAssertions.then(new HttpStatus().OK()).isEqualTo(200);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void CREATED() {
|
||||
BDDAssertions.then(HttpStatus.CREATED()).isEqualTo(201);
|
||||
BDDAssertions.then(new HttpStatus().CREATED()).isEqualTo(201);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void ACCEPTED() {
|
||||
BDDAssertions.then(HttpStatus.ACCEPTED()).isEqualTo(202);
|
||||
BDDAssertions.then(new HttpStatus().ACCEPTED()).isEqualTo(202);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void NON_AUTHORITATIVE_INFORMATION() {
|
||||
BDDAssertions.then(HttpStatus.NON_AUTHORITATIVE_INFORMATION()).isEqualTo(203);
|
||||
BDDAssertions.then(new HttpStatus().NON_AUTHORITATIVE_INFORMATION())
|
||||
.isEqualTo(203);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void NO_CONTENT() {
|
||||
BDDAssertions.then(HttpStatus.NO_CONTENT()).isEqualTo(204);
|
||||
BDDAssertions.then(new HttpStatus().NO_CONTENT()).isEqualTo(204);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void RESET_CONTENT() {
|
||||
BDDAssertions.then(HttpStatus.RESET_CONTENT()).isEqualTo(205);
|
||||
BDDAssertions.then(new HttpStatus().RESET_CONTENT()).isEqualTo(205);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void PARTIAL_CONTENT() {
|
||||
BDDAssertions.then(HttpStatus.PARTIAL_CONTENT()).isEqualTo(206);
|
||||
BDDAssertions.then(new HttpStatus().PARTIAL_CONTENT()).isEqualTo(206);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void MULTI_STATUS() {
|
||||
BDDAssertions.then(HttpStatus.MULTI_STATUS()).isEqualTo(207);
|
||||
BDDAssertions.then(new HttpStatus().MULTI_STATUS()).isEqualTo(207);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void ALREADY_REPORTED() {
|
||||
BDDAssertions.then(HttpStatus.ALREADY_REPORTED()).isEqualTo(208);
|
||||
BDDAssertions.then(new HttpStatus().ALREADY_REPORTED()).isEqualTo(208);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void IM_USED() {
|
||||
BDDAssertions.then(HttpStatus.IM_USED()).isEqualTo(226);
|
||||
BDDAssertions.then(new HttpStatus().IM_USED()).isEqualTo(226);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void MULTIPLE_CHOICES() {
|
||||
BDDAssertions.then(HttpStatus.MULTIPLE_CHOICES()).isEqualTo(300);
|
||||
BDDAssertions.then(new HttpStatus().MULTIPLE_CHOICES()).isEqualTo(300);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void MOVED_PERMANENTLY() {
|
||||
BDDAssertions.then(HttpStatus.MOVED_PERMANENTLY()).isEqualTo(301);
|
||||
BDDAssertions.then(new HttpStatus().MOVED_PERMANENTLY()).isEqualTo(301);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void FOUND() {
|
||||
BDDAssertions.then(HttpStatus.FOUND()).isEqualTo(302);
|
||||
BDDAssertions.then(new HttpStatus().FOUND()).isEqualTo(302);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void MOVED_TEMPORARILY() {
|
||||
BDDAssertions.then(HttpStatus.MOVED_TEMPORARILY()).isEqualTo(302);
|
||||
BDDAssertions.then(new HttpStatus().MOVED_TEMPORARILY()).isEqualTo(302);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void SEE_OTHER() {
|
||||
BDDAssertions.then(HttpStatus.SEE_OTHER()).isEqualTo(303);
|
||||
BDDAssertions.then(new HttpStatus().SEE_OTHER()).isEqualTo(303);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void NOT_MODIFIED() {
|
||||
BDDAssertions.then(HttpStatus.NOT_MODIFIED()).isEqualTo(304);
|
||||
BDDAssertions.then(new HttpStatus().NOT_MODIFIED()).isEqualTo(304);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void USE_PROXY() {
|
||||
BDDAssertions.then(HttpStatus.USE_PROXY()).isEqualTo(305);
|
||||
BDDAssertions.then(new HttpStatus().USE_PROXY()).isEqualTo(305);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void TEMPORARY_REDIRECT() {
|
||||
BDDAssertions.then(HttpStatus.TEMPORARY_REDIRECT()).isEqualTo(307);
|
||||
BDDAssertions.then(new HttpStatus().TEMPORARY_REDIRECT()).isEqualTo(307);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void PERMANENT_REDIRECT() {
|
||||
BDDAssertions.then(HttpStatus.PERMANENT_REDIRECT()).isEqualTo(308);
|
||||
BDDAssertions.then(new HttpStatus().PERMANENT_REDIRECT()).isEqualTo(308);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void BAD_REQUEST() {
|
||||
BDDAssertions.then(HttpStatus.BAD_REQUEST()).isEqualTo(400);
|
||||
BDDAssertions.then(new HttpStatus().BAD_REQUEST()).isEqualTo(400);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void UNAUTHORIZED() {
|
||||
BDDAssertions.then(HttpStatus.UNAUTHORIZED()).isEqualTo(401);
|
||||
BDDAssertions.then(new HttpStatus().UNAUTHORIZED()).isEqualTo(401);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void PAYMENT_REQUIRED() {
|
||||
BDDAssertions.then(HttpStatus.PAYMENT_REQUIRED()).isEqualTo(402);
|
||||
BDDAssertions.then(new HttpStatus().PAYMENT_REQUIRED()).isEqualTo(402);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void FORBIDDEN() {
|
||||
BDDAssertions.then(HttpStatus.FORBIDDEN()).isEqualTo(403);
|
||||
BDDAssertions.then(new HttpStatus().FORBIDDEN()).isEqualTo(403);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void NOT_FOUND() {
|
||||
BDDAssertions.then(HttpStatus.NOT_FOUND()).isEqualTo(404);
|
||||
BDDAssertions.then(new HttpStatus().NOT_FOUND()).isEqualTo(404);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void METHOD_NOT_ALLOWED() {
|
||||
BDDAssertions.then(HttpStatus.METHOD_NOT_ALLOWED()).isEqualTo(405);
|
||||
BDDAssertions.then(new HttpStatus().METHOD_NOT_ALLOWED()).isEqualTo(405);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void NOT_ACCEPTABLE() {
|
||||
BDDAssertions.then(HttpStatus.NOT_ACCEPTABLE()).isEqualTo(406);
|
||||
BDDAssertions.then(new HttpStatus().NOT_ACCEPTABLE()).isEqualTo(406);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void PROXY_AUTHENTICATION_REQUIRED() {
|
||||
BDDAssertions.then(HttpStatus.PROXY_AUTHENTICATION_REQUIRED()).isEqualTo(407);
|
||||
BDDAssertions.then(new HttpStatus().PROXY_AUTHENTICATION_REQUIRED())
|
||||
.isEqualTo(407);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void REQUEST_TIMEOUT() {
|
||||
BDDAssertions.then(HttpStatus.REQUEST_TIMEOUT()).isEqualTo(408);
|
||||
BDDAssertions.then(new HttpStatus().REQUEST_TIMEOUT()).isEqualTo(408);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void CONFLICT() {
|
||||
BDDAssertions.then(HttpStatus.CONFLICT()).isEqualTo(409);
|
||||
BDDAssertions.then(new HttpStatus().CONFLICT()).isEqualTo(409);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void GONE() {
|
||||
BDDAssertions.then(HttpStatus.GONE()).isEqualTo(410);
|
||||
BDDAssertions.then(new HttpStatus().GONE()).isEqualTo(410);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void LENGTH_REQUIRED() {
|
||||
BDDAssertions.then(HttpStatus.LENGTH_REQUIRED()).isEqualTo(411);
|
||||
BDDAssertions.then(new HttpStatus().LENGTH_REQUIRED()).isEqualTo(411);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void PRECONDITION_FAILED() {
|
||||
BDDAssertions.then(HttpStatus.PRECONDITION_FAILED()).isEqualTo(412);
|
||||
BDDAssertions.then(new HttpStatus().PRECONDITION_FAILED()).isEqualTo(412);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void PAYLOAD_TOO_LARGE() {
|
||||
BDDAssertions.then(HttpStatus.PAYLOAD_TOO_LARGE()).isEqualTo(413);
|
||||
BDDAssertions.then(new HttpStatus().PAYLOAD_TOO_LARGE()).isEqualTo(413);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void REQUEST_ENTITY_TOO_LARGE() {
|
||||
BDDAssertions.then(HttpStatus.REQUEST_ENTITY_TOO_LARGE()).isEqualTo(413);
|
||||
BDDAssertions.then(new HttpStatus().REQUEST_ENTITY_TOO_LARGE()).isEqualTo(413);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void URI_TOO_LONG() {
|
||||
BDDAssertions.then(HttpStatus.URI_TOO_LONG()).isEqualTo(414);
|
||||
BDDAssertions.then(new HttpStatus().URI_TOO_LONG()).isEqualTo(414);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void REQUEST_URI_TOO_LONG() {
|
||||
BDDAssertions.then(HttpStatus.REQUEST_URI_TOO_LONG()).isEqualTo(414);
|
||||
BDDAssertions.then(new HttpStatus().REQUEST_URI_TOO_LONG()).isEqualTo(414);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void UNSUPPORTED_MEDIA_TYPE() {
|
||||
BDDAssertions.then(HttpStatus.UNSUPPORTED_MEDIA_TYPE()).isEqualTo(415);
|
||||
BDDAssertions.then(new HttpStatus().UNSUPPORTED_MEDIA_TYPE()).isEqualTo(415);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void REQUESTED_RANGE_NOT_SATISFIABLE() {
|
||||
BDDAssertions.then(HttpStatus.REQUESTED_RANGE_NOT_SATISFIABLE()).isEqualTo(416);
|
||||
BDDAssertions.then(new HttpStatus().REQUESTED_RANGE_NOT_SATISFIABLE())
|
||||
.isEqualTo(416);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void EXPECTATION_FAILED() {
|
||||
BDDAssertions.then(HttpStatus.EXPECTATION_FAILED()).isEqualTo(417);
|
||||
BDDAssertions.then(new HttpStatus().EXPECTATION_FAILED()).isEqualTo(417);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void I_AM_A_TEAPOT() {
|
||||
BDDAssertions.then(HttpStatus.I_AM_A_TEAPOT()).isEqualTo(418);
|
||||
BDDAssertions.then(new HttpStatus().I_AM_A_TEAPOT()).isEqualTo(418);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void INSUFFICIENT_SPACE_ON_RESOURCE() {
|
||||
BDDAssertions.then(HttpStatus.INSUFFICIENT_SPACE_ON_RESOURCE()).isEqualTo(419);
|
||||
BDDAssertions.then(new HttpStatus().INSUFFICIENT_SPACE_ON_RESOURCE())
|
||||
.isEqualTo(419);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void METHOD_FAILURE() {
|
||||
BDDAssertions.then(HttpStatus.METHOD_FAILURE()).isEqualTo(420);
|
||||
BDDAssertions.then(new HttpStatus().METHOD_FAILURE()).isEqualTo(420);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void DESTINATION_LOCKED() {
|
||||
BDDAssertions.then(HttpStatus.DESTINATION_LOCKED()).isEqualTo(421);
|
||||
BDDAssertions.then(new HttpStatus().DESTINATION_LOCKED()).isEqualTo(421);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void UNPROCESSABLE_ENTITY() {
|
||||
BDDAssertions.then(HttpStatus.UNPROCESSABLE_ENTITY()).isEqualTo(422);
|
||||
BDDAssertions.then(new HttpStatus().UNPROCESSABLE_ENTITY()).isEqualTo(422);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void LOCKED() {
|
||||
BDDAssertions.then(HttpStatus.LOCKED()).isEqualTo(423);
|
||||
BDDAssertions.then(new HttpStatus().LOCKED()).isEqualTo(423);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void FAILED_DEPENDENCY() {
|
||||
BDDAssertions.then(HttpStatus.FAILED_DEPENDENCY()).isEqualTo(424);
|
||||
BDDAssertions.then(new HttpStatus().FAILED_DEPENDENCY()).isEqualTo(424);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void UPGRADE_REQUIRED() {
|
||||
BDDAssertions.then(HttpStatus.UPGRADE_REQUIRED()).isEqualTo(426);
|
||||
BDDAssertions.then(new HttpStatus().UPGRADE_REQUIRED()).isEqualTo(426);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void PRECONDITION_REQUIRED() {
|
||||
BDDAssertions.then(HttpStatus.PRECONDITION_REQUIRED()).isEqualTo(428);
|
||||
BDDAssertions.then(new HttpStatus().PRECONDITION_REQUIRED()).isEqualTo(428);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void TOO_MANY_REQUESTS() {
|
||||
BDDAssertions.then(HttpStatus.TOO_MANY_REQUESTS()).isEqualTo(429);
|
||||
BDDAssertions.then(new HttpStatus().TOO_MANY_REQUESTS()).isEqualTo(429);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void REQUEST_HEADER_FIELDS_TOO_LARGE() {
|
||||
BDDAssertions.then(HttpStatus.REQUEST_HEADER_FIELDS_TOO_LARGE()).isEqualTo(431);
|
||||
BDDAssertions.then(new HttpStatus().REQUEST_HEADER_FIELDS_TOO_LARGE())
|
||||
.isEqualTo(431);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void UNAVAILABLE_FOR_LEGAL_REASONS() {
|
||||
BDDAssertions.then(HttpStatus.UNAVAILABLE_FOR_LEGAL_REASONS()).isEqualTo(451);
|
||||
BDDAssertions.then(new HttpStatus().UNAVAILABLE_FOR_LEGAL_REASONS())
|
||||
.isEqualTo(451);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void INTERNAL_SERVER_ERROR() {
|
||||
BDDAssertions.then(HttpStatus.INTERNAL_SERVER_ERROR()).isEqualTo(500);
|
||||
BDDAssertions.then(new HttpStatus().INTERNAL_SERVER_ERROR()).isEqualTo(500);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void NOT_IMPLEMENTED() {
|
||||
BDDAssertions.then(HttpStatus.NOT_IMPLEMENTED()).isEqualTo(501);
|
||||
BDDAssertions.then(new HttpStatus().NOT_IMPLEMENTED()).isEqualTo(501);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void BAD_GATEWAY() {
|
||||
BDDAssertions.then(HttpStatus.BAD_GATEWAY()).isEqualTo(502);
|
||||
BDDAssertions.then(new HttpStatus().BAD_GATEWAY()).isEqualTo(502);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void SERVICE_UNAVAILABLE() {
|
||||
BDDAssertions.then(HttpStatus.SERVICE_UNAVAILABLE()).isEqualTo(503);
|
||||
BDDAssertions.then(new HttpStatus().SERVICE_UNAVAILABLE()).isEqualTo(503);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void GATEWAY_TIMEOUT() {
|
||||
BDDAssertions.then(HttpStatus.GATEWAY_TIMEOUT()).isEqualTo(504);
|
||||
BDDAssertions.then(new HttpStatus().GATEWAY_TIMEOUT()).isEqualTo(504);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void HTTP_VERSION_NOT_SUPPORTED() {
|
||||
BDDAssertions.then(HttpStatus.HTTP_VERSION_NOT_SUPPORTED()).isEqualTo(505);
|
||||
BDDAssertions.then(new HttpStatus().HTTP_VERSION_NOT_SUPPORTED()).isEqualTo(505);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void VARIANT_ALSO_NEGOTIATES() {
|
||||
BDDAssertions.then(HttpStatus.VARIANT_ALSO_NEGOTIATES()).isEqualTo(506);
|
||||
BDDAssertions.then(new HttpStatus().VARIANT_ALSO_NEGOTIATES()).isEqualTo(506);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void INSUFFICIENT_STORAGE() {
|
||||
BDDAssertions.then(HttpStatus.INSUFFICIENT_STORAGE()).isEqualTo(507);
|
||||
BDDAssertions.then(new HttpStatus().INSUFFICIENT_STORAGE()).isEqualTo(507);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void LOOP_DETECTED() {
|
||||
BDDAssertions.then(HttpStatus.LOOP_DETECTED()).isEqualTo(508);
|
||||
BDDAssertions.then(new HttpStatus().LOOP_DETECTED()).isEqualTo(508);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void BANDWIDTH_LIMIT_EXCEEDED() {
|
||||
BDDAssertions.then(HttpStatus.BANDWIDTH_LIMIT_EXCEEDED()).isEqualTo(509);
|
||||
BDDAssertions.then(new HttpStatus().BANDWIDTH_LIMIT_EXCEEDED()).isEqualTo(509);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void NOT_EXTENDED() {
|
||||
BDDAssertions.then(HttpStatus.NOT_EXTENDED()).isEqualTo(510);
|
||||
BDDAssertions.then(new HttpStatus().NOT_EXTENDED()).isEqualTo(510);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void NETWORK_AUTHENTICATION_REQUIRED() {
|
||||
BDDAssertions.then(HttpStatus.NETWORK_AUTHENTICATION_REQUIRED()).isEqualTo(511);
|
||||
BDDAssertions.then(new HttpStatus().NETWORK_AUTHENTICATION_REQUIRED())
|
||||
.isEqualTo(511);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -20,9 +20,11 @@ import spock.lang.Specification
|
||||
|
||||
class RegexPatternsSpec extends Specification {
|
||||
|
||||
RegexPatterns regexPatterns = new RegexPatterns()
|
||||
|
||||
def "should generate a regex for ip address [#textToMatch] that is a match [#shouldMatch]"() {
|
||||
expect:
|
||||
shouldMatch == RegexPatterns.ipAddress().matcher(textToMatch).matches()
|
||||
shouldMatch == regexPatterns.ipAddress().matcher(textToMatch).matches()
|
||||
where:
|
||||
textToMatch || shouldMatch
|
||||
'123.123.123.123' || true
|
||||
@@ -31,7 +33,7 @@ class RegexPatternsSpec extends Specification {
|
||||
|
||||
def "should generate a regex for hostname [#textToMatch] that is a match [#shouldMatch]"() {
|
||||
expect:
|
||||
shouldMatch == RegexPatterns.hostname().matcher(textToMatch).matches()
|
||||
shouldMatch == regexPatterns.hostname().matcher(textToMatch).matches()
|
||||
where:
|
||||
textToMatch || shouldMatch
|
||||
'https://asd.com' || true
|
||||
@@ -44,7 +46,7 @@ class RegexPatternsSpec extends Specification {
|
||||
|
||||
def "should generate a regex for email [#textToMatch] that is a match [#shouldMatch]"() {
|
||||
expect:
|
||||
shouldMatch == RegexPatterns.email().matcher(textToMatch).matches()
|
||||
shouldMatch == regexPatterns.email().matcher(textToMatch).matches()
|
||||
where:
|
||||
textToMatch || shouldMatch
|
||||
'asd@asd.com' || true
|
||||
@@ -55,7 +57,7 @@ class RegexPatternsSpec extends Specification {
|
||||
// @see https://formvalidation.io/validators/uri/
|
||||
def "should generate a regex for url [#textToMatch] that is a match [#shouldMatch]"() {
|
||||
expect:
|
||||
shouldMatch == RegexPatterns.url().matcher(textToMatch).matches()
|
||||
shouldMatch == regexPatterns.url().matcher(textToMatch).matches()
|
||||
where:
|
||||
textToMatch || shouldMatch
|
||||
'ftp://asd.com:9090/asd/a?a=b' || true
|
||||
@@ -128,7 +130,7 @@ class RegexPatternsSpec extends Specification {
|
||||
|
||||
def "should generate a regex for httpsUrl [#textToMatch] that is a match [#shouldMatch]"() {
|
||||
expect:
|
||||
shouldMatch == RegexPatterns.httpsUrl().matcher(textToMatch).matches()
|
||||
shouldMatch == regexPatterns.httpsUrl().matcher(textToMatch).matches()
|
||||
where:
|
||||
textToMatch || shouldMatch
|
||||
'ftp://asd.com:9090/asd/a?a=b' || false
|
||||
@@ -201,7 +203,7 @@ class RegexPatternsSpec extends Specification {
|
||||
|
||||
def "should generate a regex for a number [#textToMatch] that is a match [#shouldMatch]"() {
|
||||
expect:
|
||||
shouldMatch == RegexPatterns.number().matcher(textToMatch).matches()
|
||||
shouldMatch == regexPatterns.number().matcher(textToMatch).matches()
|
||||
where:
|
||||
textToMatch || shouldMatch
|
||||
'1' || true
|
||||
@@ -213,7 +215,7 @@ class RegexPatternsSpec extends Specification {
|
||||
|
||||
def "should generate a regex for a positive integer [#textToMatch] that is a match [#shouldMatch]"() {
|
||||
expect:
|
||||
shouldMatch == RegexPatterns.positiveInt().matcher(textToMatch).matches()
|
||||
shouldMatch == regexPatterns.positiveInt().matcher(textToMatch).matches()
|
||||
where:
|
||||
textToMatch || shouldMatch
|
||||
'1' || true
|
||||
@@ -225,7 +227,7 @@ class RegexPatternsSpec extends Specification {
|
||||
|
||||
def "should generate a regex for a double [#textToMatch] that is a match [#shouldMatch]"() {
|
||||
expect:
|
||||
shouldMatch == RegexPatterns.aDouble().matcher(textToMatch).matches()
|
||||
shouldMatch == regexPatterns.aDouble().matcher(textToMatch).matches()
|
||||
where:
|
||||
textToMatch || shouldMatch
|
||||
'1' || false
|
||||
@@ -237,7 +239,7 @@ class RegexPatternsSpec extends Specification {
|
||||
|
||||
def "should generate a regex for a uuid [#textToMatch] that is a match [#shouldMatch]"() {
|
||||
expect:
|
||||
shouldMatch == RegexPatterns.uuid().matcher(textToMatch).matches()
|
||||
shouldMatch == regexPatterns.uuid().matcher(textToMatch).matches()
|
||||
where:
|
||||
textToMatch || shouldMatch
|
||||
UUID.randomUUID().toString() || true
|
||||
@@ -250,7 +252,7 @@ class RegexPatternsSpec extends Specification {
|
||||
|
||||
def "should generate a regex with date [#textToMatch] in YYYY-MM-DD format that should match [#shouldMatch]"() {
|
||||
expect:
|
||||
shouldMatch == RegexPatterns.isoDate().matcher(textToMatch).matches()
|
||||
shouldMatch == regexPatterns.isoDate().matcher(textToMatch).matches()
|
||||
where:
|
||||
textToMatch || shouldMatch
|
||||
"2014-03-01" || true
|
||||
@@ -268,7 +270,7 @@ class RegexPatternsSpec extends Specification {
|
||||
|
||||
def "should generate a regex with datetime [#textToMatch] in YYYY-MM-DDTHH:mm:ss format that should match [#shouldMatch]"() {
|
||||
expect:
|
||||
shouldMatch == RegexPatterns.isoDateTime().matcher(textToMatch).matches()
|
||||
shouldMatch == regexPatterns.isoDateTime().matcher(textToMatch).matches()
|
||||
where:
|
||||
textToMatch || shouldMatch
|
||||
"2014-03-01T12:23:45" || true
|
||||
@@ -293,7 +295,7 @@ class RegexPatternsSpec extends Specification {
|
||||
|
||||
def "should generate a regex with time [#textToMatch] in HH:mm:ss format that should match [#shouldMatch]"() {
|
||||
expect:
|
||||
shouldMatch == RegexPatterns.isoTime().matcher(textToMatch).matches()
|
||||
shouldMatch == regexPatterns.isoTime().matcher(textToMatch).matches()
|
||||
where:
|
||||
textToMatch || shouldMatch
|
||||
"12:23:45" || true
|
||||
@@ -309,7 +311,7 @@ class RegexPatternsSpec extends Specification {
|
||||
|
||||
def "should generate a regex with iso8601DateTimeWithTimezone [#textToMatch] in YYYY-MM-DDTHH:mm:ss.SSSZZ format that should match [#shouldMatch]"() {
|
||||
expect:
|
||||
shouldMatch == RegexPatterns.iso8601WithOffset().matcher(textToMatch).matches()
|
||||
shouldMatch == regexPatterns.iso8601WithOffset().matcher(textToMatch).matches()
|
||||
where:
|
||||
textToMatch || shouldMatch
|
||||
'2014-03-01T12:23:45Z' || true
|
||||
@@ -322,7 +324,7 @@ class RegexPatternsSpec extends Specification {
|
||||
|
||||
def "should generate a regex for a non blank string [#textToMatch] that should match [#shouldMatch]"() {
|
||||
expect:
|
||||
shouldMatch == RegexPatterns.nonBlank().matcher(textToMatch).matches()
|
||||
shouldMatch == regexPatterns.nonBlank().matcher(textToMatch).matches()
|
||||
where:
|
||||
textToMatch || shouldMatch
|
||||
'Not Empty' || true
|
||||
@@ -336,7 +338,7 @@ class RegexPatternsSpec extends Specification {
|
||||
|
||||
def "should generate a regex for a non empty string [#textToMatch] that should match [#shouldMatch]"() {
|
||||
expect:
|
||||
shouldMatch == RegexPatterns.nonEmpty().matcher(textToMatch).matches()
|
||||
shouldMatch == regexPatterns.nonEmpty().matcher(textToMatch).matches()
|
||||
where:
|
||||
textToMatch || shouldMatch
|
||||
'Not Empty' || true
|
||||
|
||||
@@ -44,6 +44,8 @@ import org.springframework.cloud.contract.spec.internal.RegexPatterns
|
||||
@PackageScope
|
||||
class MatchingRulesConverter {
|
||||
|
||||
private static final RegexPatterns regexPatterns = new RegexPatterns()
|
||||
|
||||
static Category matchingRulesForBody(BodyMatchers bodyMatchers) {
|
||||
return matchingRulesFor("body", bodyMatchers)
|
||||
}
|
||||
@@ -87,15 +89,15 @@ class MatchingRulesConverter {
|
||||
break
|
||||
case MatchingType.REGEX:
|
||||
String pattern = it.value().toString()
|
||||
if (pattern == RegexPatterns.number().pattern()) {
|
||||
if (pattern == regexPatterns.number().pattern()) {
|
||||
category.
|
||||
addRule(key, new NumberTypeMatcher(NumberTypeMatcher.NumberType.NUMBER))
|
||||
}
|
||||
else if (pattern == RegexPatterns.anInteger().pattern()) {
|
||||
else if (pattern == regexPatterns.anInteger().pattern()) {
|
||||
category.
|
||||
addRule(key, new NumberTypeMatcher(NumberTypeMatcher.NumberType.INTEGER))
|
||||
}
|
||||
else if (pattern == RegexPatterns.aDouble().pattern()) {
|
||||
else if (pattern == regexPatterns.aDouble().pattern()) {
|
||||
category.
|
||||
addRule(key, new NumberTypeMatcher(NumberTypeMatcher.NumberType.DECIMAL))
|
||||
}
|
||||
|
||||
@@ -50,6 +50,8 @@ import org.springframework.cloud.contract.verifier.util.JsonToJsonPathsConverter
|
||||
@PackageScope
|
||||
class MessagingSCContractCreator {
|
||||
|
||||
RegexPatterns regexPatterns = new RegexPatterns()
|
||||
|
||||
private static final String FULL_BODY = '$'
|
||||
private static final String DESTINATION_KEY = "sentTo"
|
||||
private static final List<String> NON_HEADER_META_DATA = [DESTINATION_KEY]
|
||||
@@ -122,15 +124,15 @@ class MessagingSCContractCreator {
|
||||
switch (rule.numberType) {
|
||||
case NumberTypeMatcher.NumberType.NUMBER:
|
||||
jsonPath(key,
|
||||
byRegex(RegexPatterns.number()))
|
||||
byRegex(regexPatterns.number()))
|
||||
break
|
||||
case NumberTypeMatcher.NumberType.INTEGER:
|
||||
jsonPath(key,
|
||||
byRegex(RegexPatterns.anInteger()))
|
||||
byRegex(regexPatterns.anInteger()))
|
||||
break
|
||||
case NumberTypeMatcher.NumberType.DECIMAL:
|
||||
jsonPath(key,
|
||||
byRegex(RegexPatterns.aDouble()))
|
||||
byRegex(regexPatterns.aDouble()))
|
||||
break
|
||||
default:
|
||||
throw new RuntimeException("Unsupported number type!")
|
||||
@@ -165,11 +167,11 @@ class MessagingSCContractCreator {
|
||||
|
||||
private String getTriggeredBy(Message message) {
|
||||
return message.providerStates.first().name
|
||||
.replace(':', ' ')
|
||||
.replace(' ', '_')
|
||||
.replace('(', '')
|
||||
.replace(')', '')
|
||||
.uncapitalize() + "()"
|
||||
.replace(':', ' ')
|
||||
.replace(' ', '_')
|
||||
.replace('(', '')
|
||||
.replace(')', '')
|
||||
.uncapitalize() + "()"
|
||||
}
|
||||
|
||||
private String findDestination(Message message) {
|
||||
|
||||
@@ -56,6 +56,7 @@ import org.springframework.cloud.contract.verifier.util.JsonToJsonPathsConverter
|
||||
class RequestResponseSCContractCreator {
|
||||
|
||||
private static final String FULL_BODY = '$'
|
||||
private static final RegexPatterns regexPatterns = new RegexPatterns()
|
||||
|
||||
Collection<Contract> convertFrom(RequestResponsePact pact) {
|
||||
return pact.interactions.collect { RequestResponseInteraction interaction ->
|
||||
@@ -146,15 +147,15 @@ class RequestResponseSCContractCreator {
|
||||
switch (rule.numberType) {
|
||||
case NumberTypeMatcher.NumberType.NUMBER:
|
||||
jsonPath(key,
|
||||
byRegex(RegexPatterns.number()))
|
||||
byRegex(regexPatterns.number()))
|
||||
break
|
||||
case NumberTypeMatcher.NumberType.INTEGER:
|
||||
jsonPath(key, byRegex(RegexPatterns.
|
||||
jsonPath(key, byRegex(regexPatterns.
|
||||
anInteger()))
|
||||
break
|
||||
case NumberTypeMatcher.NumberType.DECIMAL:
|
||||
jsonPath(key,
|
||||
byRegex(RegexPatterns.aDouble()))
|
||||
byRegex(regexPatterns.aDouble()))
|
||||
break
|
||||
default:
|
||||
throw new RuntimeException("Unsupported number type!")
|
||||
@@ -236,17 +237,17 @@ class RequestResponseSCContractCreator {
|
||||
switch (rule.numberType) {
|
||||
case NumberTypeMatcher.NumberType.NUMBER:
|
||||
jsonPath(key,
|
||||
byRegex(RegexPatterns.
|
||||
byRegex(regexPatterns.
|
||||
number()))
|
||||
break
|
||||
case NumberTypeMatcher.NumberType.INTEGER:
|
||||
jsonPath(key,
|
||||
byRegex(RegexPatterns.
|
||||
byRegex(regexPatterns.
|
||||
anInteger()))
|
||||
break
|
||||
case NumberTypeMatcher.NumberType.DECIMAL:
|
||||
jsonPath(key,
|
||||
byRegex(RegexPatterns.
|
||||
byRegex(regexPatterns.
|
||||
aDouble()))
|
||||
break
|
||||
default:
|
||||
|
||||
@@ -212,25 +212,25 @@
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.gmavenplus</groupId>
|
||||
<artifactId>gmavenplus-plugin</artifactId>
|
||||
<!-- Joint compilation -->
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>addSources</goal>
|
||||
<goal>addTestSources</goal>
|
||||
<goal>generateStubs</goal>
|
||||
<goal>compile</goal>
|
||||
<goal>generateTestStubs</goal>
|
||||
<goal>compileTests</goal>
|
||||
<goal>removeStubs</goal>
|
||||
<goal>removeTestStubs</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.gmavenplus</groupId>
|
||||
<artifactId>gmavenplus-plugin</artifactId>
|
||||
<!-- Joint compilation -->
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>addSources</goal>
|
||||
<goal>addTestSources</goal>
|
||||
<goal>generateStubs</goal>
|
||||
<goal>compile</goal>
|
||||
<goal>generateTestStubs</goal>
|
||||
<goal>compileTests</goal>
|
||||
<goal>removeStubs</goal>
|
||||
<goal>removeTestStubs</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
|
||||
Reference in New Issue
Block a user