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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.