use of com.avaloq.tools.ddk.xtext.ui.quickfix.WorkbenchMarkerResolutionGenerator.WorkbenchResolutionAdapter in project dsl-devkit by dsldevkit.
the class WorkbenchResolutionAdaptorTest method findOtherMarkers.
@Test
public void findOtherMarkers() {
IssueResolution mockIssueResolution = mock(IssueResolution.class);
IMarker mockResolutionMarker = mock(IMarker.class);
when(mockResolutionMarker.getAttribute(Issue.CODE_KEY, null)).thenReturn(CODE1);
IMarker mockMarker1 = mock(IMarker.class);
when(mockMarker1.getAttribute(Issue.CODE_KEY, null)).thenReturn(CODE1);
IMarker mockMarker2 = mock(IMarker.class);
when(mockMarker2.getAttribute(Issue.CODE_KEY, null)).thenReturn(CODE2);
IMarker mockMarker3 = mock(IMarker.class);
when(mockMarker3.getAttribute(Issue.CODE_KEY, null)).thenReturn(CODE1);
IMarker[] allMarkers = new IMarker[] { mockMarker1, mockMarker2, mockMarker3 };
IMarker[] matchingMarkers = new IMarker[] { mockMarker1, mockMarker3 };
WorkbenchResolutionAdapter adapter = mockWmrg.new WorkbenchResolutionAdapter(mockIssueResolution, mockResolutionMarker);
// $NON-NLS-1$
assertArrayEquals("Adapter findOtherMarkers matching on CODE1.", matchingMarkers, adapter.findOtherMarkers(allMarkers));
when(mockResolutionMarker.getAttribute(Issue.CODE_KEY, null)).thenReturn(CODE2);
matchingMarkers = new IMarker[] { mockMarker2 };
adapter = mockWmrg.new WorkbenchResolutionAdapter(mockIssueResolution, mockResolutionMarker);
// $NON-NLS-1$
assertArrayEquals("Adapter findOtherMarkers matching on CODE2.", matchingMarkers, adapter.findOtherMarkers(allMarkers));
}
use of com.avaloq.tools.ddk.xtext.ui.quickfix.WorkbenchMarkerResolutionGenerator.WorkbenchResolutionAdapter in project dsl-devkit by dsldevkit.
the class WorkbenchResolutionAdaptorTest method testGetLabel.
@Test
public void testGetLabel() {
IssueResolution mockIssueResolution = mock(IssueResolution.class);
IMarker mockMarker = mock(IMarker.class);
when(mockIssueResolution.getLabel()).thenReturn(TEST_LABEL);
WorkbenchResolutionAdapter adapter = mockWmrg.new WorkbenchResolutionAdapter(mockIssueResolution, mockMarker);
// $NON-NLS-1$
assertEquals("Adapter delegates get label to resolution.", TEST_LABEL, adapter.getLabel());
}
Aggregations