@@ -129,72 +129,21 @@ static ArgumentSet argumentSet(String name, @Nullable Object... arguments) {
129129 return new ArgumentSet (name , arguments );
130130 }
131131
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-
179132 /**
180133 * Factory method for creating an instance of {@code Arguments} based on
181134 * the supplied {@code arguments} as a {@link List}.
182135 *
183136 * @param arguments the arguments as a List to be used for an invocation
184137 * of the test method; must not be {@code null} but may contain {@code null}
185138 * @return an instance of {@code Arguments}; never {@code null}
139+ * @since 6.0
186140 * @see #arguments(List)
187141 */
188142 @ 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+
198147 }
199148
200149 /**
@@ -212,8 +161,8 @@ static Arguments of(@Nullable List<@Nullable Object> arguments) {
212161 * @see #argumentSet(String, Object...)
213162 */
214163 @ 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 );
217166 }
218167
219168 /**
@@ -227,10 +176,10 @@ static Arguments arguments(List<@Nullable Object> arguments) {
227176 * @since 6.0
228177 */
229178 @ 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 ) {
231180 Preconditions .notBlank (name , "name must not be null or blank" );
232181 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 ());
234183 }
235184
236185 /**
@@ -244,4 +193,50 @@ static ArgumentSet argumentSet(String name, List<@Nullable Object> arguments) {
244193 return new ArrayList <>(Arrays .asList (get ()));
245194 }
246195
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+ }
247242}
0 commit comments