Fixed handling execution properties in JUnit tests.
This commit is contained in:
@@ -64,7 +64,14 @@ abstract class JUnitMethodBodyBuilder extends MethodBodyBuilder {
|
||||
|
||||
@Override
|
||||
protected void processBodyElement(BlockBuilder blockBuilder, String property, Map.Entry entry) {
|
||||
processBodyElement(blockBuilder, property + """.get(\\\"$entry.key\\\")""", entry.value)
|
||||
processBodyElement(blockBuilder, property + getMapKeyReferenceString(entry), entry.value)
|
||||
}
|
||||
|
||||
private String getMapKeyReferenceString(Map.Entry entry) {
|
||||
if (entry.value instanceof ExecutionProperty){
|
||||
return "." + entry.key
|
||||
}
|
||||
return """.get(\\\"$entry.key\\\")"""
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -740,8 +740,6 @@ class MockMvcJunitMethodBuilderSpec extends Specification implements WireMockStu
|
||||
}
|
||||
|
||||
@Issue('72')
|
||||
@Ignore
|
||||
//TODO: fix exec method for jUnit
|
||||
def "should make the execute method work"() {
|
||||
given:
|
||||
GroovyDsl contractDsl = GroovyDsl.make {
|
||||
@@ -781,7 +779,7 @@ class MockMvcJunitMethodBuilderSpec extends Specification implements WireMockStu
|
||||
builder.appendTo(blockBuilder)
|
||||
def jUnitTest = blockBuilder.toString()
|
||||
then:
|
||||
jUnitTest.contains('''assertThatRejectionReasonIsNull(parsedJson.read('$.rejectionReason'))''')
|
||||
jUnitTest.contains('''assertThatRejectionReasonIsNull(parsedJson.read("$.rejectionReason"))''')
|
||||
}
|
||||
|
||||
def "should support inner map and list definitions"() {
|
||||
|
||||
Reference in New Issue
Block a user