use of com.enonic.xp.portal.impl.rendering.RenderException in project xp by enonic.
the class MacroInstructionTest method testMacroInstructionMissingController.
@Test
public void testMacroInstructionMissingController() throws Exception {
MacroKey key = MacroKey.from("myapp:mymacro");
MacroDescriptor macroDescriptor = MacroDescriptor.create().key(key).build();
when(macroDescriptorService.getByKey(key)).thenReturn(macroDescriptor);
try {
macroInstruction.evaluate(portalRequest, "MACRO _name=\"mymacro\" param1=\"value1\" _body=\"body\"");
fail("Expected exception");
} catch (RenderException e) {
assertEquals("Macro controller not found: mymacro", e.getMessage());
}
}
use of com.enonic.xp.portal.impl.rendering.RenderException in project xp by enonic.
the class ResponseProcessorExecutorTest method testExecuteResponseProcessorNotImplementingMethod.
@Test
public void testExecuteResponseProcessorNotImplementingMethod() throws Exception {
final PortalScriptService scriptService = Mockito.mock(PortalScriptService.class);
final ScriptExports scriptExports = Mockito.mock(ScriptExports.class);
when(scriptService.execute(any(ResourceKey.class))).thenReturn(scriptExports);
final ResponseProcessorExecutor filterExecutor = new ResponseProcessorExecutor(scriptService);
final ResponseProcessorDescriptor filter = ResponseProcessorDescriptor.create().application(ApplicationKey.from("myApp")).name("filter1").build();
final PortalRequest request = new PortalRequest();
final PortalResponse response = PortalResponse.create().build();
try {
filterExecutor.execute(filter, request, response);
fail("Expected exception");
} catch (RenderException e) {
assertEquals("Missing exported function [responseProcessor] in response filter [/site/processors/filter1.js]", e.getMessage());
}
}
Aggregations