18
18
public class MocoGlobalRequestTest extends AbstractMocoHttpTest {
19
19
@ Test
20
20
public void should_match_global_header () throws Exception {
21
- server = httpserver (port (), request (eq (header ("foo" ), "bar" )));
21
+ server = httpServer (port (), request (eq (header ("foo" ), "bar" )));
22
22
server .request (by (uri ("/global-request" ))).response (text ("blah" ));
23
23
24
24
running (server , new Runnable () {
@@ -32,7 +32,7 @@ public void run() throws Exception {
32
32
33
33
@ Test (expected = HttpResponseException .class )
34
34
public void should_throw_exception_without_global_matcher () throws Exception {
35
- server = httpserver (port (), request (eq (header ("foo" ), "bar" )));
35
+ server = httpServer (port (), request (eq (header ("foo" ), "bar" )));
36
36
server .request (by (uri ("/global-request" ))).response (text ("blah" ));
37
37
38
38
running (server , new Runnable () {
@@ -46,7 +46,7 @@ public void run() throws Exception {
46
46
47
47
@ Test
48
48
public void should_match_global_header_with_any_response () throws Exception {
49
- server = httpserver (port (), request (eq (header ("foo" ), "bar" )));
49
+ server = httpServer (port (), request (eq (header ("foo" ), "bar" )));
50
50
server .response (text ("blah" ));
51
51
52
52
running (server , new Runnable () {
@@ -61,7 +61,7 @@ public void run() throws Exception {
61
61
62
62
@ Test (expected = HttpResponseException .class )
63
63
public void should_throw_exception_without_global_matcher_for_any_response () throws Exception {
64
- server = httpserver (port (), request (eq (header ("foo" ), "bar" )));
64
+ server = httpServer (port (), request (eq (header ("foo" ), "bar" )));
65
65
server .response (text ("blah" ));
66
66
67
67
running (server , new Runnable () {
@@ -74,7 +74,7 @@ public void run() throws Exception {
74
74
75
75
@ Test
76
76
public void should_match_with_exist_header () throws Exception {
77
- server = httpserver (port (), request (eq (header ("foo" ), "bar" )));
77
+ server = httpServer (port (), request (eq (header ("foo" ), "bar" )));
78
78
server .request (exist (header ("blah" ))).response (text ("header" ));
79
79
80
80
running (server , new Runnable () {
@@ -87,7 +87,7 @@ public void run() throws Exception {
87
87
88
88
@ Test (expected = HttpResponseException .class )
89
89
public void should_throw_exception_without_global_matcher_for_exist () throws Exception {
90
- server = httpserver (port (), request (eq (header ("foo" ), "bar" )));
90
+ server = httpServer (port (), request (eq (header ("foo" ), "bar" )));
91
91
server .request (exist (header ("blah" ))).response (text ("header" ));
92
92
93
93
running (server , new Runnable () {
@@ -100,7 +100,7 @@ public void run() throws Exception {
100
100
101
101
@ Test
102
102
public void should_match_with_json () throws Exception {
103
- server = httpserver (port (), request (by (uri ("/path" ))));
103
+ server = httpServer (port (), request (by (uri ("/path" ))));
104
104
final String jsonContent = "{\" foo\" :\" bar\" }" ;
105
105
server .request (json (text (jsonContent ))).response ("foo" );
106
106
running (server , new Runnable () {
@@ -113,7 +113,7 @@ public void run() throws IOException {
113
113
114
114
@ Test (expected = HttpResponseException .class )
115
115
public void should_throw_exception_without_match_json () throws Exception {
116
- server = httpserver (port (), request (by (uri ("/path" ))));
116
+ server = httpServer (port (), request (by (uri ("/path" ))));
117
117
final String jsonContent = "{\" foo\" :\" bar\" }" ;
118
118
server .request (json (text (jsonContent ))).response ("foo" );
119
119
running (server , new Runnable () {
@@ -126,7 +126,7 @@ public void run() throws IOException {
126
126
127
127
@ Test
128
128
public void should_match_with_xml () throws Exception {
129
- server = httpserver (port (), request (by (uri ("/path" ))));
129
+ server = httpServer (port (), request (by (uri ("/path" ))));
130
130
server .request (xml (text ("<request><parameters><id>1</id></parameters></request>" ))).response ("foo" );
131
131
running (server , new Runnable () {
132
132
@ Override
@@ -138,7 +138,7 @@ public void run() throws IOException {
138
138
139
139
@ Test (expected = HttpResponseException .class )
140
140
public void should_throw_exception_without_match_xml () throws Exception {
141
- server = httpserver (port (), request (by (uri ("/path" ))));
141
+ server = httpServer (port (), request (by (uri ("/path" ))));
142
142
server .request (xml (text ("<request><parameters><id>1</id></parameters></request>" ))).response ("foo" );
143
143
running (server , new Runnable () {
144
144
@ Override
@@ -151,7 +151,7 @@ public void run() throws IOException {
151
151
@ Test
152
152
public void should_match_mount () throws Exception {
153
153
final String MOUNT_DIR = "src/test/resources/test" ;
154
- server = httpserver (port (), request (eq (header ("foo" ), "bar" )));
154
+ server = httpServer (port (), request (eq (header ("foo" ), "bar" )));
155
155
server .mount (MOUNT_DIR , to ("/dir" ));
156
156
157
157
running (server , new Runnable () {
@@ -165,7 +165,7 @@ public void run() throws IOException {
165
165
@ Test (expected = HttpResponseException .class )
166
166
public void should_throw_exception_without_match_mount () throws Exception {
167
167
final String MOUNT_DIR = "src/test/resources/test" ;
168
- server = httpserver (port (), request (eq (header ("foo" ), "bar" )));
168
+ server = httpServer (port (), request (eq (header ("foo" ), "bar" )));
169
169
server .mount (MOUNT_DIR , to ("/dir" ));
170
170
171
171
running (server , new Runnable () {
@@ -178,7 +178,7 @@ public void run() throws IOException {
178
178
179
179
@ Test
180
180
public void should_match_request_based_on_not_matcher () throws Exception {
181
- server = httpserver (port (), request (eq (header ("foo" ), "bar" )));
181
+ server = httpServer (port (), request (eq (header ("foo" ), "bar" )));
182
182
server .request (not (by (uri ("/foo" )))).response (text ("bar" ));
183
183
184
184
running (server , new Runnable () {
@@ -191,7 +191,7 @@ public void run() throws IOException {
191
191
192
192
@ Test (expected = HttpResponseException .class )
193
193
public void should_throw_exception_without_match_not () throws Exception {
194
- server = httpserver (port (), request (eq (header ("foo" ), "bar" )));
194
+ server = httpServer (port (), request (eq (header ("foo" ), "bar" )));
195
195
server .request (not (by (uri ("/foo" )))).response (text ("bar" ));
196
196
197
197
running (server , new Runnable () {
@@ -204,7 +204,7 @@ public void run() throws IOException {
204
204
205
205
@ Test
206
206
public void should_match_request_based_on_and_matcher () throws Exception {
207
- server = httpserver (port (), request (eq (header ("foo" ), "bar" )));
207
+ server = httpServer (port (), request (eq (header ("foo" ), "bar" )));
208
208
server .request (and (by (uri ("/foo" )), eq (header ("header" ), "blah" ))).response (text ("bar" ));
209
209
210
210
running (server , new Runnable () {
@@ -217,7 +217,7 @@ public void run() throws IOException {
217
217
218
218
@ Test (expected = HttpResponseException .class )
219
219
public void should_throw_exception_without_match_and_matcher () throws Exception {
220
- server = httpserver (port (), request (eq (header ("foo" ), "bar" )));
220
+ server = httpServer (port (), request (eq (header ("foo" ), "bar" )));
221
221
server .request (and (by (uri ("/foo" )), eq (header ("header" ), "blah" ))).response (text ("bar" ));
222
222
223
223
running (server , new Runnable () {
0 commit comments