Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » How to invoke APT from a unit test?
How to invoke APT from a unit test? [message #249674] Mon, 19 November 2007 11:06 Go to next message
Eclipse UserFriend
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 Go to previous message
Eclipse UserFriend
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
Previous Topic:How to add a tooltip to a graphic designer plugin?
Next Topic:Is there anybody who knows how to add splash to eclipse startup?
Goto Forum:
  


Current Time: Mon Jun 23 06:36:56 EDT 2025

Powered by FUDForum. Page generated in 0.04700 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top