### Question:
CommandQueue { public void execute(final CclCommandTerminal cclTerminal) { if (isEmpty()) return; try { for (final AbstractCclCommand command : getOnCclStartCommands()) command.run(cclTerminal); for (final AbstractCclCommand command : getInCclSessionCommands()) command.run(cclTerminal); } finally { for (final AbstractCclCommand command : getOnCclCloseCommands()) command.run(cclTerminal); } }  CommandQueue addInCclSessionCommand(final AbstractCclCommand command); CommandQueue addOnCclCloseCommand(final AbstractCclCommand command); CommandQueue addOnCclStartCommand(final AbstractCclCommand command); void execute(final CclCommandTerminal cclTerminal); Collection<? extends AbstractCclCommand> getInCclSessionCommands(); Collection<? extends AbstractCclCommand> getOnCclCloseCommands(); Collection<? extends AbstractCclCommand> getOnCclStartCommands(); boolean isEmpty();  }### Answer:
@Test public void testExecute() { final AbstractCclCommand onStartCommand = mock(AbstractCclCommand.class); final AbstractCclCommand inSessionCommand = mock(AbstractCclCommand.class); final AbstractCclCommand onCloseCommand = mock(AbstractCclCommand.class); final CclCommandTerminal terminal = mock(CclCommandTerminal.class); queue.addInCclSessionCommand(inSessionCommand).addOnCclCloseCommand(onCloseCommand) .addOnCclStartCommand(onStartCommand).execute(terminal); verify(onStartCommand).run(terminal); verify(inSessionCommand).run(terminal); verify(onCloseCommand).run(terminal); }