Bug 287536 [CommonNavigator] Wrong sorter unit tests
Build ID: Build id: I20090611-1540 Steps To Reproduce: Several tests in SorterTest rely on the dynamicAddModelObjects method. That method breaks the contract of viewer.add ("This method should be called (by the content provider) when a single * element has been added to the model") in that it calls viewer.add(newData) but doesn't actually add newData to the project. More information: The corresponding tests will fail if for example _viewer.add(parent, children) is implemented as _viewer.refresh(parent), which should not make any difference.
tests/org.eclipse.ui.tests.navigator/src/org/eclipse/ui/tests/navigator/SorterTest.java
new String[] { TEST_CONTENT_SORTER_RESOURCE }, false);
		_contentService.getActivationService().activateExtensions(
				new String[] { TEST_CONTENT_SORTER_RESOURCE }, true);
		refreshViewer();
		_viewer.update(_p1, new String[] { "prop1" });
		_viewer.expandAll();
 
		assertEquals("prop1", TestSorterResource._sorterProperty);
		assertEquals(_p1, TestSorterResource._sorterElement);
	}
	protected void dynamicAddModelObjects() throws Exception {
		_viewer.setExpandedState(_project, true);
		Properties props = new Properties();
		props.put("AddedParent", "Child1,AddedChild1");
		TestExtensionTreeData newData = new TestExtensionTreeData(
				TestContentProvider._modelRoot, "AddedParent", props, null);
		_viewer.add(_project, newData);
		_viewer.setExpandedState(newData, true);
		_viewer.add(newData, _project.getFile("AddedFile1.txt"));
		_viewer.add(newData, _project.getFile("AddedFile2.txt"));
	}
	
	public void testSorterContentOverride() throws Exception {
		waitForModelObjects();
		INavigatorContentDescriptor desc = _contentService
		.getContentDescriptorById(TEST_CONTENT_SORTER_RESOURCE_SORTONLY);
		
		TestSorterResource sorter = (TestSorterResource) _contentService
			.getSorterService().findSorter(desc, _project, null, null);
		sorter._forward = false;