org.eclipse.xtext.junit4
Class AbstractXtextTests

java.lang.Object
  extended by org.junit.Assert
      extended by org.eclipse.xtext.junit4.AbstractXtextTests
All Implemented Interfaces:
ResourceLoadHelper
Direct Known Subclasses:
AbstractContentAssistProcessorTest

public abstract class AbstractXtextTests
extends org.junit.Assert
implements ResourceLoadHelper

Since:
2.3
Author:
Sven Efftinge - Initial contribution and API

Nested Class Summary
static class AbstractXtextTests.Keys
           
 
Field Summary
static int EXPECT_ERRORS
           
static int UNKNOWN_EXPECTATION
           
 
Constructor Summary
AbstractXtextTests()
           
 
Method Summary
protected  void checkNodeModel(XtextResource resource)
           
protected  void disableSerializerTest()
           
protected  XtextResource doGetResource(java.io.InputStream in, org.eclipse.emf.common.util.URI uri)
           
<T> T
get(java.lang.Class<T> clazz)
           
<T> T
get(com.google.inject.Key<T> key)
           
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  InvariantChecker getInvariantChecker()
           
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()
           
 void injectMembers(java.lang.Object object)
           
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)
           
 void setUp()
           
protected  boolean shouldTestSerializer(XtextResource resource)
           
 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 org.junit.Assert
assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertThat, assertThat, assertTrue, assertTrue, fail, fail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

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
Constructor Detail

AbstractXtextTests

public AbstractXtextTests()
Method Detail

setUp

public void setUp()
           throws java.lang.Exception
Throws:
java.lang.Exception

tearDown

public void tearDown()
              throws java.lang.Exception
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()

getInvariantChecker

protected InvariantChecker getInvariantChecker()

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

checkNodeModel

protected void checkNodeModel(XtextResource resource)

shouldTestSerializer

protected boolean shouldTestSerializer(XtextResource resource)

disableSerializerTest

protected void disableSerializerTest()

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

readFileIntoString

protected java.lang.String readFileIntoString(java.lang.String filePath)
                                       throws java.io.IOException
Throws:
java.io.IOException