### Question:
BaseCclExecutor extends CclExecutor { @Override public void execute() { if (getCommandQueue().isEmpty()) return; final CclCommandTerminal cclTerminal = new CclCommandTerminal(terminalProperties, outputStreamConfiguration); getCommandQueue().execute(cclTerminal); } BaseCclExecutor();  BaseCclExecutor(final TerminalProperties terminalProperties, final CommandQueue commandQueue); @Override DynamicCompilerAdderImpl addDynamicCompiler(final File includeFile); @Override ScriptCompilerAdderImpl addScriptCompiler(final File file); @Override ScriptDropAdder addScriptDropper(final String scriptName); @Override ScriptExecutionAdder addScriptExecution(final String scriptName); @Override void execute(); @Override void setOutputStream(final OutputStream stream, final OutputType outputType); @Override void setTerminalProperties(final TerminalProperties terminalProperties);  }### Answer:
@Test public void testExecute() throws Exception { final CclCommandTerminal terminal = mock(CclCommandTerminal.class); whenNew(CclCommandTerminal.class).withAnyArguments().thenReturn(terminal); final ScriptExecutionCommand scriptExecutionCommandA0 = mock(ScriptExecutionCommand.class); final ScriptExecutionCommand scriptExecutionCommandA1 = mock(ScriptExecutionCommand.class); final ScriptExecutionCommand scriptExecutionCommandA2 = mock(ScriptExecutionCommand.class); final ScriptExecutionCommand scriptExecutionCommandB0 = mock(ScriptExecutionCommand.class); final ScriptExecutionCommand scriptExecutionCommandB1 = mock(ScriptExecutionCommand.class); final ScriptExecutionCommand scriptExecutionCommandB2 = mock(ScriptExecutionCommand.class); final ScriptExecutionCommand scriptExecutionCommandC0 = mock(ScriptExecutionCommand.class); final ScriptExecutionCommand scriptExecutionCommandC1 = mock(ScriptExecutionCommand.class); final ScriptExecutionCommand scriptExecutionCommandC2 = mock(ScriptExecutionCommand.class); final CommandQueue commandQueue = new CommandQueue(); commandQueue.addOnCclStartCommand(scriptExecutionCommandA0).addOnCclStartCommand(scriptExecutionCommandA1) .addOnCclStartCommand(scriptExecutionCommandA2); commandQueue.addInCclSessionCommand(scriptExecutionCommandB0).addInCclSessionCommand(scriptExecutionCommandB1) .addInCclSessionCommand(scriptExecutionCommandB2); commandQueue.addOnCclCloseCommand(scriptExecutionCommandC0).addOnCclCloseCommand(scriptExecutionCommandC1) .addOnCclCloseCommand(scriptExecutionCommandC2); new BaseCclExecutor(null, commandQueue).execute(); verify(scriptExecutionCommandA0).run(terminal); verify(scriptExecutionCommandA1).run(terminal); verify(scriptExecutionCommandA2).run(terminal); verify(scriptExecutionCommandB0).run(terminal); verify(scriptExecutionCommandB1).run(terminal); verify(scriptExecutionCommandB2).run(terminal); verify(scriptExecutionCommandC0).run(terminal); verify(scriptExecutionCommandC1).run(terminal); verify(scriptExecutionCommandC2).run(terminal); final ArgumentCaptor<OutputStreamConfiguration> oscCaptor = ArgumentCaptor .forClass(OutputStreamConfiguration.class); final ArgumentCaptor<TerminalProperties> tpCaptor = ArgumentCaptor.forClass(TerminalProperties.class); PowerMockito.verifyNew(CclCommandTerminal.class).withArguments(tpCaptor.capture(), oscCaptor.capture()); assertThat(tpCaptor.getAllValues().get(0)).isEqualTo(basicTerminalProperties); assertThat(oscCaptor.getAllValues().get(0)).isEqualTo(null); }
@Test public void testExecuteEmptyQueue() { when(queue.isEmpty()).thenReturn(Boolean.TRUE); executor.execute(); verify(queue, never()).execute(any(CclCommandTerminal.class)); }