diff --git a/qa/evil-tests/src/test/java/org/elasticsearch/common/cli/CliToolTests.java b/qa/evil-tests/src/test/java/org/elasticsearch/common/cli/CliToolTests.java index 988ad8d7e7f..92ab945dfca 100644 --- a/qa/evil-tests/src/test/java/org/elasticsearch/common/cli/CliToolTests.java +++ b/qa/evil-tests/src/test/java/org/elasticsearch/common/cli/CliToolTests.java @@ -118,7 +118,7 @@ public class CliToolTests extends CliToolTestCase { Terminal terminal = new MockTerminal(); int count = randomIntBetween(2, 7); List> executed = new ArrayList<>(count); - for (int i = 0; i < executed.size(); i++) { + for (int i = 0; i < count; i++) { executed.add(new AtomicReference<>(false)); } NamedCommand[] cmds = new NamedCommand[count]; @@ -136,7 +136,7 @@ public class CliToolTests extends CliToolTestCase { int cmdIndex = randomIntBetween(0, count-1); CliTool.ExitStatus status = tool.execute("cmd" + cmdIndex); assertThat(status, is(OK)); - for (int i = 0; i < executed.size(); i++) { + for (int i = 0; i < count; i++) { assertThat(executed.get(i).get(), is(i == cmdIndex)); } } @@ -145,7 +145,7 @@ public class CliToolTests extends CliToolTestCase { Terminal terminal = new MockTerminal(); int count = randomIntBetween(2, 7); List> executed = new ArrayList<>(count); - for (int i = 0; i < executed.size(); i++) { + for (int i = 0; i < count; i++) { executed.add(new AtomicReference<>(false)); } NamedCommand[] cmds = new NamedCommand[count]; @@ -162,7 +162,7 @@ public class CliToolTests extends CliToolTestCase { MultiCmdTool tool = new MultiCmdTool("tool", terminal, cmds); CliTool.ExitStatus status = tool.execute("cmd" + count); // "cmd" + count doesn't exist assertThat(status, is(CliTool.ExitStatus.USAGE)); - for (int i = 0; i < executed.size(); i++) { + for (int i = 0; i < count; i++) { assertThat(executed.get(i).get(), is(false)); } }