@Test
public void testJavaExecutorReleasedAfterSuccessExecution() {

    final JavaExecutor javaExecutor = mock(JavaExecutor.class);
    JavaExecutionCachedEngine engine = new JavaExecutionCachedEngine() {
        public JavaExecutor allocateExecutor(Set<String> dependencies) {
            return javaExecutor;
        }
    };
    engine.execute("", "", "", null);
    verify(javaExecutor).release();
}