Package net.ssehub.easy.dslCore.test
Class AbstractTest.EqualitySetup<R extends IModel>
- java.lang.Object
-
- net.ssehub.easy.dslCore.test.AbstractTest.EqualitySetup<R>
-
- Type Parameters:
R- the model type
- Enclosing class:
- AbstractTest<R extends IModel>
protected static class AbstractTest.EqualitySetup<R extends IModel> extends java.lang.ObjectSetup data needed to compare test results for equality.- Author:
- Holger Eichelberger
-
-
Field Summary
Fields Modifier and Type Field Description private booleanenableEqualsprivate java.lang.IntegerexpectedFailCodeprivate java.lang.StringexpectedFailReasonprivate java.lang.StringexpectedNameprivate java.io.FileexpectedOutputFileprivate java.io.FileexpectedTraceprivate java.lang.StringexpectedVersionprivate java.io.Filefileprivate Rmodelprivate java.util.Map<java.lang.String,java.lang.Object>parameterprivate java.lang.StringstartElement
-
Constructor Summary
Constructors Constructor Description EqualitySetup(java.io.File file, java.lang.String expectedName, java.lang.String expectedVersion)Creates an instance with no trace output and empty parameters.EqualitySetup(java.io.File file, java.lang.String expectedName, java.lang.String expectedVersion, java.io.File expectedTrace)Creates an instance with empty parameters.EqualitySetup(java.io.File file, java.lang.String expectedName, java.lang.String expectedVersion, java.io.File expectedTrace, java.util.Map<java.lang.String,java.lang.Object> parameter)Creates an instance with empty parameters.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanenableEquals()Returns wehther equal comparison shall be enabled.java.lang.IntegergetExpectedFailCode()The expected failure code.java.lang.StringgetExpectedFailReason()Returns the expected fail reason (if the execution failed).java.lang.StringgetExpectedName()Returns the expected name of the model.java.io.FilegetExpectedOutputFile()Returns the file containing the expected output.java.io.FilegetExpectedTrace()Returns the file containing the expected execution trace.java.lang.StringgetExpectedVersion()Returns the expected version of the model.java.io.FilegetFile()Returns the file containing the model.RgetModel()Returns the (overriding) model.java.util.Map<java.lang.String,java.lang.Object>getParameter()Returns the parameter mappings, i.e., the name of the top-level input parameter and their individual values.java.lang.StringgetStartElement()Returns the name of the start element for execution.voidsetEnableEquals(boolean enableEquals)Enables or disables the actual equals test and passes through to execution.voidsetExpectedFailCode(java.lang.Integer failCode)Defines an optional expected failure code.voidsetExpectedFailReason(java.lang.String failReason)Sets an optional reason for expected execution failure.voidsetExpectedOutputFile(java.io.File expectedOutputFile)Defines the file containing the expected output.voidsetModel(R model)Sets the (overriding) model.voidsetStartElement(java.lang.String startElement)Changes the name of the start element for execution.
-
-
-
Field Detail
-
file
private java.io.File file
-
expectedName
private java.lang.String expectedName
-
expectedVersion
private java.lang.String expectedVersion
-
startElement
private java.lang.String startElement
-
expectedTrace
private java.io.File expectedTrace
-
parameter
private java.util.Map<java.lang.String,java.lang.Object> parameter
-
expectedOutputFile
private java.io.File expectedOutputFile
-
enableEquals
private boolean enableEquals
-
expectedFailCode
private java.lang.Integer expectedFailCode
-
expectedFailReason
private java.lang.String expectedFailReason
-
-
Constructor Detail
-
EqualitySetup
public EqualitySetup(java.io.File file, java.lang.String expectedName, java.lang.String expectedVersion)Creates an instance with no trace output and empty parameters.- Parameters:
file- the file containing the modelexpectedName- the expected name of (at least one) containing project, (may be null to disable check)expectedVersion- the expected version ofexpectedName
-
EqualitySetup
public EqualitySetup(java.io.File file, java.lang.String expectedName, java.lang.String expectedVersion, java.io.File expectedTrace)Creates an instance with empty parameters.- Parameters:
file- the file containing the modelexpectedName- the expected name of (at least one) containing project, (may be null to disable check)expectedVersion- the expected version ofexpectedNameexpectedTrace- the expected execution trace (may be null if only parsing shall be tested)
-
EqualitySetup
public EqualitySetup(java.io.File file, java.lang.String expectedName, java.lang.String expectedVersion, java.io.File expectedTrace, java.util.Map<java.lang.String,java.lang.Object> parameter)Creates an instance with empty parameters.- Parameters:
file- the file containing the modelexpectedName- the expected name of (at least one) containing project, (may be null to disable check)expectedVersion- the expected version ofexpectedNameexpectedTrace- the expected execution trace (may be null if only parsing shall be tested)parameter- mapping
-
-
Method Detail
-
setModel
public void setModel(R model)
Sets the (overriding) model. If using this method, ensure that the model you are using is identical to the model used during tests.- Parameters:
model- the model (may be null for none)
-
getModel
public R getModel()
Returns the (overriding) model.- Returns:
- the model (may be null if there is none)
-
getFile
public java.io.File getFile()
Returns the file containing the model.- Returns:
- the file containing the model
-
getExpectedName
public java.lang.String getExpectedName()
Returns the expected name of the model.- Returns:
- the expected name
-
getExpectedVersion
public java.lang.String getExpectedVersion()
Returns the expected version of the model.- Returns:
- the expected version
-
getExpectedTrace
public java.io.File getExpectedTrace()
Returns the file containing the expected execution trace.- Returns:
- the file containing the execution trace
-
getParameter
public java.util.Map<java.lang.String,java.lang.Object> getParameter()
Returns the parameter mappings, i.e., the name of the top-level input parameter and their individual values.- Returns:
- the parameter mapping
-
getStartElement
public java.lang.String getStartElement()
Returns the name of the start element for execution.- Returns:
- the name of the start element ("main" by default)
-
setStartElement
public void setStartElement(java.lang.String startElement)
Changes the name of the start element for execution.- Parameters:
startElement- the new name of the start element
-
getExpectedOutputFile
public java.io.File getExpectedOutputFile()
Returns the file containing the expected output.- Returns:
- the file containing the expected output
-
setExpectedOutputFile
public void setExpectedOutputFile(java.io.File expectedOutputFile)
Defines the file containing the expected output.- Parameters:
expectedOutputFile- the file containing the expected output
-
enableEquals
public boolean enableEquals()
Returns wehther equal comparison shall be enabled.- Returns:
trueif enabled,falseelse
-
setEnableEquals
public void setEnableEquals(boolean enableEquals)
Enables or disables the actual equals test and passes through to execution.- Parameters:
enableEquals- whether equals shall be enabled (defaulttrue)
-
setExpectedFailReason
public void setExpectedFailReason(java.lang.String failReason)
Sets an optional reason for expected execution failure.- Parameters:
failReason- the reason for failing (may be null for none)
-
getExpectedFailReason
public java.lang.String getExpectedFailReason()
Returns the expected fail reason (if the execution failed).- Returns:
- the reason or null if unknown, not set or not failing
-
setExpectedFailCode
public void setExpectedFailCode(java.lang.Integer failCode)
Defines an optional expected failure code.- Parameters:
failCode- the failure code
-
getExpectedFailCode
public java.lang.Integer getExpectedFailCode()
The expected failure code.- Returns:
- the failure code (may be null if not set)
-
-