Package org.corpus_tools.pepper.core
Class SelfTestDesc
- java.lang.Object
-
- org.corpus_tools.pepper.core.SelfTestDesc
-
public class SelfTestDesc extends Object
This class is a container for a module selftest. A Pepper module provides an object of this type, and the Pepper framework consumes its methods to check the the results of the module's mapping process. Mainly this class provides an input path, which should contain all files acting as the input for the tested module. And an expected path, which contains the expected output. The methodcompare(SaltProject, SaltProject)orcompare(URI, URI)is called later to compare the result produced by the module with the expected model or files.- Author:
- florian
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSelfTestDesc.Builder
-
Field Summary
Fields Modifier and Type Field Description protected DocumentBuilderFactorydocBuilderFactory
-
Constructor Summary
Constructors Constructor Description SelfTestDesc(org.eclipse.emf.common.util.URI inputCorpusPath, org.eclipse.emf.common.util.URI expectedCorpusPath)Creates an object with input corpus path and expected path.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleancompare(File actualFile, File expectedFile)This method is called bycompare(URI, URI)to compare two files with each other.booleancompare(org.corpus_tools.salt.common.SaltProject actualProject, org.corpus_tools.salt.common.SaltProject expectedProject)This method is called by the Pepper framework, when making a selftest of the module.booleancompare(org.eclipse.emf.common.util.URI actualCorpusPath, org.eclipse.emf.common.util.URI expectedCorpusPath)This method is called by the Pepper framework, when making a selftest of the module.protected booleancompareXML(File actualXmlFile, File expectedXmlFile)This method is called bycompare(URI, URI)to compare two xmlfiles with each other.booleanequals(Object obj)org.eclipse.emf.common.util.URIgetExpectedCorpusPath()org.eclipse.emf.common.util.URIgetInputCorpusPath()inthashCode()booleanisValid(Collection<String> problems)Returns whether this object was correctly instantiated by module.StringtoString()
-
-
-
Field Detail
-
docBuilderFactory
protected final DocumentBuilderFactory docBuilderFactory
-
-
Constructor Detail
-
SelfTestDesc
public SelfTestDesc(org.eclipse.emf.common.util.URI inputCorpusPath, org.eclipse.emf.common.util.URI expectedCorpusPath)Creates an object with input corpus path and expected path.- Parameters:
inputCorpusPath- the path where the corpus used as input is locatedexpectedCorpusPath- the path where the expected corpus is located
-
-
Method Detail
-
getInputCorpusPath
public org.eclipse.emf.common.util.URI getInputCorpusPath()
- Returns:
- the path where the corpus used as input is located
-
getExpectedCorpusPath
public org.eclipse.emf.common.util.URI getExpectedCorpusPath()
- Returns:
- the path where the expected corpus is located
-
compare
public boolean compare(org.corpus_tools.salt.common.SaltProject actualProject, org.corpus_tools.salt.common.SaltProject expectedProject)This method is called by the Pepper framework, when making a selftest of the module. This method is called when tested module is an importers or manipulators. You are free to overwrite this method with your own comparison.- Parameters:
actualProject- is the project produced by the module itself (which was generated from the files from the input corpus path)expectedProject- is the expected Salt model, which is created from the output corpus path.- Returns:
- true, when both models are equal, false otherwise
-
compare
public boolean compare(org.eclipse.emf.common.util.URI actualCorpusPath, org.eclipse.emf.common.util.URI expectedCorpusPath)This method is called by the Pepper framework, when making a selftest of the module. This method is called when tested module is an exporter. You are free to overwrite this method with your own comparison.- Parameters:
actualCorpusPath- is the corpus path produced by the module itself (which was generated from the files from the input corpus path)expectedCorpusPath- is the expected corpus path- Returns:
- true, when the content of both paths is equal, false otherwise
-
compare
protected boolean compare(File actualFile, File expectedFile)
This method is called bycompare(URI, URI)to compare two files with each other. You are free to overwrite this method with your own comparison.- Parameters:
actualFile- the file produced by the module itself (which was generated from the files from the input corpus path)expectedFile- the file, which is contained in expected corpus path.- Returns:
- true, when both files are equal, false otherwise
-
compareXML
protected boolean compareXML(File actualXmlFile, File expectedXmlFile)
This method is called bycompare(URI, URI)to compare two xmlfiles with each other. You are free to overwrite this method with your own comparison.- Parameters:
actualXmlFile- the xml file produced by the module itself (which was generated from the files from the input corpus path)expectedXmlFile- the xml file, which is contained in expected corpus path.- Returns:
- true, when both files are equal, false otherwise
-
isValid
public boolean isValid(Collection<String> problems)
Returns whether this object was correctly instantiated by module.- Parameters:
problems- when object is not valid, the reason(s) are written here.- Returns:
- true if object is valid, false otherwise
-
-