Appendix B. The TestProject Fixture

This appendix lists the full source code of the TestProject fixture class that we used to implement the tests.

Example . org.eclipse.contribution.junit.test/TestProject

public class TestProject {
  public IProject project;
  public IJavaProject javaProject;
  private IPackageFragmentRoot sourceFolder;

  public TestProject() throws CoreException {
    IWorkspaceRoot root= ResourcesPlugin.getWorkspace().getRoot();
    project= root.getProject("Project-1");
    project.create(null);
    project.open(null);

    javaProject= JavaCore.create(project);
    IFolder binFolder= createBinFolder();
    setJavaNature();
    javaProject.setRawClasspath(new IClasspathEntry[0], null);
    createOutputFolder(binFolder);
    addSystemLibraries();
  }
  public IProject getProject ...

Get Contributing to Eclipse: Principles, Patterns, and Plug-Ins now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.