Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 367679

Summary: JUnit tests and the Java validator
Product: [Modeling] TMF Reporter: Lorenzo Bettini <lorenzo.bettini>
Component: XtextAssignee: Jan Koehnlein <jan>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: jan, sven.efftinge, tmf.xtext-inbox
Version: 2.2.0Flags: sven.efftinge: juno+
Target Milestone: M6   
Hardware: PC   
OS: All   
Whiteboard:

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