Search in sources :

Example 1 with ProjectImportsResourceTypeDefinition

use of org.kie.workbench.common.screens.projectimportsscreen.type.ProjectImportsResourceTypeDefinition in project kie-wb-common by kiegroup.

the class ResourceHandlerManagerTest method testResourceHandlers.

@Test
public void testResourceHandlers() {
    NewResourceHandler rh1 = mock(NewResourceHandler.class);
    NewResourceHandler rh2 = mock(NewResourceHandler.class);
    when(rh1.getResourceType()).thenReturn(new JavaResourceTypeDefinition(new Model()));
    when(rh2.getResourceType()).thenReturn(new ProjectImportsResourceTypeDefinition(new Others()));
    doReturn(Arrays.asList(rh1, rh2)).when(this.resourceHandlerManager).getNewResourceHandlers();
    List<NewResourceHandler> handlers = this.resourceHandlerManager.getNewResourceHandlers(resourceHandler -> resourceHandler.getResourceType().getCategory().equals(new Model()));
    assertTrue(handlers.size() == 1);
    assertEquals(rh1, handlers.get(0));
}
Also used : NewResourceHandler(org.kie.workbench.common.widgets.client.handlers.NewResourceHandler) Others(org.uberfire.workbench.category.Others) ProjectImportsResourceTypeDefinition(org.kie.workbench.common.screens.projectimportsscreen.type.ProjectImportsResourceTypeDefinition) Model(org.guvnor.common.services.project.categories.Model) JavaResourceTypeDefinition(org.kie.workbench.common.screens.javaeditor.type.JavaResourceTypeDefinition) Test(org.junit.Test)

Aggregations

Model (org.guvnor.common.services.project.categories.Model)1 Test (org.junit.Test)1 JavaResourceTypeDefinition (org.kie.workbench.common.screens.javaeditor.type.JavaResourceTypeDefinition)1 ProjectImportsResourceTypeDefinition (org.kie.workbench.common.screens.projectimportsscreen.type.ProjectImportsResourceTypeDefinition)1 NewResourceHandler (org.kie.workbench.common.widgets.client.handlers.NewResourceHandler)1 Others (org.uberfire.workbench.category.Others)1