1
1
/**
2
- * Copyright (c) 2019, Mihai Emil Andronache
2
+ * Copyright (c) 2018- 2019, Mihai Emil Andronache
3
3
* All rights reserved.
4
4
* Redistribution and use in source and binary forms, with or without
5
5
* modification, are permitted provided that the following conditions are met:
23
23
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
24
24
* POSSIBILITY OF SUCH DAMAGE.
25
25
*/
26
- package com .amihaiemil .docker ;
26
+ package com .amihaiemil .docker . mock ;
27
27
28
28
import java .io .IOException ;
29
29
import java .util .ArrayList ;
30
30
import java .util .Iterator ;
31
31
import javax .json .Json ;
32
- import javax .json .JsonArray ;
33
32
import javax .json .JsonObject ;
34
33
import javax .json .JsonReader ;
35
34
import org .apache .http .HttpEntityEnclosingRequest ;
40
39
*
41
40
* @author Boris Kuzmic ([email protected] )
42
41
* @since 0.0.8
43
- * @todo #266:30min Add tests for ArrayPayloadOf.
44
42
*/
45
- final class ArrayPayloadOf implements Iterator <JsonObject > {
43
+ public final class ArrayPayloadOf implements Iterator <JsonObject > {
46
44
47
45
/**
48
46
* List of JsonObjects.
@@ -55,10 +53,9 @@ final class ArrayPayloadOf implements Iterator<JsonObject> {
55
53
* @param request The http request
56
54
* @throws IllegalStateException if the request's payload cannot be read
57
55
*/
58
- ArrayPayloadOf (final HttpRequest request ) {
56
+ public ArrayPayloadOf (final HttpRequest request ) {
59
57
try (JsonReader reader = Json .createReader (
60
58
((HttpEntityEnclosingRequest ) request ).getEntity ().getContent ())) {
61
- final JsonArray body ;
62
59
if (request instanceof HttpEntityEnclosingRequest ) {
63
60
this .resources =
64
61
reader .readArray ().getValuesAs (JsonObject .class ).iterator ();
0 commit comments