### Question:
ClojureScriptEngineService implements ScriptEngineService { @Override public ScriptEngine createScriptEngine(ScriptLocation script) throws EngineException { if (m_cljFileMatcher.accept(script.getFile())) { try { return new ClojureScriptEngine(script); } catch (LinkageError e) { throw new EngineException("Clojure is not on the classpath", e); } } return null; }  @Override ScriptEngine createScriptEngine(ScriptLocation script); @Override List<? extends Instrumenter> createInstrumenters();  }### Answer:
@Test public void testCreateScriptEngineWrongType() throws Exception { final ScriptLocation someScript = new ScriptLocation(new File("some.thing")); final ScriptEngine result = new ClojureScriptEngineService().createScriptEngine(someScript); assertNull(result); }
@Test public void testCreateScriptEngine() throws Exception { final ScriptLocation script = new ScriptLocation(new Directory(getDirectory()), new File("my.clj")); createFile(script.getFile(), "(fn [] (fn [] ()))"); final ScriptEngine result = new ClojureScriptEngineService().createScriptEngine(script); assertContains(result.getDescription(), "Clojure"); }
@Test public void testCreateScriptEngineNoClojure() throws Exception { final ScriptLocation script = new ScriptLocation(new Directory(getDirectory()), new File("my.clj")); final ClassLoader blockingLoader = new BlockingClassLoader(singleton("clojure.*"), singleton("net.grinder.scriptengine.clojure.*"), Collections.<String>emptySet(), false); final ScriptEngineService service = (ScriptEngineService) blockingLoader.loadClass( ClojureScriptEngineService.class.getName()).newInstance(); try { service.createScriptEngine(script); fail("Expected EngineException"); } catch (EngineException e) { assertContains(e.getMessage(), "classpath"); } }