Class AbstractTest.EqualitySetup<R extends net.ssehub.easy.basics.modelManagement.IModel>

java.lang.Object
net.ssehub.easy.dslCore.test.AbstractTest.EqualitySetup<R>
Type Parameters:
R - the model type
Enclosing class:
AbstractTest<R extends net.ssehub.easy.basics.modelManagement.IModel>

protected static class AbstractTest.EqualitySetup<R extends net.ssehub.easy.basics.modelManagement.IModel> extends Object
Setup data needed to compare test results for equality.
Author:
Holger Eichelberger
  • Field Details

    • file

      private File file
    • expectedName

      private String expectedName
    • expectedVersion

      private String expectedVersion
    • startElement

      private String startElement
    • expectedTrace

      private File expectedTrace
    • parameter

      private Map<String,Object> parameter
    • expectedOutputFile

      private File expectedOutputFile
    • enableEquals

      private boolean enableEquals
    • expectedFailCode

      private Integer expectedFailCode
    • expectedFailReason

      private String expectedFailReason
    • model

      private R extends net.ssehub.easy.basics.modelManagement.IModel model
  • Constructor Details

    • EqualitySetup

      public EqualitySetup(File file, String expectedName, String expectedVersion)
      Creates an instance with no trace output and empty parameters.
      Parameters:
      file - the file containing the model
      expectedName - the expected name of (at least one) containing project, (may be null to disable check)
      expectedVersion - the expected version of expectedName
    • EqualitySetup

      public EqualitySetup(File file, String expectedName, String expectedVersion, File expectedTrace)
      Creates an instance with empty parameters.
      Parameters:
      file - the file containing the model
      expectedName - the expected name of (at least one) containing project, (may be null to disable check)
      expectedVersion - the expected version of expectedName
      expectedTrace - the expected execution trace (may be null if only parsing shall be tested)
    • EqualitySetup

      public EqualitySetup(File file, String expectedName, String expectedVersion, File expectedTrace, Map<String,Object> parameter)
      Creates an instance with empty parameters.
      Parameters:
      file - the file containing the model
      expectedName - the expected name of (at least one) containing project, (may be null to disable check)
      expectedVersion - the expected version of expectedName
      expectedTrace - the expected execution trace (may be null if only parsing shall be tested)
      parameter - mapping
  • Method Details

    • 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 File getFile()
      Returns the file containing the model.
      Returns:
      the file containing the model
    • getExpectedName

      public String getExpectedName()
      Returns the expected name of the model.
      Returns:
      the expected name
    • getExpectedVersion

      public String getExpectedVersion()
      Returns the expected version of the model.
      Returns:
      the expected version
    • getExpectedTrace

      public File getExpectedTrace()
      Returns the file containing the expected execution trace.
      Returns:
      the file containing the execution trace
    • getParameter

      public Map<String,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 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(String startElement)
      Changes the name of the start element for execution.
      Parameters:
      startElement - the new name of the start element
    • getExpectedOutputFile

      public File getExpectedOutputFile()
      Returns the file containing the expected output.
      Returns:
      the file containing the expected output
    • setExpectedOutputFile

      public void setExpectedOutputFile(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:
      true if enabled, false else
    • 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 (default true)
    • setExpectedFailReason

      public void setExpectedFailReason(String failReason)
      Sets an optional reason for expected execution failure.
      Parameters:
      failReason - the reason for failing (may be null for none)
    • getExpectedFailReason

      public 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(Integer failCode)
      Defines an optional expected failure code.
      Parameters:
      failCode - the failure code
    • getExpectedFailCode

      public Integer getExpectedFailCode()
      The expected failure code.
      Returns:
      the failure code (may be null if not set)