Do not allow for System exit
Change-Id: I268b12dfab2e6021ad057a4dc9716a01efbe375d
This commit is contained in:
parent
f03618873e
commit
5545b67ebd
2 changed files with 31 additions and 1 deletions
|
@ -839,4 +839,31 @@ class MockServerIntegrationTest extends Specification {
|
|||
false | 1
|
||||
true | 0
|
||||
}
|
||||
|
||||
@Unroll
|
||||
def "should reject mock when it has System.exit in closure"() {
|
||||
when:
|
||||
remoteMockServer.addMock(new AddMockRequestData(
|
||||
name: 'testRest',
|
||||
path: 'testEndpoint',
|
||||
port: 9999,
|
||||
predicate: predicate,
|
||||
response: '''{req -> "<goodResponseRest-${req.xml.name()}/>"}''',
|
||||
soap: false
|
||||
))
|
||||
then:
|
||||
thrown(InvalidMockDefinition)
|
||||
expect:
|
||||
remoteMockServer.listMocks() == []
|
||||
where:
|
||||
predicate << [
|
||||
'''{req -> System.exit(-1); req.xml.name() == 'request'}''',
|
||||
'''{req -> System .exit(-1); req.xml.name() == 'request'}''',
|
||||
'''{req -> System
|
||||
|
||||
.exit(-1); req.xml.name() == 'request'}''',
|
||||
'''{req -> System. exit(-1); req.xml.name() == 'request'}''',
|
||||
'''{req -> System.exit (-1); req.xml.name() == 'request'}'''
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue