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 Manner
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 Dietrich
Messages: 6388
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
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 Fritsch
Messages: 19
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 Manner
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 Oct 24 12:52:55 GMT 2014

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

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