ComparisonFailure (JUnit API)
Keywords: org.junit.ComparisonFailure class

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.junit
Class ComparisonFailure

    java.lang.Object
      java.lang.Throwable
          java.lang.Error
              java.lang.AssertionError
                  org.junit.ComparisonFailure

All Implemented Interfaces:
  Serializable

    public class ComparisonFailure

extends AssertionError

Thrown when an `assertEquals(String, String)` fails. Create and throw a `ComparisonFailure` manually if you want to show users the difference between two complex strings. Inspired by a patch from Alex Chaffee (alex@purpletech.com)

See Also:
  Serialized Form

Constructor Summary
`ComparisonFailure(String message, String expected, String actual)` Constructs a comparison failure.

Method Summary
`String` | `getActual()` Returns the actual string value
`String` | `getExpected()` Returns the expected string value
`String` | `getMessage()` Returns "..." in place of common prefix and "..." in place of common suffix between expected and actual.

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

### ComparisonFailure

    public ComparisonFailure(String message,
                             String expected,
                             String actual)

  Constructs a comparison failure.

  Parameters:
    `message` - the identifying message or null
    `expected` - the expected string value
    `actual` - the actual string value

Method Detail

### getMessage

    public String getMessage()

  Returns "..." in place of common prefix and "..." in place of common suffix between expected and actual.

  Overrides:
    `getMessage` in class `Throwable`
  See Also:
    `Throwable.getMessage()`

### getActual

    public String getActual()

  Returns the actual string value

  Returns:
    the actual string value

### getExpected

    public String getExpected()

  Returns the expected string value

  Returns:
    the expected string value

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD