Skip to content

Commit c963520

Browse files
authored
Merge pull request #37 from Nordstrom/pr/revise-javaagent-definition
Revise 'javaagent' definition; upgrade to latest Java Utils (1.8.0)
2 parents 36a834f + 7c0350c commit c963520

File tree

3 files changed

+12
-54
lines changed

3 files changed

+12
-54
lines changed

README.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -184,23 +184,21 @@ repositories {
184184
mavenCentral()
185185
...
186186
}
187-
configurations {
187+
dependencies {
188188
...
189-
junitAgent
189+
compile 'com.nordstrom.tools:junit-foundation:9.0.3'
190+
}
191+
ext {
192+
junitFoundation = configurations.compile.resolvedConfiguration.resolvedArtifacts.find { it.name == 'junit-foundation' }
190193
}
191194
test.doFirst {
192-
jvmArgs "-javaagent:${configurations.junitAgent.files.iterator().next()}"
195+
jvmArgs "-javaagent:${junitFoundation.file}"
193196
}
194197
test {
195198
// debug true
196199
// not required, but definitely useful
197200
testLogging.showStandardStreams = true
198201
}
199-
dependencies {
200-
...
201-
compile 'com.nordstrom.tools:junit-foundation:9.0.3'
202-
junitAgent 'com.nordstrom.tools:junit-foundation:9.0.3'
203-
}
204202
```
205203

206204
#### IDE Configuration for JUnit Foundation

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
3030
<maven.compiler.source>1.8</maven.compiler.source>
3131
<maven.compiler.target>1.8</maven.compiler.target>
32-
<java-utils.version>1.7.3</java-utils.version>
32+
<java-utils.version>1.8.0</java-utils.version>
3333
<surefire-plugin.version>2.22.0</surefire-plugin.version>
3434
<source-plugin.version>3.0.1</source-plugin.version>
3535
<javadoc-plugin.version>2.10.4</javadoc-plugin.version>
Lines changed: 5 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
package com.nordstrom.automation.junit;
22

3-
import java.util.Collections;
4-
import java.util.HashMap;
53
import java.util.Map;
64
import java.util.Optional;
75

86
import 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

Comments
 (0)