Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 367679 - JUnit tests and the Java validator
Summary: JUnit tests and the Java validator
Status: CLOSED FIXED
Alias: None
Product: TMF
Classification: Modeling
Component: Xtext (show other bugs)
Version: 2.2.0   Edit
Hardware: PC All
: P3 normal (vote)
Target Milestone: M6   Edit
Assignee: Jan Koehnlein CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-31 08:43 EST by Lorenzo Bettini CLA
Modified: 2017-09-19 18:17 EDT (History)
3 users (show)

See Also:
sven.efftinge: juno+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lorenzo Bettini CLA 2011-12-31 08:43:22 EST
When writing JUnit tests such as

@InjectWith(MyDslInjectorProvider.class)
@RunWith(XtextRunner.class)
public class MyDslTest ...

the Java validator associated to the DSL is used only during the first test, not in the other ones.
Comment 1 Jan Koehnlein CLA 2012-02-09 11:38:33 EST
The XXXJavaValidator is added to the EValidator registry as a side-effect of the injector instantiation (eager binding). As we reuse the injector, the registration is deleted for the second test case when the registries are restored.

I changed the generated XXXInjectorProvider to use two mementi - before and after the injector creation - to have the least impact. If you cannot update to MASTER, I recommend either using the XXXUiInjectorProvider or implementing your own IP similar to the XtextInjectorProvider.

Fix pushed to MASTER.
Comment 2 Karsten Thoms CLA 2017-09-19 18:07:57 EDT
Closing all bugs that were set to RESOLVED before Neon.0
Comment 3 Karsten Thoms CLA 2017-09-19 18:17:30 EDT
Closing all bugs that were set to RESOLVED before Neon.0