@Test
public void testQuickFixProcessor() {
long start = System.nanoTime();
QWickieQuickFixProcessor processor = new QWickieQuickFixProcessor();
IInvocationContext context = new IInvocationContext() {
public int getSelectionOffset() {
return 10;
}
public int getSelectionLength() {
return 10;
}
public ASTNode getCoveringNode() {
return null;
}
public ASTNode getCoveredNode() {
return null;
}
public ICompilationUnit getCompilationUnit() {
return JavaCore.createCompilationUnitFrom(javaFile);
}
public CompilationUnit getASTRoot() {
return null;
}
};
IProblemLocation location = new IProblemLocation() {
public boolean isError() {
return false;
}
public int getProblemId() {
return 0;
}
public String[] getProblemArguments() {
return null;
}
public int getOffset() {
return 0;
}
public String getMarkerType() {
return null;
}
public int getLength() {
return 0;
}
public ASTNode getCoveringNode(final CompilationUnit arg0) {
return null;
}
public ASTNode getCoveredNode(final CompilationUnit arg0) {
return null;
}
};
IProblemLocation[] locations = new IProblemLocation[] { location };
try {
final IJavaCompletionProposal[] corrections = processor.getCorrections(context, locations);
assertEquals(corrections.length, 1);
assertEquals(corrections[0].getDisplayString(), "add new SubmitLink(\"wicketId\")");
} catch (CoreException e) {
}
assertFalse(processor.hasCorrections(context.getCompilationUnit(), 1));
System.out.println("testQuickFixProcessor:\t\t" + (System.nanoTime() - start));
}