@Test public void testCompile() throws Exception { final File scriptFile = mock(File.class); final CclExecutor executor = mock(CclExecutor.class); final ScriptCompilerAdder<?> adder = mock(ScriptCompilerAdder.class); when(executor.addScriptCompiler(scriptFile)).thenReturn(adder); mockStatic(CclExecutor.class); when(CclExecutor.getExecutor()).thenReturn(executor); final TranslatorCompiler injected = new TranslatorCompiler() { @Override File copyTranslatorScript() { return scriptFile; } }; injected.compile(); verify(adder).commit(); verify(executor).execute(); }
public void compile() { final File tempFile = copyTranslatorScript(); final CclExecutor executor = CclExecutor.getExecutor(); executor.addScriptCompiler(tempFile).commit(); executor.execute(); if (!tempFile.delete()) { System.out.println("failed to delete " + tempFile); } }
TranslatorCompiler { public void compile() { final File tempFile = copyTranslatorScript(); final CclExecutor executor = CclExecutor.getExecutor(); executor.addScriptCompiler(tempFile).commit(); executor.execute(); if (!tempFile.delete()) { System.out.println("failed to delete " + tempFile); } } }
TranslatorCompiler { public void compile() { final File tempFile = copyTranslatorScript(); final CclExecutor executor = CclExecutor.getExecutor(); executor.addScriptCompiler(tempFile).commit(); executor.execute(); if (!tempFile.delete()) { System.out.println("failed to delete " + tempFile); } }  }
TranslatorCompiler { public void compile() { final File tempFile = copyTranslatorScript(); final CclExecutor executor = CclExecutor.getExecutor(); executor.addScriptCompiler(tempFile).commit(); executor.execute(); if (!tempFile.delete()) { System.out.println("failed to delete " + tempFile); } }  void compile(); }
TranslatorCompiler { public void compile() { final File tempFile = copyTranslatorScript(); final CclExecutor executor = CclExecutor.getExecutor(); executor.addScriptCompiler(tempFile).commit(); executor.execute(); if (!tempFile.delete()) { System.out.println("failed to delete " + tempFile); } }  void compile();  }