@Override protected void currentConfiguration(Configuration cfg) { channelService = mock(ChannelDaoable.class); Channel channel = new Channel(); channel.setId(1L); when(channelService.findPublishByUri(any(Long.class), any(String.class))).thenReturn(channel); templateService = mock(TemplateDaoable.class); when(templateService.findUniquePath(any(Long.class), any(Long.class), any(String.class))) .thenReturn("2/1/include.html"); IncludeDirective directive = new IncludeDirective(channelService, templateService); cfg.setSharedVariable("include", directive); }