/* * Ensures that getPrimaryElement() on an element of primary working copy returns the same handle. */ public void testGetPrimaryElement2() throws CoreException { this.workingCopy = getCompilationUnit("P/X.java"); this.workingCopy.becomeWorkingCopy(null); IJavaElement element = this.workingCopy.getType("X"); assertEquals("Unexpected element", element, element.getPrimaryElement()); }
/* * Ensures that getPrimaryElement() on an element of a non-primary working copy returns * an element ofthe primary compilation unit. */ public void testGetPrimaryElement1() throws CoreException { ICompilationUnit cu = getCompilationUnit("P/X.java"); TestWorkingCopyOwner owner = new TestWorkingCopyOwner(); this.workingCopy = cu.getWorkingCopy(owner, null); IJavaElement element = this.workingCopy.getType("X"); assertEquals("Unexpected element", cu.getType("X"), element.getPrimaryElement()); }