11package com .nordstrom .automation .junit ;
22
3- import java .util .Collections ;
4- import java .util .HashMap ;
53import java .util .Map ;
64import java .util .Optional ;
75
86import org .junit .runner .Description ;
97
8+ import com .nordstrom .common .params .Params ;
9+
1010/**
1111 * This interface enables implementers to provide method-related parameters to the artifact capture framework.
1212 */
13- public interface ArtifactParams {
13+ public interface ArtifactParams extends Params {
1414
1515 /**
1616 * Get the JUnit method description object for the current test class instance.
@@ -19,30 +19,14 @@ public interface ArtifactParams {
1919 */
2020 Description getDescription ();
2121
22- /**
23- * Get the parameters associated with this test class instance.
24- *
25- * @return optional map of named test class parameters
26- */
27- default Optional <Map <String , Object >> getParameters () {
28- return Optional .empty ();
29- }
30-
3122 /**
3223 * Assemble a map of test class instance parameters.
3324 *
3425 * @param params array of {@link Param} objects; may be {@code null} or empty
3526 * @return optional map of parameters (may be empty)
3627 */
3728 public static Optional <Map <String , Object >> mapOf (Param ... params ) {
38- if ((params == null ) || (params .length == 0 )) {
39- return Optional .empty ();
40- }
41- Map <String , Object > paramMap = new HashMap <>();
42- for (Param param : params ) {
43- paramMap .put (param .key , param .val );
44- }
45- return Optional .of (Collections .unmodifiableMap (paramMap ));
29+ return Params .mapOf (params );
4630 }
4731
4832 /**
@@ -53,30 +37,6 @@ public static Optional<Map<String, Object>> mapOf(Param... params) {
5337 * @return test parameter object
5438 */
5539 public static Param param (String key , Object val ) {
56- return new Param (key , val );
40+ return Params . param (key , val );
5741 }
58-
59- /**
60- * This class defines a test parameter object.
61- */
62- static class Param {
63-
64- private final String key ;
65- private final Object val ;
66-
67- /**
68- * Constructor for test parameter object.
69- *
70- * @param key test parameter key
71- * @param val test parameter value
72- */
73- public Param (String key , Object val ) {
74- if ((key == null ) || key .isEmpty ()) {
75- throw new IllegalArgumentException ("[key] must be a non-empty string" );
76- }
77- this .key = key ;
78- this .val = val ;
79- }
80- }
81-
8242}
0 commit comments