@@ -136,7 +136,8 @@ public void createsContainerOk()
136
136
new RtContainers (
137
137
new AssertRequest (
138
138
new Response (
139
- HttpStatus .SC_CREATED , "{ \" Id\" : \" df2419f4\" }"
139
+ HttpStatus .SC_CREATED ,
140
+ "{ \" Id\" : \" df2419f4\" , \" Warnings\" : [ ]}"
140
141
),
141
142
new Condition (
142
143
"The 'Content-Type' header must be set." ,
@@ -172,7 +173,7 @@ public void returnsCreatedContainer() throws Exception {
172
173
new AssertRequest (
173
174
new Response (
174
175
HttpStatus .SC_CREATED ,
175
- "{ \" Id\" : \" df2419f4\" }"
176
+ "{ \" Id\" : \" df2419f4\" , \" Warnings \" : [ ] }"
176
177
)
177
178
), URI .create ("http://localhost/test" )
178
179
).create ("some_image" ),
@@ -266,7 +267,8 @@ public void createsWithImageName() throws Exception {
266
267
new RtContainers (
267
268
new AssertRequest (
268
269
new Response (
269
- HttpStatus .SC_CREATED , "{ \" Id\" : \" df2419f4\" }"
270
+ HttpStatus .SC_CREATED ,
271
+ "{ \" Id\" : \" df2419f4\" , \" Warnings\" : [ ]}"
270
272
),
271
273
new Condition (
272
274
"Resource path must be /create?name=some_name" ,
@@ -292,7 +294,8 @@ public void createsWithPayloadForCreateJson() throws Exception {
292
294
new RtContainers (
293
295
new AssertRequest (
294
296
new Response (
295
- HttpStatus .SC_CREATED , "{ \" Id\" : \" df2419f4\" }"
297
+ HttpStatus .SC_CREATED ,
298
+ "{ \" Id\" : \" df2419f4\" , \" Warnings\" : [ ]}"
296
299
),
297
300
new Condition (
298
301
"Resource path must be /create" ,
@@ -327,7 +330,8 @@ public void createsWithPayloadForCreateNameAndJson() throws Exception {
327
330
new RtContainers (
328
331
new AssertRequest (
329
332
new Response (
330
- HttpStatus .SC_CREATED , "{ \" Id\" : \" df2419f4\" }"
333
+ HttpStatus .SC_CREATED ,
334
+ "{ \" Id\" : \" df2419f4\" , \" Warnings\" : [ ]}"
331
335
),
332
336
new Condition (
333
337
"Resource path must be /create?name=image_name" ,
@@ -356,7 +360,10 @@ public void createsWithPayloadForCreateNameAndJson() throws Exception {
356
360
public void createEscapesNameParameter () throws Exception {
357
361
new RtContainers (
358
362
new AssertRequest (
359
- new Response (HttpStatus .SC_CREATED , "{ \" Id\" : \" df2419f4\" }" ),
363
+ new Response (
364
+ HttpStatus .SC_CREATED ,
365
+ "{ \" Id\" : \" df2419f4\" , \" Warnings\" : [ ]}"
366
+ ),
360
367
new Condition (
361
368
"RtContainers.create() must encode URL parameter" ,
362
369
req -> req .getRequestLine ()
@@ -366,4 +373,48 @@ public void createEscapesNameParameter() throws Exception {
366
373
URI .create ("http://localhost/docker" )
367
374
).create ("Adrian Toomes" , "some/image" );
368
375
}
376
+
377
+ /**
378
+ * RtContainers.create() returns an RtContainer with the given parameter.
379
+ * @throws Exception If something goes wrong.
380
+ */
381
+ @ Test
382
+ public void createsContainerWithGivenParameters () throws Exception {
383
+ MatcherAssert .assertThat (
384
+ new RtContainers (
385
+ new AssertRequest (
386
+ new Response (
387
+ HttpStatus .SC_CREATED ,
388
+ "{ \" Id\" : \" df2419f4\" , \" Warnings\" : [ ]}"
389
+ )
390
+ ), URI .create ("http://localhost/test" )
391
+ ).create (
392
+ Json .createObjectBuilder ()
393
+ .add ("Image" , "ubuntu" ).build ()
394
+ ).getString ("Image" ),
395
+ Matchers .is ("ubuntu" )
396
+ );
397
+ }
398
+
399
+ /**
400
+ * RtContainers.create() returns an RtContainer with the docker id.
401
+ * @throws Exception If something goes wrong.
402
+ */
403
+ @ Test
404
+ public void createsContainerWithId () throws Exception {
405
+ MatcherAssert .assertThat (
406
+ new RtContainers (
407
+ new AssertRequest (
408
+ new Response (
409
+ HttpStatus .SC_CREATED ,
410
+ "{ \" Id\" : \" df2419f4\" , \" Warnings\" : [ ] }"
411
+ )
412
+ ), URI .create ("http://localhost/test" )
413
+ ).create (
414
+ Json .createObjectBuilder ()
415
+ .add ("Image" , "ubuntu" ).build ()
416
+ ).getString ("Id" ),
417
+ Matchers .is ("df2419f4" )
418
+ );
419
+ }
369
420
}
0 commit comments