public void testFilter_existingElement_packageDeclaration() throws Exception {
JavaEditor editor = closeAndOpenEditor();
IDocument document = getDocument(editor);
int offset = document.get().indexOf(pkg.getElementName());
int len = pkg.getElementName().length();
editor.getSelectionProvider().setSelection(new TextSelection(offset, len));
IJavaElement element = getElementAtOffset(editor);
// Make sure we got the selection right:
assertEquals(IJavaElement.PACKAGE_DECLARATION, element.getElementType());