review fixes
This commit is contained in:
committed by
Milosz Rembisz
parent
683fb9b732
commit
61e435e543
@@ -30,7 +30,7 @@ class MockMvcSpockMethodBodyBuilder extends SpockMethodBodyBuilder {
|
||||
bb.addLine(".body('''$bodyAsString''')")
|
||||
}
|
||||
if (request.multipart) {
|
||||
multipartParameters.each { entry -> bb.addLine(getMultipartParameterLine(entry)) }
|
||||
multipartParameters?.each { Map.Entry<String, Object> entry -> bb.addLine(getMultipartParameterLine(entry)) }
|
||||
}
|
||||
bb.unindent()
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ abstract class SpockMethodBodyBuilder {
|
||||
}
|
||||
|
||||
protected Map<String, Object> getMultipartParameters() {
|
||||
return (Map<String, Object>)request.multipart.serverValue
|
||||
return (Map<String, Object>)request?.multipart?.serverValue
|
||||
}
|
||||
|
||||
protected String getMultipartParameterLine(Map.Entry<String, Object> parameter) {
|
||||
|
||||
@@ -53,7 +53,7 @@ class Common {
|
||||
}
|
||||
|
||||
NamedProperty named(Map<String, DslProperty> namedMap){
|
||||
return new NamedProperty(namedMap.get('name'), namedMap.get('content'))
|
||||
return new NamedProperty(namedMap)
|
||||
}
|
||||
|
||||
DslProperty value(ClientDslProperty client, ServerDslProperty server) {
|
||||
|
||||
@@ -14,7 +14,7 @@ class Multipart extends DslProperty {
|
||||
}
|
||||
|
||||
private static Map<String, Object> extractValue(Map<String, DslProperty> multipart, Closure valueProvider) {
|
||||
multipart.collectEntries { Map.Entry<String, DslProperty> entry ->
|
||||
return multipart.collectEntries { Map.Entry<String, DslProperty> entry ->
|
||||
[(entry.key): valueProvider(entry.value)]
|
||||
} as Map<String, Object>
|
||||
}
|
||||
|
||||
@@ -9,6 +9,8 @@ import groovy.transform.ToString
|
||||
@CompileStatic
|
||||
class NamedProperty {
|
||||
|
||||
private static final String NAME = 'name'
|
||||
private static final String CONTENT = 'content'
|
||||
DslProperty name
|
||||
DslProperty value
|
||||
|
||||
@@ -16,4 +18,8 @@ class NamedProperty {
|
||||
this.name = name
|
||||
this.value = value
|
||||
}
|
||||
|
||||
NamedProperty(Map<String, DslProperty> namedMap) {
|
||||
this(namedMap?.get(NAME), namedMap?.get(CONTENT))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,10 +118,6 @@ class Request extends Common {
|
||||
this.multipart = new Multipart(multipartAsValue)
|
||||
}
|
||||
|
||||
Multipart getMultipart() {
|
||||
return multipart
|
||||
}
|
||||
|
||||
MatchingStrategy equalTo(Object value) {
|
||||
return new MatchingStrategy(value, MatchingStrategy.Type.EQUAL_TO)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user