Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » XtextRunner cannot be resolved to a variable
XtextRunner cannot be resolved to a variable [message #1062773] Mon, 10 June 2013 16:55 Go to next message
Mr Manner is currently offline Mr MannerFriend
Messages: 26
Registered: January 2013
Junior Member
I have the following problem in a test where I inject the "JsonInjectorProvider" and run it with "XtextRunner"
It complains about this two errors:
* JsonInjectorProvider cannot be resolved to a variable
* XtextRunner cannot be resolved to a variable

package com.test.hint.tests;

import com.test.hint.JsonInjectorProvider;
import com.test.hint.json.JsonObject;
import com.test.hint.json.Value;
import com.test.hint.schema.JsonObjectUtils;

import static org.junit.Assert.*;
import org.junit.Test;
import com.google.inject.Inject;
import org.eclipse.xtext.junit4.util.ParseHelper;

import org.eclipse.xtext.junit4.InjectWith;
import org.junit.runner.RunWith;
import org.eclipse.xtext.junit4.XtextRunner;

@InjectWith(typeof(JsonInjectorProvider))
@RunWith(typeof(XtextRunner))
class JsonObjectUtilsTest {
	@Inject
	private ParseHelper<JsonObject> parser;
	
	@Test
	public void getValue() {
		JsonObject model = null; // parser.parse(jsonText1);
		
		Value object1 = JsonObjectUtils.getValue(model, "version");
		assertNotNull("Value not found", object1);
		
		JsonObject object2 = (JsonObject) JsonObjectUtils.getValue(model, "usecase");
		assertNotNull("Value not found", object2);
		
		Value object3 = JsonObjectUtils.getValue(object2, "context");
		assertNotNull("Value not found", object3);
		
		Value object4 = JsonObjectUtils.getValue(model, "blablabla");
		assertNull("Value should be null", object4);
	}
}


Any help is welcome, thank in advance.
Re: XtextRunner cannot be resolved to a variable [message #1062774 is a reply to message #1062773] Mon, 10 June 2013 16:58 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Hi are you sure the class path is OK?

--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: XtextRunner cannot be resolved to a variable [message #1062793 is a reply to message #1062773] Mon, 10 June 2013 18:45 Go to previous messageGo to next message
Thomas Fritsch is currently offline Thomas FritschFriend
Messages: 28
Registered: April 2013
Location: Germany
Junior Member
Your source is in Java, not Xtend.
Therefore you have to write
@InjectWith(JsonInjectorProvider.class)
@RunWith(XtextRunner.class)
instead of
@InjectWith(typeof(JsonInjectorProvider))
@RunWith(typeof(XtextRunner))
Re: XtextRunner cannot be resolved to a variable [message #1063136 is a reply to message #1062793] Wed, 12 June 2013 12:53 Go to previous message
Mr Manner is currently offline Mr MannerFriend
Messages: 26
Registered: January 2013
Junior Member
@Thomas thx a lot, that did the trick
Previous Topic:How to access EMF objects into a transaction
Next Topic:Fillter predicate
Goto Forum:
  


Current Time: Fri Mar 29 13:45:51 GMT 2024

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

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

Back to the top