Search in sources :

Example 1 with JavaResourceTypeDefinition

use of org.kie.workbench.common.screens.javaeditor.type.JavaResourceTypeDefinition in project kie-wb-common by kiegroup.

the class NewAssetHandlerCardWidgetTest method setUp.

@Before
public void setUp() {
    this.widget = new NewAssetHandlerCardWidget(this.view, this.newResourcePresenter, this.ts);
    when(ts.getTranslation(eq(new Model().getName()))).thenReturn(MODEL);
    when(newResourceHandler.getResourceType()).thenReturn(new JavaResourceTypeDefinition(new Model()));
    when(newResourceHandler.getDescription()).thenReturn(TITLE);
}
Also used : Model(org.guvnor.common.services.project.categories.Model) JavaResourceTypeDefinition(org.kie.workbench.common.screens.javaeditor.type.JavaResourceTypeDefinition) Before(org.junit.Before)

Example 2 with JavaResourceTypeDefinition

use of org.kie.workbench.common.screens.javaeditor.type.JavaResourceTypeDefinition 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)2 JavaResourceTypeDefinition (org.kie.workbench.common.screens.javaeditor.type.JavaResourceTypeDefinition)2 Before (org.junit.Before)1 Test (org.junit.Test)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