Fix tests I just broke

This commit is contained in:
Nik Everett 2016-01-19 18:27:52 -05:00
parent bd68af1dee
commit 3178d24bea

View File

@ -118,7 +118,7 @@ public class CliToolTests extends CliToolTestCase {
Terminal terminal = new MockTerminal(); Terminal terminal = new MockTerminal();
int count = randomIntBetween(2, 7); int count = randomIntBetween(2, 7);
List<AtomicReference<Boolean>> executed = new ArrayList<>(count); List<AtomicReference<Boolean>> executed = new ArrayList<>(count);
for (int i = 0; i < executed.size(); i++) { for (int i = 0; i < count; i++) {
executed.add(new AtomicReference<>(false)); executed.add(new AtomicReference<>(false));
} }
NamedCommand[] cmds = new NamedCommand[count]; NamedCommand[] cmds = new NamedCommand[count];
@ -136,7 +136,7 @@ public class CliToolTests extends CliToolTestCase {
int cmdIndex = randomIntBetween(0, count-1); int cmdIndex = randomIntBetween(0, count-1);
CliTool.ExitStatus status = tool.execute("cmd" + cmdIndex); CliTool.ExitStatus status = tool.execute("cmd" + cmdIndex);
assertThat(status, is(OK)); 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)); assertThat(executed.get(i).get(), is(i == cmdIndex));
} }
} }
@ -145,7 +145,7 @@ public class CliToolTests extends CliToolTestCase {
Terminal terminal = new MockTerminal(); Terminal terminal = new MockTerminal();
int count = randomIntBetween(2, 7); int count = randomIntBetween(2, 7);
List<AtomicReference<Boolean>> executed = new ArrayList<>(count); List<AtomicReference<Boolean>> executed = new ArrayList<>(count);
for (int i = 0; i < executed.size(); i++) { for (int i = 0; i < count; i++) {
executed.add(new AtomicReference<>(false)); executed.add(new AtomicReference<>(false));
} }
NamedCommand[] cmds = new NamedCommand[count]; NamedCommand[] cmds = new NamedCommand[count];
@ -162,7 +162,7 @@ public class CliToolTests extends CliToolTestCase {
MultiCmdTool tool = new MultiCmdTool("tool", terminal, cmds); MultiCmdTool tool = new MultiCmdTool("tool", terminal, cmds);
CliTool.ExitStatus status = tool.execute("cmd" + count); // "cmd" + count doesn't exist CliTool.ExitStatus status = tool.execute("cmd" + count); // "cmd" + count doesn't exist
assertThat(status, is(CliTool.ExitStatus.USAGE)); 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)); assertThat(executed.get(i).get(), is(false));
} }
} }