Class AbstractTest.EqualitySetup<R extends IModel>

  • Type Parameters:
    R - the model type
    Enclosing class:
    AbstractTest<R extends IModel>

    protected static class AbstractTest.EqualitySetup<R extends IModel>
    extends java.lang.Object
    Setup data needed to compare test results for equality.
    Author:
    Holger Eichelberger
    • 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
      boolean enableEquals()
      Returns wehther equal comparison shall be enabled.
      java.lang.Integer getExpectedFailCode()
      The expected failure code.
      java.lang.String getExpectedFailReason()
      Returns the expected fail reason (if the execution failed).
      java.lang.String getExpectedName()
      Returns the expected name of the model.
      java.io.File getExpectedOutputFile()
      Returns the file containing the expected output.
      java.io.File getExpectedTrace()
      Returns the file containing the expected execution trace.
      java.lang.String getExpectedVersion()
      Returns the expected version of the model.
      java.io.File getFile()
      Returns the file containing the model.
      R getModel()
      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.String getStartElement()
      Returns the name of the start element for execution.
      void setEnableEquals​(boolean enableEquals)
      Enables or disables the actual equals test and passes through to execution.
      void setExpectedFailCode​(java.lang.Integer failCode)
      Defines an optional expected failure code.
      void setExpectedFailReason​(java.lang.String failReason)
      Sets an optional reason for expected execution failure.
      void setExpectedOutputFile​(java.io.File expectedOutputFile)
      Defines the file containing the expected output.
      void setModel​(R model)
      Sets the (overriding) model.
      void setStartElement​(java.lang.String startElement)
      Changes the name of the start element for execution.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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
      • model

        private R extends IModel model
    • 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 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​(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 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​(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 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 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:
        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​(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)