Pepper  3.6.0
A highly extensible plattform for conversion and manipulationoflinguisticdata.
org.corpus_tools.pepper.core.SelfTestDesc Class Reference

This class is a container for a module selftest. More...

Classes

class  Builder
 

Public Member Functions

 SelfTestDesc (URI inputCorpusPath, URI expectedCorpusPath)
 Creates an object with input corpus path and expected path. More...
 
URI getInputCorpusPath ()
 
URI getExpectedCorpusPath ()
 
boolean compare (final SaltProject actualProject, final SaltProject expectedProject)
 This method is called by the Pepper framework, when making a selftest of the module. More...
 
boolean compare (final URI actualCorpusPath, final URI expectedCorpusPath)
 This method is called by the Pepper framework, when making a selftest of the module. More...
 
boolean isValid (final Collection< String > problems)
 Returns whether this object was correctly instantiated by module. More...
 
int hashCode ()
 
boolean equals (Object obj)
 
String toString ()
 

Protected Member Functions

boolean compare (final File actualFile, final File expectedFile)
 This method is called by compare(URI, URI) to compare two files with each other. More...
 
boolean compareXML (final File actualXmlFile, final File expectedXmlFile)
 This method is called by compare(URI, URI) to compare two xmlfiles with each other. More...
 

Protected Attributes

final DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance()
 

Detailed Description

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 method compare(SaltProject, SaltProject) or compare(URI, URI) is called later to compare the result produced by the module with the expected model or files.

Author
florian

Constructor & Destructor Documentation

◆ SelfTestDesc()

org.corpus_tools.pepper.core.SelfTestDesc.SelfTestDesc ( URI  inputCorpusPath,
URI  expectedCorpusPath 
)

Creates an object with input corpus path and expected path.

Parameters
inputCorpusPaththe path where the corpus used as input is located
expectedCorpusPaththe path where the expected corpus is located

Member Function Documentation

◆ compare() [1/3]

boolean org.corpus_tools.pepper.core.SelfTestDesc.compare ( final File  actualFile,
final File  expectedFile 
)
protected

This method is called by compare(URI, URI) to compare two files with each other.

You are free to overwrite this method with your own comparison.

Parameters
actualFilethe file produced by the module itself (which was generated from the files from the input corpus path)
expectedFilethe file, which is contained in expected corpus path.
Returns
true, when both files are equal, false otherwise

◆ compare() [2/3]

boolean org.corpus_tools.pepper.core.SelfTestDesc.compare ( final SaltProject  actualProject,
final 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
actualProjectis the project produced by the module itself (which was generated from the files from the input corpus path)
expectedProjectis the expected Salt model, which is created from the output corpus path.
Returns
true, when both models are equal, false otherwise

◆ compare() [3/3]

boolean org.corpus_tools.pepper.core.SelfTestDesc.compare ( final URI  actualCorpusPath,
final 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
actualCorpusPathis the corpus path produced by the module itself (which was generated from the files from the input corpus path)
expectedCorpusPathis the expected corpus path
Returns
true, when the content of both paths is equal, false otherwise

◆ compareXML()

boolean org.corpus_tools.pepper.core.SelfTestDesc.compareXML ( final File  actualXmlFile,
final File  expectedXmlFile 
)
protected

This method is called by compare(URI, URI) to compare two xmlfiles with each other.

You are free to overwrite this method with your own comparison.

Parameters
actualXmlFilethe xml file produced by the module itself (which was generated from the files from the input corpus path)
expectedXmlFilethe xml file, which is contained in expected corpus path.
Returns
true, when both files are equal, false otherwise

◆ getExpectedCorpusPath()

URI org.corpus_tools.pepper.core.SelfTestDesc.getExpectedCorpusPath ( )
Returns
the path where the expected corpus is located

◆ getInputCorpusPath()

URI org.corpus_tools.pepper.core.SelfTestDesc.getInputCorpusPath ( )
Returns
the path where the corpus used as input is located

◆ isValid()

boolean org.corpus_tools.pepper.core.SelfTestDesc.isValid ( final Collection< String >  problems)

Returns whether this object was correctly instantiated by module.

Parameters
problemswhen object is not valid, the reason(s) are written here.
Returns
true if object is valid, false otherwise