use of com.enonic.xp.portal.filter.FilterScriptFactory in project xp by enonic.
the class MappingHandlerTest method setup.
@BeforeEach
public final void setup() throws Exception {
this.request = new PortalRequest();
final ControllerScriptFactory controllerScriptFactory = mock(ControllerScriptFactory.class);
ControllerScript controllerScript = mock(ControllerScript.class);
when(controllerScriptFactory.fromDir(Mockito.any())).thenReturn(controllerScript);
final PortalResponse portalResponse = PortalResponse.create().build();
when(controllerScript.execute(Mockito.any())).thenReturn(portalResponse);
FilterScriptFactory filterScriptFactory = mock(FilterScriptFactory.class);
FilterScript filterScript = mock(FilterScript.class);
when(filterScriptFactory.fromScript(Mockito.any())).thenReturn(filterScript);
when(filterScript.execute(Mockito.any(), Mockito.any(), Mockito.any())).thenReturn(portalResponse);
this.resourceService = mock(ResourceService.class);
final Resource resourceNotFound = mock(Resource.class);
when(resourceNotFound.exists()).thenReturn(false);
final Resource resource = mock(Resource.class);
when(resource.exists()).thenReturn(true);
when(this.resourceService.getResource(ResourceKey.from("demo:/services/test"))).thenReturn(resource);
this.contentService = mock(ContentService.class);
this.rendererDelegate = mock(RendererDelegate.class);
this.siteService = mock(SiteService.class);
this.handler = new MappingHandler(resourceService, controllerScriptFactory, filterScriptFactory, rendererDelegate, new ControllerMappingsResolver(siteService), new ContentResolver(contentService));
this.request.setMethod(HttpMethod.GET);
}
Aggregations