use of org.eclipse.n4js.ui.navigator.N4JSProjectExplorerProblemsDecorator in project n4js by eclipse.
the class GHOLD_101_WorkingSetsTest_PluginUITest method testMarkerSupportForWorkingSets.
/**
*/
@Test
public void testMarkerSupportForWorkingSets() throws CoreException, IOException {
final IProject project = createN4JSProject("P1", LIBRARY);
createTestFile(project.getFolder("src"), "A", "class a { }");
final IFile moduleFile = project.getFolder("src").getFile("A.n4js");
assertTrue("File is not accessible under src/A.n4js", moduleFile.isAccessible());
// line 1: Class names should start with upper case letter.
assertMarkers("Expected exactly one validation issue.", project, 1);
activateWorkingSetManager(ManualAssociationAwareWorkingSetManager.class);
final TreeItem[] treeItems = commonViewer.getTree().getItems();
assertTrue("Expected exactly one item in the Project Explorer. Input was: " + Arrays.toString(treeItems), treeItems.length == 1);
final Object data = treeItems[0].getData();
assertTrue("Expected " + WorkingSet.class + " input in navigator. Was " + data, data instanceof WorkingSet);
final WorkingSet workingSet = (WorkingSet) treeItems[0].getData();
assertTrue("Expected working set with ID: " + OTHERS_WORKING_SET_ID + ". Was " + workingSet.getId(), OTHERS_WORKING_SET_ID.equals(workingSet.getId()));
final N4JSProjectExplorerProblemsDecorator decorator = new N4JSProjectExplorerProblemsDecorator();
int adornmentFlag = decorator.computeAdornmentFlags(workingSet);
assertEquals("Adornment mismatch.", WARNING, adornmentFlag);
try (final InputStream is = new StringInputStream("someBrokenContent")) {
moduleFile.setContents(is, IResource.FORCE, null);
}
waitForAutoBuild();
// line 1: Couldn't resolve reference to IdentifiableElement 'someBrokenContent'
assertMarkers("Expected exactly one validation issue.", project, 1);
adornmentFlag = decorator.computeAdornmentFlags(workingSet);
assertEquals("Adornment mismatch.", ERROR, adornmentFlag);
try (final InputStream is = new StringInputStream("class A { }")) {
moduleFile.setContents(is, IResource.FORCE, null);
}
waitForAutoBuild();
assertMarkers("Expected exactly zero validation issues.", project, 0);
adornmentFlag = decorator.computeAdornmentFlags(workingSet);
assertEquals("Adornment mismatch.", NO_ADORNMENT, adornmentFlag);
}
Aggregations