How to invoke APT from a unit test? [message #249674] |
Mon, 19 November 2007 11:06  |
Eclipse User |
|
|
|
Originally posted by: myawn.ebay.com
I have a customized AnnotationProcessor that is working fine interactively.
I'd like to be able to write unit tests for it. The unit tests will be
using the AST to modify source code (add, remove, or change annotations)
and then test the state of the code. For example, if I add an
annotation with an invalid combination of attribute values, I should be
able to see the problem marker for that when I retrieve markers for the
code.
It appears that when I programmatically parse / modify / write the AST
from within my unit test, the AnnotationProcessor is never invoked.
Build Automatically is turned on.
Is there an API call or series of calls I need to add to invoke the
AnnotationProcessor after my unit test modifies the AST?
Thanks,
Mike
|
|
|
Re: How to invoke APT from a unit test? [message #249681 is a reply to message #249674] |
Mon, 19 November 2007 16:57  |
Eclipse User |
|
|
|
Originally posted by: wharley.bea.com
"Mike Yawn" <myawn@ebay.com> wrote in message
news:fhsc9c$s7u$1@build.eclipse.org...
> Is there an API call or series of calls I need to add to invoke the
> AnnotationProcessor after my unit test modifies the AST?
Shouldn't be. If it's recompiling, APT will be invoked. You can look at
the APT tests to see examples of how we do it.
However, make sure that your JUnit test is enabling APT in the project,
setting up the factory path appropriately, etc. If your processor is in a
plug-in make sure that plug-in is active in the JUnit launch configuration.
-Walter Harley
JDT APT team
|
|
|
Powered by
FUDForum. Page generated in 0.04700 seconds