5
5
import org .zalando .logbook .DefaultLogbook .SimplePrecorrelation ;
6
6
7
7
import java .io .IOException ;
8
- import java .time .Duration ;
9
8
10
9
import static com .jayway .jsonassert .JsonAssert .with ;
11
10
import static java .time .Duration .ZERO ;
@@ -243,7 +242,8 @@ public void shouldLogResponse() throws IOException {
243
242
.withContentType ("application/xml" )
244
243
.withBodyAsString ("<success>true<success>" );
245
244
246
- final String json = unit .format (new SimpleCorrelation <>(correlationId , ofMillis (125 ), request , response ));
245
+ final String json = unit .format (new SimpleCorrelation <>(correlationId , ofMillis (125 ), request , response ,
246
+ request , response ));
247
247
248
248
with (json )
249
249
.assertThat ("$.origin" , is ("local" ))
@@ -263,7 +263,8 @@ public void shouldLogResponseWithoutHeaders() throws IOException {
263
263
final HttpRequest request = MockHttpRequest .create ();
264
264
final HttpResponse response = create ();
265
265
266
- final String json = unit .format (new SimpleCorrelation <>(correlationId , ZERO , request , response ));
266
+ final String json = unit .format (new SimpleCorrelation <>(correlationId , ZERO , request , response ,
267
+ request , response ));
267
268
268
269
with (json )
269
270
.assertThat ("$" , not (hasKey ("headers" )));
@@ -277,7 +278,8 @@ public void shouldLogResponseWithoutBody() throws IOException {
277
278
final HttpResponse response = create ()
278
279
.withBodyAsString ("" );
279
280
280
- final String json = unit .format (new SimpleCorrelation <>(correlationId , ZERO , request , response ));
281
+ final String json = unit .format (new SimpleCorrelation <>(correlationId , ZERO , request , response , request ,
282
+ response ));
281
283
282
284
with (json )
283
285
.assertThat ("$" , not (hasKey ("body" )));
@@ -291,7 +293,8 @@ public void shouldEmbedJsonResponseBodyAsIs() throws IOException {
291
293
.withContentType ("application/json" )
292
294
.withBodyAsString ("{\" name\" :\" Bob\" }" );
293
295
294
- final String json = unit .format (new SimpleCorrelation <>(correlationId , ZERO , request , response ));
296
+ final String json = unit .format (new SimpleCorrelation <>(correlationId , ZERO , request , response ,
297
+ request , response ));
295
298
296
299
with (json )
297
300
.assertThat ("$.body.name" , is ("Bob" ));
@@ -305,7 +308,8 @@ public void shouldCompactEmbeddedJsonResponseBody() throws IOException {
305
308
.withContentType ("application/json" )
306
309
.withBodyAsString ("{\n \" name\" : \" Bob\" \n }" );
307
310
308
- final String json = unit .format (new SimpleCorrelation <>(correlationId , ZERO , request , response ));
311
+ final String json = unit .format (new SimpleCorrelation <>(correlationId , ZERO , request , response , request ,
312
+ response ));
309
313
310
314
assertThat (json , containsString ("{\" name\" :\" Bob\" }" ));
311
315
}
@@ -318,7 +322,8 @@ public void shouldEmbedCustomJsonResponseBodyAsIs() throws IOException {
318
322
.withContentType ("application/custom+json" )
319
323
.withBodyAsString ("{\" name\" :\" Bob\" }" );
320
324
321
- final String json = unit .format (new SimpleCorrelation <>(correlationId , ZERO , request , response ));
325
+ final String json = unit .format (new SimpleCorrelation <>(correlationId , ZERO , request , response , request ,
326
+ response ));
322
327
323
328
with (json )
324
329
.assertThat ("$.body.name" , is ("Bob" ));
@@ -332,7 +337,8 @@ public void shouldNotEmbedCustomTextJsonResponseBodyAsIs() throws IOException {
332
337
.withContentType ("text/custom+json" )
333
338
.withBodyAsString ("{\" name\" :\" Bob\" }" );
334
339
335
- final String json = unit .format (new SimpleCorrelation <>(correlationId , ZERO , request , response ));
340
+ final String json = unit .format (new SimpleCorrelation <>(correlationId , ZERO , request , response , request ,
341
+ response ));
336
342
337
343
with (json )
338
344
.assertThat ("$.body" , is ("{\" name\" :\" Bob\" }" ));
@@ -345,7 +351,8 @@ public void shouldEmbedJsonResponseBodyAsNullIfEmpty() throws IOException {
345
351
final HttpResponse response = create ()
346
352
.withContentType ("application/json" );
347
353
348
- final String json = unit .format (new SimpleCorrelation <>(correlationId , ZERO , request , response ));
354
+ final String json = unit .format (new SimpleCorrelation <>(correlationId , ZERO , request , response , request ,
355
+ response ));
349
356
350
357
with (json )
351
358
.assertThat ("$.body" , is (emptyString ()));
@@ -359,7 +366,8 @@ public void shouldLogInvalidJsonResponseBodyAsIs() throws IOException {
359
366
.withContentType ("text/custom+json" )
360
367
.withBodyAsString ("{\n \" name\" :\" Bob\" ;;;\n ;}" );
361
368
362
- final String json = unit .format (new SimpleCorrelation <>(correlationId , ZERO , request , response ));
369
+ final String json = unit .format (new SimpleCorrelation <>(correlationId , ZERO , request , response , request ,
370
+ response ));
363
371
364
372
with (json )
365
373
.assertThat ("$.body" , is ("{\n \" name\" :\" Bob\" ;;;\n ;}" ));
0 commit comments