/** Tests removing a library from the classpath of a project */ public void testWPUpdateLibraryRemovedFromClasspath() throws Exception { IPath libPath = null; try { IJavaProject project = getTestingProject(); assertNotNull("The testing project must exist", project); // add to classpath IFolder folder = assertTestLibrary(project, new Path("libx"), "component.a_1.0.0.jar"); IApiComponent component = getWorkspaceBaseline().getApiComponent(project.getElementName()); assertNotNull("the workspace component must exist", component); int before = component.getApiTypeContainers().length; libPath = folder.getFullPath().append("component.a_1.0.0.jar"); // remove classpath entry ProjectUtils.removeFromClasspath(project, JavaCore.newLibraryEntry(libPath, null, null)); waitForAutoBuild(); // remove from bundle class path IBundleProjectService service = ProjectUtils.getBundleProjectService(); IBundleProjectDescription description = service.getDescription(project.getProject()); description.setBundleClasspath( new IBundleClasspathEntry[] { service.newBundleClasspathEntry(new Path(ProjectUtils.SRC_FOLDER), null, null) }); description.apply(null); waitForAutoBuild(); // retrieve updated component component = getWorkspaceBaseline().getApiComponent(project.getElementName()); assertTrue( "there must be less containers after the removal", before > component.getApiTypeContainers().length); } finally { if (libPath != null) { FileUtils.delete(libPath.toOSString()); } } }