Add some tests
This commit is contained in:
parent
961a8f556c
commit
a7c6050e09
7 changed files with 258 additions and 108 deletions
|
@ -44,7 +44,7 @@ class HttpMockServer {
|
|||
Closure predicate = Eval.me(request.predicate as String) as Closure
|
||||
Closure okResponse = Eval.me(request.response as String) as Closure
|
||||
boolean soap = Boolean.valueOf(request.soap as String)
|
||||
Mock mock = new Mock(name, predicate, okResponse, soap)
|
||||
Mock mock = new Mock(name, mockPath, mockPort, predicate, okResponse, soap)
|
||||
HttpServerWraper child = childServers.find { it.port == mockPort }
|
||||
if (!child) {
|
||||
child = new HttpServerWraper(mockPort)
|
||||
|
|
|
@ -5,16 +5,24 @@ import groovy.transform.EqualsAndHashCode
|
|||
@EqualsAndHashCode(excludes = ["counter"])
|
||||
class Mock {
|
||||
final String name
|
||||
final String path
|
||||
final int port
|
||||
final Closure predicate
|
||||
final Closure responseOk
|
||||
final boolean soap
|
||||
//TODO add http method
|
||||
//TODO add http code
|
||||
//TODO add request headers
|
||||
//TODO add response headers
|
||||
int counter = 0
|
||||
//TODO add historical invocations
|
||||
|
||||
Mock(String name, Closure predicate, Closure responseOk, boolean soap) {
|
||||
Mock(String name, String path, int port, Closure predicate, Closure responseOk, boolean soap) {
|
||||
this.name = name
|
||||
this.predicate = predicate
|
||||
this.responseOk = responseOk
|
||||
this.soap = soap
|
||||
this.path = path
|
||||
this.port = port
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue