Bug 48696 Add JUnit libraries Quick Fix [JUnit]
Currently the Quick Fix only works on a line containing "TestCase". It should also work on lines w/ a) "junit.framework" b) "Test suite()" c) "TestSuite"
org.eclipse.jdt.junit/src/org/eclipse/jdt/internal/junit/ui/JUnitQuickFixProcessor.java
/* (non-Javadoc)
	 * @see org.eclipse.jdt.ui.text.java.IQuickFixProcessor#hasCorrections(org.eclipse.jdt.core.ICompilationUnit, int)
	 */
	public boolean hasCorrections(ICompilationUnit unit, int problemId) {
		return IProblem.SuperclassNotFound == problemId || IProblem.ImportNotFound == problemId;
	}
	/* (non-Javadoc)
	 * @see org.eclipse.jdt.ui.text.java.IQuickFixProcessor#getCorrections(org.eclipse.jdt.ui.text.java.IInvocationContext, org.eclipse.jdt.ui.text.java.IProblemLocation[])
	 */
	public IJavaCompletionProposal[] getCorrections(final IInvocationContext context, IProblemLocation[] locations) throws CoreException {
		if (isJUnitProblem(context, locations))
			return new IJavaCompletionProposal[] { new JUnitAddLibraryProposal(context) };
		return new IJavaCompletionProposal[] {};
	}
	private boolean isJUnitProblem(IInvocationContext context, IProblemLocation[] locations) {
		ICompilationUnit unit= context.getCompilationUnit();
		for (int i= 0; i < locations.length; i++) {
			IProblemLocation location= locations[i];
			try {
				String s= unit.getBuffer().getText(location.getOffset(), location.getLength());
				if (s.equals("TestCase") || s.equals("junit.framework.TestCase")) 
					return true;
			} catch (JavaModelException e) {
				e.printStackTrace();
			}
		}
		return false;
	}
}