use of org.xwiki.uiextension.internal.WikiUIExtensionParameters in project xwiki-platform by xwiki.
the class WikiUIExtensionParametersTest method getParametersWhenVelocityFails.
@Test
public void getParametersWhenVelocityFails() throws Exception {
when(modelContext.getCurrentEntityReference()).thenReturn(new WikiReference("xwiki"));
when(velocityEngine.evaluate(any(VelocityContext.class), any(StringWriter.class), eq("id:key"), eq("value"))).thenThrow(new XWikiVelocityException(""));
WikiUIExtensionParameters parameters = new WikiUIExtensionParameters("id", "key=value", componentManager);
// It should fail and put a warn in the logs
Assert.assertEquals(null, parameters.get().get("key"));
Assert.assertTrue(logRule.contains("Failed to evaluate UI extension data value, key [key], value [value]. Reason: []"));
}
Aggregations