org.specrunner.util.aligner.core
Class DefaultAlignmentException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by org.specrunner.util.aligner.AlignmentException
              extended by org.specrunner.util.aligner.core.DefaultAlignmentException
All Implemented Interfaces:
Serializable, IPresentation

public class DefaultAlignmentException
extends AlignmentException

A alignment exception. Useful exception to be raised on string comparison errors.

Author:
Thiago Santos
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.specrunner.util.aligner.AlignmentException
aligner
 
Constructor Summary
DefaultAlignmentException(String message, IStringAligner aligner)
          Creates a exception with an aligner.
DefaultAlignmentException(String expected, String received)
          Creates a exception with two strings.
DefaultAlignmentException(String message, String expected, String received)
          Creates a exception with two strings.
 
Method Summary
protected  void addDetail(nu.xom.Element e)
          Provide detailed information of alignment.
protected  void addEquals(nu.xom.Element tr, StringBuilder aT, StringBuilder bT)
          Add a common part.
protected  void addNotEquals(int j, nu.xom.Element tr, StringBuilder aT, StringBuilder bT)
          Add a diferent part.
 nu.xom.Node asNode()
          The object representation as node.
 String asString()
          The object representation as string.
 
Methods inherited from class org.specrunner.util.aligner.AlignmentException
getAligner, getMessage
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultAlignmentException

public DefaultAlignmentException(String message,
                                 String expected,
                                 String received)
Creates a exception with two strings.

Parameters:
message - The message.
expected - The expected value.
received - The received value.

DefaultAlignmentException

public DefaultAlignmentException(String expected,
                                 String received)
Creates a exception with two strings.

Parameters:
expected - The expected value.
received - The received value.

DefaultAlignmentException

public DefaultAlignmentException(String message,
                                 IStringAligner aligner)
Creates a exception with an aligner.

Parameters:
message - The message.
aligner - The aligner.
Method Detail

asString

public String asString()
Description copied from interface: IPresentation
The object representation as string.

Returns:
String representation.

asNode

public nu.xom.Node asNode()
Description copied from interface: IPresentation
The object representation as node.

Returns:
Node representation.

addDetail

protected void addDetail(nu.xom.Element e)
Provide detailed information of alignment.

Parameters:
e - The target node.

addEquals

protected void addEquals(nu.xom.Element tr,
                         StringBuilder aT,
                         StringBuilder bT)
Add a common part.

Parameters:
tr - The line.
aT - Expected.
bT - Received.

addNotEquals

protected void addNotEquals(int j,
                            nu.xom.Element tr,
                            StringBuilder aT,
                            StringBuilder bT)
Add a diferent part.

Parameters:
j - The index.
tr - The line.
aT - The expected.
bT - The received.


Copyright © 2014. All rights reserved.