Search in sources :

Example 1 with WorkbenchResolutionAdapter

use of com.avaloq.tools.ddk.xtext.ui.quickfix.WorkbenchMarkerResolutionGenerator.WorkbenchResolutionAdapter in project dsl-devkit by dsldevkit.

the class WorkbenchResolutionAdaptorRunTest method testRun.

@Test
public void testRun() throws CoreException {
    adapter = wmrg.new WorkbenchResolutionAdapter(mockIssueResolution, mockMarker);
    when(mockMarkerHelpRegistry.getResolutions(mockMarker)).thenReturn(mockMarkerResolutions);
    // $NON-NLS-1$
    mockMarkerResource(URI.createURI("platform://dummy/" + TEST_FILE_NAME));
    /* Test call */
    adapter.run(mockMarker);
    // Resolution is applied
    verify(mockIssueResolution, times(1)).apply();
}
Also used : WorkbenchResolutionAdapter(com.avaloq.tools.ddk.xtext.ui.quickfix.WorkbenchMarkerResolutionGenerator.WorkbenchResolutionAdapter) Test(org.junit.Test)

Example 2 with WorkbenchResolutionAdapter

use of com.avaloq.tools.ddk.xtext.ui.quickfix.WorkbenchMarkerResolutionGenerator.WorkbenchResolutionAdapter in project dsl-devkit by dsldevkit.

the class WorkbenchResolutionAdaptorRunTest method testSingleRun.

@Test
public void testSingleRun() throws CoreException {
    adapter = wmrg.new WorkbenchResolutionAdapter(mockIssueResolution, mockMarker);
    when(mockMarkerHelpRegistry.getResolutions(mockMarker)).thenReturn(mockMarkerResolutions);
    // $NON-NLS-1$
    mockMarkerResource(URI.createURI("platform://dummy/" + TEST_FILE_NAME));
    /* Test call */
    adapter.run(new IMarker[] { mockMarker }, null);
    verify(mockIssueResolution, times(1)).apply();
}
Also used : WorkbenchResolutionAdapter(com.avaloq.tools.ddk.xtext.ui.quickfix.WorkbenchMarkerResolutionGenerator.WorkbenchResolutionAdapter) Test(org.junit.Test)

Example 3 with WorkbenchResolutionAdapter

use of com.avaloq.tools.ddk.xtext.ui.quickfix.WorkbenchMarkerResolutionGenerator.WorkbenchResolutionAdapter in project dsl-devkit by dsldevkit.

the class WorkbenchResolutionAdaptorTest method testGetDescription.

@Test
public void testGetDescription() {
    IssueResolution mockIssueResolution = mock(IssueResolution.class);
    IMarker mockMarker = mock(IMarker.class);
    when(mockIssueResolution.getDescription()).thenReturn(TEST_DESCRIPTION);
    WorkbenchResolutionAdapter adapter = mockWmrg.new WorkbenchResolutionAdapter(mockIssueResolution, mockMarker);
    // $NON-NLS-1$
    assertEquals("Adapter delegates get description to resolution.", TEST_DESCRIPTION, adapter.getDescription());
}
Also used : WorkbenchResolutionAdapter(com.avaloq.tools.ddk.xtext.ui.quickfix.WorkbenchMarkerResolutionGenerator.WorkbenchResolutionAdapter) IssueResolution(org.eclipse.xtext.ui.editor.quickfix.IssueResolution) IMarker(org.eclipse.core.resources.IMarker) Test(org.junit.Test)

Example 4 with WorkbenchResolutionAdapter

use of com.avaloq.tools.ddk.xtext.ui.quickfix.WorkbenchMarkerResolutionGenerator.WorkbenchResolutionAdapter in project dsl-devkit by dsldevkit.

the class WorkbenchResolutionAdaptorRunTest method setUp.

@Before
public void setUp() throws Exception {
    wmrg.setIssueUtil(new IssueUtil());
    when(mockRegistryProvider.get()).thenReturn(mockMarkerHelpRegistry);
    mockIssueResolution = mock(IssueResolution.class);
    mockMarker = mock(IMarker.class);
    IMarkerResolution mockMarkerResolution = wmrg.new WorkbenchResolutionAdapter(mockIssueResolution, mockMarker);
    mockMarkerResolutions = new IMarkerResolution[] { mockMarkerResolution };
    mockFile = mock(IFile.class);
    when(mockIssueResolutionProvider.getResolutions(Matchers.any(Issue.class))).thenReturn(Lists.newArrayList(mockIssueResolution));
}
Also used : IFile(org.eclipse.core.resources.IFile) Issue(org.eclipse.xtext.validation.Issue) IMarkerResolution(org.eclipse.ui.IMarkerResolution) WorkbenchResolutionAdapter(com.avaloq.tools.ddk.xtext.ui.quickfix.WorkbenchMarkerResolutionGenerator.WorkbenchResolutionAdapter) IssueResolution(org.eclipse.xtext.ui.editor.quickfix.IssueResolution) IMarker(org.eclipse.core.resources.IMarker) IssueUtil(org.eclipse.xtext.ui.util.IssueUtil) Before(org.junit.Before)

Example 5 with WorkbenchResolutionAdapter

use of com.avaloq.tools.ddk.xtext.ui.quickfix.WorkbenchMarkerResolutionGenerator.WorkbenchResolutionAdapter in project dsl-devkit by dsldevkit.

the class WorkbenchResolutionAdaptorTest method testGetImage.

@Test
public void testGetImage() {
    IssueResolution mockIssueResolution = mock(IssueResolution.class);
    IMarker mockMarker = mock(IMarker.class);
    when(mockWmrg.getImage(mockIssueResolution)).thenReturn(TEST_IMAGE);
    WorkbenchResolutionAdapter adapter = mockWmrg.new WorkbenchResolutionAdapter(mockIssueResolution, mockMarker);
    // $NON-NLS-1$
    assertEquals("Adapter delegates get Image to resolution.", TEST_IMAGE, adapter.getImage());
}
Also used : WorkbenchResolutionAdapter(com.avaloq.tools.ddk.xtext.ui.quickfix.WorkbenchMarkerResolutionGenerator.WorkbenchResolutionAdapter) IssueResolution(org.eclipse.xtext.ui.editor.quickfix.IssueResolution) IMarker(org.eclipse.core.resources.IMarker) Test(org.junit.Test)

Aggregations

WorkbenchResolutionAdapter (com.avaloq.tools.ddk.xtext.ui.quickfix.WorkbenchMarkerResolutionGenerator.WorkbenchResolutionAdapter)7 Test (org.junit.Test)6 IMarker (org.eclipse.core.resources.IMarker)5 IssueResolution (org.eclipse.xtext.ui.editor.quickfix.IssueResolution)5 IFile (org.eclipse.core.resources.IFile)1 IMarkerResolution (org.eclipse.ui.IMarkerResolution)1 IssueUtil (org.eclipse.xtext.ui.util.IssueUtil)1 Issue (org.eclipse.xtext.validation.Issue)1 Before (org.junit.Before)1