Refactor tests

This commit is contained in:
Dominik Adam Przybysz 2014-12-09 23:05:50 +01:00
parent 5db690c434
commit dfc0332d5a
8 changed files with 233 additions and 2 deletions

View file

@ -7,7 +7,7 @@ import java.util.concurrent.CopyOnWriteArrayList
class ContextExecutor {
private final HttpServerWraper httpServerWraper
private final String path
final String path
private final List<Mock> mocks
ContextExecutor(HttpServerWraper httpServerWraper, String path, Mock initialMock) {
@ -59,6 +59,10 @@ class ContextExecutor {
return mock.counter
}
void addMock(Mock mock){
mocks << mock
}
private static String wrapSoap(String request) {
"""<?xml version='1.0' encoding='UTF-8'?>
<soap-env:Envelope xmlns:soap-env='http://schemas.xmlsoap.org/soap/envelope/' xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing">

View file

@ -28,7 +28,7 @@ class HttpServerWraper {
void addMock(String path, Mock mock) {
ContextExecutor executor = executors.find { it.path == path }
if (executor) {
executor.mocks << mock
executor.addMock(mock)
} else {
executors << new ContextExecutor(this, path, mock)
}