-
Notifications
You must be signed in to change notification settings - Fork 28
Documentation
(This information applies for git ‘master’, and not for ante releases yet).
The Xpect runtime is a loosely coupled set of Java classes and each of them can be exchanged. Each of these Java classes is called a “Contribution”.
Contributions have roles and a Java class becomes a contribution when
- it is annotated with Java annotations that associates it with a role.
- it has been imported via @XpectImport()
The following roles are defined for contributions:
- @XpectSetupFactory:The class is instantiated and managed by the StateContainer.
- @XpectSetupComponent: The class is available in the XPECT_SETUP section. These classes will also be proposed by content assist.
- @XpectSetupRoot: The types of the add(foo)-methods of this class are the types allowed as root-components in the XPECT_SETUP section. Furthermore classes annotated with @XpectSetupRoot can be invoked with ISetupInitializer.initialize(T).
- @XpectGuiceModule the annotated class is a google Guice module. The module will be mixed into the current language’s injector.
The @XpectImport annotation is valid on
- all Xpect Java test classes
- on Java classes that are used as parameter types of @Xpect test methods
- on Java annotations that are used on parameter types on @Xpect test methods
- on Java classes that are contributions
- on super classes of any of the classes mentioned above.
To replace any contribution (even the ones shipped with Xpect), you can annotate your own contribution with @XpectReplace(FooBar). FooBar being the contribution you want to replace. A contribution that has been replaced is not used any further by Xpect.
The annotation @org.xpect.XpectRequiredEnvironment can be used on contributions to activate them only for the specified environments. Example: @XpectRequiredEnvironment(Environment.STANDALONE_TEST) This allows to have implementations of contributions that are specific to certain environments.