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
assertEquals("BlueAddedChild1", addedParent.getItem(0).getText());
		assertEquals("BlueAddedFile1.txt", addedParent.getItem(1).getText());
		assertEquals("BlueAddedFile2.txt", addedParent.getItem(2).getText());
		assertEquals("BlueChild1", addedParent.getItem(3).getText());
	}
	public void testSorterResource() throws Exception {
		_contentService.bindExtensions(
				new String[] { TEST_CONTENT_SORTER_RESOURCE }, false);
		_contentService.getActivationService().activateExtensions(
				new String[] { TEST_CONTENT_SORTER_RESOURCE }, true);
		refreshViewer();
		INavigatorContentDescriptor desc = _contentService
				.getContentDescriptorById(TEST_CONTENT_SORTER_RESOURCE);
		TestSorterResource sorter = (TestSorterResource) _contentService
				.getSorterService().findSorter(desc, _p2, null, null);
		sorter._forward = false;
		IStructuredSelection sel;
		
		IContainer cont = (IContainer) _p2.members()[1];
		sel = new StructuredSelection(cont.members()[0]);
		_viewer.setSelection(sel);
		_viewer.setExpandedState(cont, true);
		TreeItem[] items = _viewer.getTree().getItems();
		
		TreeItem file1 = items[2].getItem(0);
		assertEquals("file6.txt", file1.getText());
	}
}