/** * Creates a Java project with JUnit source and rt.jar from {@link #addVariableRTJar(IJavaProject, * String, String, String)}. * * @param projectName the project name * @param srcContainerName the source container name * @param outputFolderName the output folder name * @return the IJavaProject * @throws CoreException * @throws IOException * @throws InvocationTargetException * @since 3.1 */ public static IJavaProject createJavaProjectWithJUnitSource( String projectName, String srcContainerName, String outputFolderName) throws CoreException, IOException, InvocationTargetException { IJavaProject project = createJavaProject(projectName, outputFolderName); IPackageFragmentRoot jdk = JavaProjectHelper.addVariableRTJar(project, "JRE_LIB_TEST", null, null); // $NON-NLS-1$ Assert.assertNotNull(jdk); File junitSrcArchive = JavaTestPlugin.getDefault().getFileInPlugin(JUNIT_SRC_381); Assert.assertTrue(junitSrcArchive != null && junitSrcArchive.exists()); JavaProjectHelper.addSourceContainerWithImport( project, srcContainerName, junitSrcArchive, JUNIT_SRC_ENCODING); return project; }