@@ -129,72 +129,21 @@ static ArgumentSet argumentSet(String name, @Nullable Object... arguments) {
129
129
return new ArgumentSet (name , arguments );
130
130
}
131
131
132
- /**
133
- * Specialization of {@link Arguments} that associates a {@link #getName() name}
134
- * with a set of {@link #get() arguments}.
135
- *
136
- * @since 5.11
137
- * @see Arguments#argumentSet(String, Object...)
138
- * @see org.junit.jupiter.params.ParameterizedTest#ARGUMENT_SET_NAME_PLACEHOLDER
139
- * @see org.junit.jupiter.params.ParameterizedTest#ARGUMENT_SET_NAME_OR_ARGUMENTS_WITH_NAMES_PLACEHOLDER
140
- */
141
- @ API (status = EXPERIMENTAL , since = "5.11" )
142
- final class ArgumentSet implements Arguments {
143
-
144
- private final String name ;
145
-
146
- private final @ Nullable Object [] arguments ;
147
-
148
- private ArgumentSet (String name , @ Nullable Object [] arguments ) {
149
- Preconditions .notBlank (name , "name must not be null or blank" );
150
- Preconditions .notNull (arguments , "arguments array must not be null" );
151
- this .name = name ;
152
- this .arguments = arguments ;
153
- }
154
-
155
- /**
156
- * Get the name of this {@code ArgumentSet}.
157
- * @return the name of this {@code ArgumentSet}; never {@code null} or blank
158
- */
159
- public String getName () {
160
- return this .name ;
161
- }
162
-
163
- @ Override
164
- public @ Nullable Object [] get () {
165
- return this .arguments ;
166
- }
167
-
168
- /**
169
- * Return the {@link #getName() name} of this {@code ArgumentSet}.
170
- * @return the name of this {@code ArgumentSet}
171
- */
172
- @ Override
173
- public String toString () {
174
- return getName ();
175
- }
176
-
177
- }
178
-
179
132
/**
180
133
* Factory method for creating an instance of {@code Arguments} based on
181
134
* the supplied {@code arguments} as a {@link List}.
182
135
*
183
136
* @param arguments the arguments as a List to be used for an invocation
184
137
* of the test method; must not be {@code null} but may contain {@code null}
185
138
* @return an instance of {@code Arguments}; never {@code null}
139
+ * @since 6.0
186
140
* @see #arguments(List)
187
141
*/
188
142
@ API (status = EXPERIMENTAL , since = "6.0" )
189
- static Arguments of (@ Nullable List <@ Nullable Object > arguments ) {
190
- if (arguments == null ) {
191
- return of ((Object ) null ); // Properly wrap null
192
- }
193
- if (arguments .isEmpty ()) {
194
- // Must still return empty arguments array
195
- return of (new Object [0 ]);
196
- }
197
- return () -> arguments .toArray (new Object [0 ]);
143
+ static Arguments from (List <@ Nullable Object > arguments ) {
144
+ Preconditions .notNull (arguments , "arguments must not be null" );
145
+ return of (arguments .toArray ());
146
+
198
147
}
199
148
200
149
/**
@@ -212,8 +161,8 @@ static Arguments of(@Nullable List<@Nullable Object> arguments) {
212
161
* @see #argumentSet(String, Object...)
213
162
*/
214
163
@ API (status = EXPERIMENTAL , since = "6.0" )
215
- static Arguments arguments (List <@ Nullable Object > arguments ) {
216
- return of (arguments );
164
+ static Arguments argumentsFrom (List <@ Nullable Object > arguments ) {
165
+ return from (arguments );
217
166
}
218
167
219
168
/**
@@ -227,10 +176,10 @@ static Arguments arguments(List<@Nullable Object> arguments) {
227
176
* @since 6.0
228
177
*/
229
178
@ API (status = EXPERIMENTAL , since = "6.0" )
230
- static ArgumentSet argumentSet (String name , List <@ Nullable Object > arguments ) {
179
+ static ArgumentSet argumentSetFrom (String name , List <@ Nullable Object > arguments ) {
231
180
Preconditions .notBlank (name , "name must not be null or blank" );
232
181
Preconditions .notNull (arguments , "arguments list must not be null" );
233
- return new ArgumentSet (name , arguments .toArray (new Object [ 0 ] ));
182
+ return new ArgumentSet (name , arguments .toArray ());
234
183
}
235
184
236
185
/**
@@ -244,4 +193,50 @@ static ArgumentSet argumentSet(String name, List<@Nullable Object> arguments) {
244
193
return new ArrayList <>(Arrays .asList (get ()));
245
194
}
246
195
196
+ /**
197
+ * Specialization of {@link Arguments} that associates a {@link #getName() name}
198
+ * with a set of {@link #get() arguments}.
199
+ *
200
+ * @since 5.11
201
+ * @see Arguments#argumentSet(String, Object...)
202
+ * @see org.junit.jupiter.params.ParameterizedTest#ARGUMENT_SET_NAME_PLACEHOLDER
203
+ * @see org.junit.jupiter.params.ParameterizedTest#ARGUMENT_SET_NAME_OR_ARGUMENTS_WITH_NAMES_PLACEHOLDER
204
+ */
205
+ @ API (status = EXPERIMENTAL , since = "5.11" )
206
+ final class ArgumentSet implements Arguments {
207
+
208
+ private final String name ;
209
+
210
+ private final @ Nullable Object [] arguments ;
211
+
212
+ private ArgumentSet (String name , @ Nullable Object [] arguments ) {
213
+ Preconditions .notBlank (name , "name must not be null or blank" );
214
+ Preconditions .notNull (arguments , "arguments array must not be null" );
215
+ this .name = name ;
216
+ this .arguments = arguments ;
217
+ }
218
+
219
+ /**
220
+ * Get the name of this {@code ArgumentSet}.
221
+ * @return the name of this {@code ArgumentSet}; never {@code null} or blank
222
+ */
223
+ public String getName () {
224
+ return this .name ;
225
+ }
226
+
227
+ @ Override
228
+ public @ Nullable Object [] get () {
229
+ return this .arguments ;
230
+ }
231
+
232
+ /**
233
+ * Return the {@link #getName() name} of this {@code ArgumentSet}.
234
+ * @return the name of this {@code ArgumentSet}
235
+ */
236
+ @ Override
237
+ public String toString () {
238
+ return getName ();
239
+ }
240
+
241
+ }
247
242
}
0 commit comments