@Test public void testCommit() throws Exception { final File dependencyFile = mock(File.class); final File listingFile = mock(File.class); final ScriptCompilerCommand command = mock(ScriptCompilerCommand.class); final File sourceCodeFile = mock(File.class); when(sourceCodeFile.getName()).thenReturn("a_script.prg"); mockStatic(FileUtils.class); when(FileUtils.readFileToString(sourceCodeFile, Charset.forName("utf-8"))) .thenReturn("create program a_script"); whenNew(ScriptCompilerCommand.class) .withArguments(sourceCodeFile, Collections.singleton(dependencyFile), listingFile, Boolean.FALSE) .thenReturn(command); ScriptCompilerAdderImpl adder = new ScriptCompilerAdderImpl(sourceCodeFile, queue); adder.withDependency(dependencyFile).withListingOutput(listingFile).commit(); verify(queue).addInCclSessionCommand(command); }
@Override public void commit() { queue.addInCclSessionCommand( new ScriptCompilerCommand(sourceCodeFile, getDependencies(), getListingLocation(), doDebugCompile())); }
ScriptCompilerAdderImpl extends AbstractCompilerAdder implements ScriptCompilerAdder<ScriptCompilerAdderImpl> { @Override public void commit() { queue.addInCclSessionCommand( new ScriptCompilerCommand(sourceCodeFile, getDependencies(), getListingLocation(), doDebugCompile())); } }
ScriptCompilerAdderImpl extends AbstractCompilerAdder implements ScriptCompilerAdder<ScriptCompilerAdderImpl> { @Override public void commit() { queue.addInCclSessionCommand( new ScriptCompilerCommand(sourceCodeFile, getDependencies(), getListingLocation(), doDebugCompile())); } ScriptCompilerAdderImpl(final File sourceCodeFile, final CommandQueue queue); }
ScriptCompilerAdderImpl extends AbstractCompilerAdder implements ScriptCompilerAdder<ScriptCompilerAdderImpl> { @Override public void commit() { queue.addInCclSessionCommand( new ScriptCompilerCommand(sourceCodeFile, getDependencies(), getListingLocation(), doDebugCompile())); } ScriptCompilerAdderImpl(final File sourceCodeFile, final CommandQueue queue); @Override ScriptCompilerAdderImpl withDebugModeEnabled(final boolean debugModeEnabled); @Override ScriptCompilerAdderImpl withDependency(final File file); @Override ScriptCompilerAdderImpl withListingOutput(final File file); @Override void commit(); }
ScriptCompilerAdderImpl extends AbstractCompilerAdder implements ScriptCompilerAdder<ScriptCompilerAdderImpl> { @Override public void commit() { queue.addInCclSessionCommand( new ScriptCompilerCommand(sourceCodeFile, getDependencies(), getListingLocation(), doDebugCompile())); } ScriptCompilerAdderImpl(final File sourceCodeFile, final CommandQueue queue); @Override ScriptCompilerAdderImpl withDebugModeEnabled(final boolean debugModeEnabled); @Override ScriptCompilerAdderImpl withDependency(final File file); @Override ScriptCompilerAdderImpl withListingOutput(final File file); @Override void commit();  }