@@ -40,62 +40,64 @@ See [`JsonArgumentsProviderTest`](https://github.com/joshka/junit-json-params/bl
40
40
``` java
41
41
import net.joshka.junit.json.params.JsonSource ;
42
42
43
- /**
44
- * When passed <code >{"key":"value"}</code>, is executed a single time
45
- * @param object the parsed JsonObject
46
- */
47
- @ParameterizedTest
48
- @JsonSource (" {\" key\" :\" value\" }" )
49
- @DisplayName (" provides a single object" )
50
- void singleObject(JsonObject object) {
51
- assertThat(object. getString(" key" )). isEqualTo(" value" );
52
- }
53
-
54
- /**
55
- * When passed <code >[{"key":"value1"},{"key","value2"}]</code>, is
56
- * executed once per element of the array
57
- * @param object the parsed JsonObject array element
58
- */
59
- @ParameterizedTest
60
- @JsonSource (" [{\" key\" :\" value1\" },{\" key\" :\" value2\" }]" )
61
- @DisplayName (" provides an array of objects" )
62
- void arrayOfObjects(JsonObject object) {
63
- assertThat(object. getString(" key" )). startsWith(" value" );
64
- }
65
-
66
- /**
67
- * When passed <code >[1, 2]</code>, is executed once per array element
68
- * @param number the parsed JsonNumber for each array element
69
- */
70
- @ParameterizedTest
71
- @JsonSource (" [1,2]" )
72
- @DisplayName (" provides an array of numbers" )
73
- void arrayOfNumbers(JsonNumber number) {
74
- assertThat(number. intValue()). isGreaterThan(0 );
75
- }
76
-
77
- /**
78
- * When passed <code >["value1","value2"]</code>, is executed once per array
79
- * element
80
- * @param string the parsed JsonString for each array element
81
- */
82
- @ParameterizedTest
83
- @JsonSource (" [\" value1\" ,\" value2\" ]" )
84
- @DisplayName (" provides an array of strings" )
85
- void arrayOfStrings(JsonString string) {
86
- assertThat(string. getString()). startsWith(" value" );
87
- }
88
-
89
- /**
90
- * When passed <code >{'key':'value'}</code>, is executed a single time.
91
- * This simplifies writing inline JSON strings
92
- * @param object the parsed JsonObject
93
- */
94
- @ParameterizedTest
95
- @JsonSource (" {'key':'value'}" )
96
- @DisplayName (" handles simplified json" )
97
- void simplifiedJson(JsonObject object) {
98
- assertThat(object. getString(" key" )). isEqualTo(" value" );
43
+ class JsonArgumentsProviderTest {
44
+ /**
45
+ * When passed <code >{"key":"value"}</code>, is executed a single time
46
+ * @param object the parsed JsonObject
47
+ */
48
+ @ParameterizedTest
49
+ @JsonSource (" {\" key\" :\" value\" }" )
50
+ @DisplayName (" provides a single object" )
51
+ void singleObject (JsonObject object ) {
52
+ assertThat(object. getString(" key" )). isEqualTo(" value" );
53
+ }
54
+
55
+ /**
56
+ * When passed <code >[{"key":"value1"},{"key","value2"}]</code>, is
57
+ * executed once per element of the array
58
+ * @param object the parsed JsonObject array element
59
+ */
60
+ @ParameterizedTest
61
+ @JsonSource (" [{\" key\" :\" value1\" },{\" key\" :\" value2\" }]" )
62
+ @DisplayName (" provides an array of objects" )
63
+ void arrayOfObjects (JsonObject object ) {
64
+ assertThat(object. getString(" key" )). startsWith(" value" );
65
+ }
66
+
67
+ /**
68
+ * When passed <code >[1, 2]</code>, is executed once per array element
69
+ * @param number the parsed JsonNumber for each array element
70
+ */
71
+ @ParameterizedTest
72
+ @JsonSource (" [1,2]" )
73
+ @DisplayName (" provides an array of numbers" )
74
+ void arrayOfNumbers (JsonNumber number ) {
75
+ assertThat(number. intValue()). isGreaterThan(0 );
76
+ }
77
+
78
+ /**
79
+ * When passed <code >["value1","value2"]</code>, is executed once per array
80
+ * element
81
+ * @param string the parsed JsonString for each array element
82
+ */
83
+ @ParameterizedTest
84
+ @JsonSource (" [\" value1\" ,\" value2\" ]" )
85
+ @DisplayName (" provides an array of strings" )
86
+ void arrayOfStrings (JsonString string ) {
87
+ assertThat(string. getString()). startsWith(" value" );
88
+ }
89
+
90
+ /**
91
+ * When passed <code >{'key':'value'}</code>, is executed a single time.
92
+ * This simplifies writing inline JSON strings
93
+ * @param object the parsed JsonObject
94
+ */
95
+ @ParameterizedTest
96
+ @JsonSource (" {'key':'value'}" )
97
+ @DisplayName (" handles simplified json" )
98
+ void simplifiedJson (JsonObject object ) {
99
+ assertThat(object. getString(" key" )). isEqualTo(" value" );
100
+ }
99
101
}
100
102
```
101
103
@@ -108,50 +110,52 @@ See [`JsonFileArgumentsProviderTest`](https://github.com/joshka/junit-json-param
108
110
``` java
109
111
import net.joshka.junit.json.params.JsonFileSource ;
110
112
111
- /**
112
- * When passed <code >{"key":"value"}</code>, is executed a single time
113
- * @param object the parsed JsonObject
114
- */
115
- @ParameterizedTest
116
- @JsonFileSource (resources = " /single-object.json" )
117
- @DisplayName (" provides a single object" )
118
- void singleObject(JsonObject object) {
119
- assertThat(object. getString(" key" )). isEqualTo(" value" );
120
- }
121
-
122
- /**
123
- * When passed <code >[{"key":"value1"},{"key","value2"}]</code>, is
124
- * executed once per element of the array
125
- * @param object the parsed JsonObject array element
126
- */
127
- @ParameterizedTest
128
- @JsonFileSource (resources = " /array-of-objects.json" )
129
- @DisplayName (" provides an array of objects" )
130
- void arrayOfObjects(JsonObject object) {
131
- assertThat(object. getString(" key" )). startsWith(" value" );
132
- }
133
-
134
- /**
135
- * When passed <code >[1, 2]</code>, is executed once per array element
136
- * @param number the parsed JsonNumber for each array element
137
- */
138
- @ParameterizedTest
139
- @JsonFileSource (resources = " /array-of-numbers.json" )
140
- @DisplayName (" provides an array of numbers" )
141
- void arrayOfNumbers(JsonNumber number) {
142
- assertThat(number. intValue()). isGreaterThan(0 );
143
- }
144
-
145
- /**
146
- * When passed <code >["value1","value2"]</code>, is executed once per array
147
- * element
148
- * @param string the parsed JsonString for each array element
149
- */
150
- @ParameterizedTest
151
- @JsonFileSource (resources = " /array-of-strings.json" )
152
- @DisplayName (" provides an array of strings" )
153
- void arrayOfStrings(JsonString string) {
154
- assertThat(string. getString()). startsWith(" value" );
113
+ class JsonFileArgumentsProviderTest {
114
+ /**
115
+ * When passed <code >{"key":"value"}</code>, is executed a single time
116
+ * @param object the parsed JsonObject
117
+ */
118
+ @ParameterizedTest
119
+ @JsonFileSource (resources = " /single-object.json" )
120
+ @DisplayName (" provides a single object" )
121
+ void singleObject (JsonObject object ) {
122
+ assertThat(object. getString(" key" )). isEqualTo(" value" );
123
+ }
124
+
125
+ /**
126
+ * When passed <code >[{"key":"value1"},{"key","value2"}]</code>, is
127
+ * executed once per element of the array
128
+ * @param object the parsed JsonObject array element
129
+ */
130
+ @ParameterizedTest
131
+ @JsonFileSource (resources = " /array-of-objects.json" )
132
+ @DisplayName (" provides an array of objects" )
133
+ void arrayOfObjects (JsonObject object ) {
134
+ assertThat(object. getString(" key" )). startsWith(" value" );
135
+ }
136
+
137
+ /**
138
+ * When passed <code >[1, 2]</code>, is executed once per array element
139
+ * @param number the parsed JsonNumber for each array element
140
+ */
141
+ @ParameterizedTest
142
+ @JsonFileSource (resources = " /array-of-numbers.json" )
143
+ @DisplayName (" provides an array of numbers" )
144
+ void arrayOfNumbers (JsonNumber number ) {
145
+ assertThat(number. intValue()). isGreaterThan(0 );
146
+ }
147
+
148
+ /**
149
+ * When passed <code >["value1","value2"]</code>, is executed once per array
150
+ * element
151
+ * @param string the parsed JsonString for each array element
152
+ */
153
+ @ParameterizedTest
154
+ @JsonFileSource (resources = " /array-of-strings.json" )
155
+ @DisplayName (" provides an array of strings" )
156
+ void arrayOfStrings (JsonString string ) {
157
+ assertThat(string. getString()). startsWith(" value" );
158
+ }
155
159
}
156
160
```
157
161
0 commit comments