### Question:
BaseCclExecutor extends CclExecutor { @Override public DynamicCompilerAdderImpl addDynamicCompiler(final File includeFile) { if (includeFile == null) throw new NullPointerException("File cannot be null."); if (!includeFile.isFile()) throw new IllegalArgumentException("Given file pointer is not actually a file."); return new DynamicCompilerAdderImpl(includeFile, getCommandQueue()); } 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 testAddDynamicCompiler() throws Exception { final File file = mock(File.class); when(file.isFile()).thenReturn(true); final DynamicCompilerAdderImpl adder = mock(DynamicCompilerAdderImpl.class); whenNew(DynamicCompilerAdderImpl.class).withArguments(file, queue).thenReturn(adder); final DynamicCompilerAdderImpl returnedAdder = executor.addDynamicCompiler(file); assertThat(returnedAdder).isNotNull(); assertThat(returnedAdder).isEqualTo(adder); }
@SuppressWarnings("unused") @Test public void testAddDynamicCompilerNotFile() throws Exception { final File file = mock(File.class); when(file.isFile()).thenReturn(false); final DynamicCompilerAdderImpl adder = mock(DynamicCompilerAdderImpl.class); whenNew(DynamicCompilerAdderImpl.class).withArguments(file, queue).thenReturn(adder); IllegalArgumentException e = assertThrows(IllegalArgumentException.class, () -> { final DynamicCompilerAdderImpl returnedAdder = executor.addDynamicCompiler(file); }); assertThat(e.getMessage()).isEqualTo("Given file pointer is not actually a file."); }
@Test public void testAddDynamicCompilerNullFile() { NullPointerException e = assertThrows(NullPointerException.class, () -> { executor.addDynamicCompiler(null); }); assertThat(e.getMessage()).isEqualTo("File cannot be null."); }