Added regex helper method instead of calling static Pattern.compile
This commit is contained in:
@@ -20,7 +20,7 @@ class WiremockToDslConverter {
|
||||
request {
|
||||
${request.method ? "method \"\"\"$request.method\"\"\"" : ""}
|
||||
${request.url ? "url \"\"\"$request.url\"\"\"" : ""}
|
||||
${request.urlPattern ? "url \$(client(java.util.regex.Pattern.compile('${escapeJava(request.urlPattern)}')), server(''))" : ""}
|
||||
${request.urlPattern ? "url \$(client(regex('${escapeJava(request.urlPattern)}')), server(''))" : ""}
|
||||
${request.urlPath ? "url \"\"\"$request.urlPath\"\"\"" : ""}
|
||||
${
|
||||
request.headers ? """headers {
|
||||
|
||||
@@ -3,6 +3,8 @@ package io.coderate.accurest.dsl.internal
|
||||
import groovy.transform.PackageScope
|
||||
import groovy.transform.TypeChecked
|
||||
|
||||
import java.util.regex.Pattern
|
||||
|
||||
/**
|
||||
* @TypeChecked instead of @CompileStatic due to usage of double dispatch.
|
||||
* Double dispatch doesn't work if you're using @CompileStatic
|
||||
@@ -60,6 +62,10 @@ class Common {
|
||||
return value(server, client)
|
||||
}
|
||||
|
||||
Pattern regex(String regex) {
|
||||
return Pattern.compile(regex)
|
||||
}
|
||||
|
||||
ClientDslProperty client(Object clientValue) {
|
||||
return new ClientDslProperty(clientValue)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user