@Test(expected = ProcessEngineException.class) public void getNonExistingScriptEngine() throws InvalidSyntaxException { BundleContext context = mock(BundleContext.class); when(context.getServiceReferences(anyString(), isNull(String.class))).thenReturn(null); ScriptBindingsFactory bindingsFactory = mock(ScriptBindingsFactory.class); TestOsgiScriptingEngines scriptingEngines = new TestOsgiScriptingEngines(bindingsFactory); scriptingEngines.ctx = context; ScriptEngine engine = scriptingEngines.getScriptEngineForLanguage("Pythin"); assertThat(engine, is(nullValue())); }
@Override public ScriptEngine getScriptEngineForLanguage(String language) { ScriptEngine scriptEngine = null; try { scriptEngine = resolveScriptEngine(language); } catch (InvalidSyntaxException e) { throw new ProcessEngineException( "problem resolving scripting engine" + e.getMessage(), e); } if (scriptEngine == null) { throw new ProcessEngineException( "Can't find scripting engine for '" + language + "'"); } return scriptEngine; }
OsgiScriptingEngines extends ScriptingEngines { @Override public ScriptEngine getScriptEngineForLanguage(String language) { ScriptEngine scriptEngine = null; try { scriptEngine = resolveScriptEngine(language); } catch (InvalidSyntaxException e) { throw new ProcessEngineException( "problem resolving scripting engine" + e.getMessage(), e); } if (scriptEngine == null) { throw new ProcessEngineException( "Can't find scripting engine for '" + language + "'"); } return scriptEngine; } }
OsgiScriptingEngines extends ScriptingEngines { @Override public ScriptEngine getScriptEngineForLanguage(String language) { ScriptEngine scriptEngine = null; try { scriptEngine = resolveScriptEngine(language); } catch (InvalidSyntaxException e) { throw new ProcessEngineException( "problem resolving scripting engine" + e.getMessage(), e); } if (scriptEngine == null) { throw new ProcessEngineException( "Can't find scripting engine for '" + language + "'"); } return scriptEngine; } OsgiScriptingEngines(ScriptBindingsFactory scriptBindingsFactory); }
OsgiScriptingEngines extends ScriptingEngines { @Override public ScriptEngine getScriptEngineForLanguage(String language) { ScriptEngine scriptEngine = null; try { scriptEngine = resolveScriptEngine(language); } catch (InvalidSyntaxException e) { throw new ProcessEngineException( "problem resolving scripting engine" + e.getMessage(), e); } if (scriptEngine == null) { throw new ProcessEngineException( "Can't find scripting engine for '" + language + "'"); } return scriptEngine; } OsgiScriptingEngines(ScriptBindingsFactory scriptBindingsFactory); @Override ScriptEngine getScriptEngineForLanguage(String language); }
OsgiScriptingEngines extends ScriptingEngines { @Override public ScriptEngine getScriptEngineForLanguage(String language) { ScriptEngine scriptEngine = null; try { scriptEngine = resolveScriptEngine(language); } catch (InvalidSyntaxException e) { throw new ProcessEngineException( "problem resolving scripting engine" + e.getMessage(), e); } if (scriptEngine == null) { throw new ProcessEngineException( "Can't find scripting engine for '" + language + "'"); } return scriptEngine; } OsgiScriptingEngines(ScriptBindingsFactory scriptBindingsFactory); @Override ScriptEngine getScriptEngineForLanguage(String language);  }