private void runTests(String prefixForErrorMessage, int howManyNumbersInErrorString) throws CoreException, JavaModelException, PartInitException { JavaProjectHelper.addRTJar13(fProject); JavaProjectHelper.addVariableEntry(fProject, new Path( "JUNIT_HOME/junit.jar"), null, null);  IPackageFragmentRoot root = JavaProjectHelper.addSourceContainer( fProject, "src"); IPackageFragment pack = root.createPackageFragment("pack", true, null);  ICompilationUnit cu1 = pack.getCompilationUnit("LongTraceLines.java");  String initialString = prefixForErrorMessage + "Numbers:";  String initializeString = "String errorString = \"" + initialString + "\";";  String contents = "public class LongTraceLines extends TestCase {\n" + "	public void testLongTraceLine() throws Exception {\n" + ("		" + initializeString + "\n") + ("		for (int i = 0; i < " + howManyNumbersInErrorString + "; i++) {\n") + "			errorString += \" \" + i;\n" + "		}\n" + "		throw new RuntimeException(errorString);\n" + "	}\n" + "}";  IType type = cu1.createType(contents, null, true, null); cu1.createImport("junit.framework.TestCase", null, Flags.AccDefault, null); cu1.createImport("java.util.Arrays", null, Flags.AccDefault, null);  ILaunchManager lm = DebugPlugin.getDefault().getLaunchManager(); lm.addLaunchListener(this);  LaunchConfigurationManager manager = DebugUIPlugin.getDefault() .getLaunchConfigurationManager(); List launchShortcuts = manager.getLaunchShortcuts(); LaunchShortcutExtension ext = null; for (Iterator iter = launchShortcuts.iterator(); iter.hasNext();) { ext = (LaunchShortcutExtension) iter.next(); if (ext.getLabel().equals("JUnit Test")) break; } ext.launch(new StructuredSelection(type), ILaunchManager.RUN_MODE);  while (hasNotTerminated() || getTable().getItemCount() == 0) { PlatformUI.getWorkbench().getDisplay().readAndDispatch(); }
public void runTests(String prefixForErrorMessage, int howManyNumbersInErrorString, int numExpectedTableItems) throws CoreException, JavaModelException, PartInitException { launchTests(prefixForErrorMessage, howManyNumbersInErrorString); waitForTableToFill(numExpectedTableItems, 30000);
	private void runTests(String prefixForErrorMessage,			int howManyNumbersInErrorString) throws CoreException,			JavaModelException, PartInitException {		JavaProjectHelper.addRTJar13(fProject); // have to set up an 1.3 project to avoid requiring a 5.0 VM		JavaProjectHelper.addVariableEntry(fProject, new Path(				"JUNIT_HOME/junit.jar"), null, null);		IPackageFragmentRoot root = JavaProjectHelper.addSourceContainer(				fProject, "src");		IPackageFragment pack = root.createPackageFragment("pack", true, null);		ICompilationUnit cu1 = pack.getCompilationUnit("LongTraceLines.java");		String initialString = prefixForErrorMessage + "Numbers:";		String initializeString = "String errorString = \""									+ initialString									+ "\";";		String contents = "public class LongTraceLines extends TestCase {\n"							+ "	public void testLongTraceLine() throws Exception {\n"							+ ("		" + initializeString + "\n")							+ ("		for (int i = 0; i < "								+ howManyNumbersInErrorString + "; i++) {\n")							+ "			errorString += \" \" + i;\n"							+ "		}\n"							+ "		throw new RuntimeException(errorString);\n"							+ "	}\n"							+ "}";		IType type = cu1.createType(contents, null, true, null);		cu1.createImport("junit.framework.TestCase", null, Flags.AccDefault,				null);		cu1.createImport("java.util.Arrays", null, Flags.AccDefault, null);		ILaunchManager lm = DebugPlugin.getDefault().getLaunchManager();		lm.addLaunchListener(this);		LaunchConfigurationManager manager = DebugUIPlugin.getDefault()				.getLaunchConfigurationManager();		List launchShortcuts = manager.getLaunchShortcuts();		LaunchShortcutExtension ext = null;		for (Iterator iter = launchShortcuts.iterator(); iter.hasNext();) {			ext = (LaunchShortcutExtension) iter.next();			if (ext.getLabel().equals("JUnit Test"))				break;		}		ext.launch(new StructuredSelection(type), ILaunchManager.RUN_MODE);		while (hasNotTerminated() || getTable().getItemCount() == 0) {			PlatformUI.getWorkbench().getDisplay().readAndDispatch();		}	}