Slight refactor of helper methods in TestStrategy.
RELNOTES: None
@@ -215,11 +215,19 @@ public abstract class TestStrategy implements TestActionContext {
*/
@VisibleForTesting /* protected */
public int getTestAttempts(TestRunnerAction action) {
- if (executionOptions.testAttempts == -1) {
- return action.getTestProperties().isFlaky() ? 3 : 1;
- } else {
- return executionOptions.testAttempts;
+ return action.getTestProperties().isFlaky()
+ ? getTestAttemptsForFlakyTest()
+ : getTestAttempts(/*defaultTestAttempts=*/ 1);
+ }
+
+ public int getTestAttemptsForFlakyTest() {
+ return getTestAttempts(/*defaultTestAttempts=*/ 3);
}
+
+ private int getTestAttempts(int defaultTestAttempts) {
+ return executionOptions.testAttempts == -1
+ ? defaultTestAttempts
+ : executionOptions.testAttempts;
}
/**
