Skip to content

Commit 813232d

Browse files
authored
Add setting docs; deprecate RuleChainWalker (#92)
1 parent a134ef5 commit 813232d

File tree

2 files changed

+25
-8
lines changed

2 files changed

+25
-8
lines changed

src/main/java/com/nordstrom/automation/junit/JUnitConfig.java

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,28 @@ public class JUnitConfig extends SettingsCore<JUnitConfig.JUnitSettings> {
2424
* the {@code junit.properties} file and System property declarations.
2525
*/
2626
public enum JUnitSettings implements SettingsCore.SettingsAPI {
27-
/** name: <b>junit.rule.chain.list</b> <br> default: {@code rulesStartingWithInnerMost} */
28-
RULE_CHAIN_LIST("junit.rule.chain.list", "rulesStartingWithInnerMost"),
29-
/** name: <b>junit.timeout.test</b> <br> default: {@code null} */
27+
/**
28+
* Global per-test timeout interval in milliseconds.
29+
* <p>
30+
* name: <b>junit.timeout.test</b><br>
31+
* default: {@code null}
32+
*/
3033
TEST_TIMEOUT("junit.timeout.test", null),
31-
/** name: <b>junit.timeout.rule</b> <br> default: {@code null} */
34+
35+
/**
36+
* Global per-class timeout interval in milliseconds.
37+
* <p>
38+
* name: <b>junit.timeout.rule</b><br>
39+
* default: {@code null}
40+
*/
3241
TIMEOUT_RULE("junit.timeout.rule", null),
33-
/** name: <b>junit.max.retry</b> <br> default: <b>0</b> */
42+
43+
/**
44+
* Maximum retry attempts for failed test methods.
45+
* <p>
46+
* name: <b>junit.max.retry</b><br>
47+
* default: <b>0</b>
48+
*/
3449
MAX_RETRY("junit.max.retry", "0");
3550

3651
private String propertyName;

src/main/java/com/nordstrom/automation/junit/RuleChainWalker.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,16 @@
77
import org.junit.rules.TestRule;
88

99
import com.google.common.base.Optional;
10-
import com.nordstrom.automation.junit.JUnitConfig.JUnitSettings;
1110
import com.nordstrom.common.base.UncheckedThrow;
1211

1312
/**
1413
* This is a static utility class that uses reflection to access the list of {@link TestRule} objects inside a
1514
* {@link RuleChain}.
15+
*
16+
* @deprecated Use the <a href='https://junit.org/junit4/javadoc/4.13.1/org/junit/Rule.html#order()'>order</a>
17+
* parameter of the {@literal @}Rule annotation instead of {@link RuleChain}.
1618
*/
19+
@Deprecated
1720
public class RuleChainWalker {
1821

1922
private RuleChainWalker() {
@@ -48,8 +51,7 @@ public static <T extends TestRule> Optional<T> getAttachedRule(RuleChain ruleCha
4851
private static List<TestRule> getRuleList(RuleChain ruleChain) {
4952
Field ruleChainList;
5053
try {
51-
String fieldName = JUnitConfig.getConfig().getString(JUnitSettings.RULE_CHAIN_LIST.key());
52-
ruleChainList = RuleChain.class.getDeclaredField(fieldName);
54+
ruleChainList = RuleChain.class.getDeclaredField("rulesStartingWithInnerMost");
5355
ruleChainList.setAccessible(true);
5456
return (List<TestRule>) ruleChainList.get(ruleChain);
5557
} catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) {

0 commit comments

Comments
 (0)