@Test void createVelocityEngineWhenFailing() { Throwable exception = assertThrows(XWikiVelocityException.class, () -> { this.velocityFactory.createVelocityEngine("somekey", new Properties()); }); assertEquals("Failed to create Velocity Engine", exception.getMessage()); assertEquals("ComponentLookupException: Can't find descriptor for the component with type " + "[interface org.xwiki.velocity.VelocityEngine] and hint [null]", ExceptionUtils.getRootCauseMessage(exception)); }
@Override public VelocityEngine createVelocityEngine(String key, Properties properties) throws XWikiVelocityException { VelocityEngine engine; try { engine = this.componentManager.getInstance(VelocityEngine.class); } catch (ComponentLookupException e) { throw new XWikiVelocityException("Failed to create Velocity Engine", e); } engine.initialize(properties); this.velocityEngines.put(key, engine); return engine; }
DefaultVelocityFactory implements VelocityFactory { @Override public VelocityEngine createVelocityEngine(String key, Properties properties) throws XWikiVelocityException { VelocityEngine engine; try { engine = this.componentManager.getInstance(VelocityEngine.class); } catch (ComponentLookupException e) { throw new XWikiVelocityException("Failed to create Velocity Engine", e); } engine.initialize(properties); this.velocityEngines.put(key, engine); return engine; } }
DefaultVelocityFactory implements VelocityFactory { @Override public VelocityEngine createVelocityEngine(String key, Properties properties) throws XWikiVelocityException { VelocityEngine engine; try { engine = this.componentManager.getInstance(VelocityEngine.class); } catch (ComponentLookupException e) { throw new XWikiVelocityException("Failed to create Velocity Engine", e); } engine.initialize(properties); this.velocityEngines.put(key, engine); return engine; }  }
DefaultVelocityFactory implements VelocityFactory { @Override public VelocityEngine createVelocityEngine(String key, Properties properties) throws XWikiVelocityException { VelocityEngine engine; try { engine = this.componentManager.getInstance(VelocityEngine.class); } catch (ComponentLookupException e) { throw new XWikiVelocityException("Failed to create Velocity Engine", e); } engine.initialize(properties); this.velocityEngines.put(key, engine); return engine; }  @Override boolean hasVelocityEngine(String key); @Override VelocityEngine getVelocityEngine(String key); @Override VelocityEngine createVelocityEngine(String key, Properties properties); @Override VelocityEngine removeVelocityEngine(String key); }
DefaultVelocityFactory implements VelocityFactory { @Override public VelocityEngine createVelocityEngine(String key, Properties properties) throws XWikiVelocityException { VelocityEngine engine; try { engine = this.componentManager.getInstance(VelocityEngine.class); } catch (ComponentLookupException e) { throw new XWikiVelocityException("Failed to create Velocity Engine", e); } engine.initialize(properties); this.velocityEngines.put(key, engine); return engine; }  @Override boolean hasVelocityEngine(String key); @Override VelocityEngine getVelocityEngine(String key); @Override VelocityEngine createVelocityEngine(String key, Properties properties); @Override VelocityEngine removeVelocityEngine(String key);  }