org.eclipse.xtext.junit
Class AbstractXtextTests
java.lang.Object
junit.framework.Assert
junit.framework.TestCase
org.eclipse.xtext.junit.AbstractXtextTests
- All Implemented Interfaces:
- junit.framework.Test, ResourceLoadHelper
- Direct Known Subclasses:
- AbstractContentAssistProcessorTest
public abstract class AbstractXtextTests
- extends junit.framework.TestCase
- implements ResourceLoadHelper
- Author:
- Sven Efftinge - Initial contribution and API
Method Summary |
protected void |
assertWithXtend(java.lang.String left,
java.lang.String right,
java.lang.Object _this)
|
protected void |
assertWithXtend(java.lang.String message,
java.lang.String left,
java.lang.String right,
java.lang.Object _this)
|
protected XtextResource |
doGetResource(java.io.InputStream in,
org.eclipse.emf.common.util.URI uri)
|
|
get(java.lang.Class<T> clazz)
|
|
get(com.google.inject.Key<T> key)
|
protected java.util.List<java.lang.String> |
getAllTestGrammarPaths(boolean firstOnly)
|
protected java.io.InputStream |
getAsStream(java.lang.String model)
|
protected IAstFactory |
getASTFactory()
|
protected java.lang.String |
getCurrentFileExtension()
|
protected IGrammarAccess |
getGrammarAccess()
|
com.google.inject.Injector |
getInjector()
|
protected ILinkingService |
getLinkingService()
|
org.eclipse.emf.ecore.EObject |
getModel(java.io.InputStream model)
|
org.eclipse.emf.ecore.EObject |
getModel(java.lang.String model)
|
protected org.eclipse.emf.ecore.EObject |
getModel(XtextResource resource)
|
org.eclipse.emf.ecore.EObject |
getModelAndExpect(java.io.InputStream model,
int errors)
|
org.eclipse.emf.ecore.EObject |
getModelAndExpect(java.lang.String model,
int errors)
|
protected INodeModelFormatter |
getNodeModelFormatter()
|
protected IParser |
getParser()
|
protected IParseResult |
getParseResult(java.lang.String model)
|
protected IParseResult |
getParseResultAndExpect(java.lang.String model,
int errors)
|
protected IParseTreeConstructor |
getParseTreeConstructor()
|
XtextResource |
getResource(java.io.InputStream in)
|
XtextResource |
getResource(java.io.InputStream in,
org.eclipse.emf.common.util.URI uri)
|
XtextResource |
getResource(java.lang.String contents,
java.lang.String uri)
|
XtextResource |
getResourceAndExpect(java.io.InputStream in,
int errors)
|
XtextResource |
getResourceAndExpect(java.io.InputStream in,
org.eclipse.emf.common.util.URI uri,
int expectedErrors)
|
protected IResourceFactory |
getResourceFactory()
|
XtextResource |
getResourceFor(java.io.InputStream stream)
|
protected XtextResource |
getResourceFromString(java.lang.String model)
|
protected XtextResource |
getResourceFromStringAndExpect(java.lang.String model,
int errors)
|
protected ICompositeNode |
getRootNode(java.io.InputStream model)
|
protected ICompositeNode |
getRootNode(java.lang.String model)
|
protected ICompositeNode |
getRootNode(XtextResource resource)
|
protected ICompositeNode |
getRootNodeAndExpect(java.io.InputStream model,
int errors)
|
protected ICompositeNode |
getRootNodeAndExpect(java.lang.String model,
int errors)
|
protected IScopeProvider |
getScopeProvider()
|
protected ISerializer |
getSerializer()
|
protected IValueConverterService |
getValueConverterService()
|
protected org.eclipse.xtend.XtendFacade |
getXtendFacade()
|
protected java.lang.String[] |
importedExtensions()
|
void |
injectMembers(java.lang.Object object)
|
protected java.lang.Object |
invokeWithXtend(java.lang.String expression,
java.lang.Object _this)
|
protected java.lang.String |
readFileIntoString(java.lang.String filePath)
|
java.lang.String |
serialize(org.eclipse.emf.ecore.EObject obj)
|
protected void |
setInjector(com.google.inject.Injector injector)
|
protected void |
setUp()
|
protected boolean |
shouldTestSerializer(XtextResource resource)
|
protected void |
tearDown()
|
protected void |
with(java.lang.Class<? extends ISetup> setupClazz)
|
void |
with(ISetup setup)
|
protected void |
with(com.google.inject.Module... modules)
call this to set the language class to be used in the current test. |
Methods inherited from class junit.framework.TestCase |
countTestCases, createResult, getName, run, run, runBare, runTest, setName, toString |
Methods inherited from class junit.framework.Assert |
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame, failSame, format |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
EXPECT_ERRORS
public static final int EXPECT_ERRORS
- See Also:
- Constant Field Values
UNKNOWN_EXPECTATION
public static final int UNKNOWN_EXPECTATION
- See Also:
- Constant Field Values
AbstractXtextTests
public AbstractXtextTests()
setUp
protected void setUp()
throws java.lang.Exception
- Overrides:
setUp
in class junit.framework.TestCase
- Throws:
java.lang.Exception
tearDown
protected void tearDown()
throws java.lang.Exception
- Overrides:
tearDown
in class junit.framework.TestCase
- Throws:
java.lang.Exception
serialize
public java.lang.String serialize(org.eclipse.emf.ecore.EObject obj)
with
protected void with(com.google.inject.Module... modules)
throws java.lang.Exception
- call this to set the language class to be used in the current test.
- Throws:
java.lang.Exception
with
protected void with(java.lang.Class<? extends ISetup> setupClazz)
throws java.lang.Exception
- Throws:
java.lang.Exception
with
public void with(ISetup setup)
throws java.lang.Exception
- Throws:
java.lang.Exception
setInjector
protected void setInjector(com.google.inject.Injector injector)
getInjector
public final com.google.inject.Injector getInjector()
get
public <T> T get(java.lang.Class<T> clazz)
get
public <T> T get(com.google.inject.Key<T> key)
injectMembers
public void injectMembers(java.lang.Object object)
getParser
protected IParser getParser()
getLinkingService
protected ILinkingService getLinkingService()
getASTFactory
protected IAstFactory getASTFactory()
getGrammarAccess
protected IGrammarAccess getGrammarAccess()
getParseTreeConstructor
protected IParseTreeConstructor getParseTreeConstructor()
getResourceFactory
protected IResourceFactory getResourceFactory()
getValueConverterService
protected IValueConverterService getValueConverterService()
getSerializer
protected ISerializer getSerializer()
getNodeModelFormatter
protected INodeModelFormatter getNodeModelFormatter()
getScopeProvider
protected IScopeProvider getScopeProvider()
getAsStream
protected java.io.InputStream getAsStream(java.lang.String model)
getModel
public org.eclipse.emf.ecore.EObject getModel(java.lang.String model)
throws java.lang.Exception
- Throws:
java.lang.Exception
getModel
public final org.eclipse.emf.ecore.EObject getModel(java.io.InputStream model)
throws java.lang.Exception
- Throws:
java.lang.Exception
getModelAndExpect
public final org.eclipse.emf.ecore.EObject getModelAndExpect(java.lang.String model,
int errors)
throws java.lang.Exception
- Throws:
java.lang.Exception
getModelAndExpect
public final org.eclipse.emf.ecore.EObject getModelAndExpect(java.io.InputStream model,
int errors)
throws java.lang.Exception
- Throws:
java.lang.Exception
getModel
protected org.eclipse.emf.ecore.EObject getModel(XtextResource resource)
getResourceFromString
protected final XtextResource getResourceFromString(java.lang.String model)
throws java.lang.Exception
- Throws:
java.lang.Exception
getResourceFromStringAndExpect
protected final XtextResource getResourceFromStringAndExpect(java.lang.String model,
int errors)
throws java.lang.Exception
- Throws:
java.lang.Exception
getResource
public final XtextResource getResource(java.io.InputStream in)
throws java.lang.Exception
- Throws:
java.lang.Exception
getCurrentFileExtension
protected java.lang.String getCurrentFileExtension()
getResourceFor
public final XtextResource getResourceFor(java.io.InputStream stream)
- Specified by:
getResourceFor
in interface ResourceLoadHelper
getResourceAndExpect
public final XtextResource getResourceAndExpect(java.io.InputStream in,
int errors)
throws java.lang.Exception
- Throws:
java.lang.Exception
getResource
public final XtextResource getResource(java.io.InputStream in,
org.eclipse.emf.common.util.URI uri)
throws java.lang.Exception
- Throws:
java.lang.Exception
getResource
public final XtextResource getResource(java.lang.String contents,
java.lang.String uri)
throws java.lang.Exception
- Throws:
java.lang.Exception
getResourceAndExpect
public final XtextResource getResourceAndExpect(java.io.InputStream in,
org.eclipse.emf.common.util.URI uri,
int expectedErrors)
throws java.lang.Exception
- Throws:
java.lang.Exception
shouldTestSerializer
protected boolean shouldTestSerializer(XtextResource resource)
doGetResource
protected XtextResource doGetResource(java.io.InputStream in,
org.eclipse.emf.common.util.URI uri)
throws java.lang.Exception
- Throws:
java.lang.Exception
getRootNode
protected final ICompositeNode getRootNode(java.io.InputStream model)
throws java.lang.Exception
- Throws:
java.lang.Exception
getRootNodeAndExpect
protected final ICompositeNode getRootNodeAndExpect(java.io.InputStream model,
int errors)
throws java.lang.Exception
- Throws:
java.lang.Exception
getRootNode
protected final ICompositeNode getRootNode(XtextResource resource)
getParseResult
protected final IParseResult getParseResult(java.lang.String model)
throws java.lang.Exception
- Throws:
java.lang.Exception
getParseResultAndExpect
protected final IParseResult getParseResultAndExpect(java.lang.String model,
int errors)
throws java.lang.Exception
- Throws:
java.lang.Exception
getRootNode
protected final ICompositeNode getRootNode(java.lang.String model)
throws java.lang.Exception
- Throws:
java.lang.Exception
getRootNodeAndExpect
protected final ICompositeNode getRootNodeAndExpect(java.lang.String model,
int errors)
throws java.lang.Exception
- Throws:
java.lang.Exception
assertWithXtend
protected void assertWithXtend(java.lang.String left,
java.lang.String right,
java.lang.Object _this)
invokeWithXtend
protected java.lang.Object invokeWithXtend(java.lang.String expression,
java.lang.Object _this)
importedExtensions
protected java.lang.String[] importedExtensions()
assertWithXtend
protected void assertWithXtend(java.lang.String message,
java.lang.String left,
java.lang.String right,
java.lang.Object _this)
getXtendFacade
protected org.eclipse.xtend.XtendFacade getXtendFacade()
readFileIntoString
protected java.lang.String readFileIntoString(java.lang.String filePath)
throws java.io.IOException
- Throws:
java.io.IOException
getAllTestGrammarPaths
protected java.util.List<java.lang.String> getAllTestGrammarPaths(boolean firstOnly)